简体   繁体   English

Postgres 的转储在 HyperSQL 中不起作用

[英]Dump from Postgres is not working in HyperSQL

I have a requirement where I take a dump from Postgres server and run it in in-memory HyperSQL server.我有一个要求,我从Postgres服务器进行转储并在内存中的HyperSQL服务器中运行它。

For example let's consider below query to create a customer table:例如,让我们考虑下面的查询来创建一个客户表:

CREATE TABLE customer (
id integer DEFAULT nextval('public.customer_seq'::regclass) NOT NULL,
name character varying(255) DEFAULT NULL::character varying,
contact character varying(255) DEFAULT NULL::character varying,
address character varying(255) DEFAULT NULL::character varying);

Above query is generated from pg_dump but when I run the same query on HyperSQL it is not able to identify things starting with :: in this case ::character varying and ::regclass .上面的查询是从pg_dump生成的,但是当我在 HyperSQL 上运行相同的查询时,它无法识别以::在这种情况下为::character varying::regclass的内容。

Couldn't find anything useful in the pg_dump or Postgres manual to exclude these things from dump.pg_dump或 Postgres 手册中找不到任何有用的东西来从转储中排除这些东西。

For now I am replacing these things with other unwanted things programmatically in Java.现在,我在 Java 中以编程方式将这些东西替换为其他不需要的东西。 Is there any better way to do so?有没有更好的方法呢?

Note: I am already using SET DATABASE SQL SYNTAX PGS TRUE;注意:我已经在使用SET DATABASE SQL SYNTAX PGS TRUE; but it is not helping in this case.但在这种情况下它没有帮助。

NULL is the default by default. NULL 默认为默认值。 You can change your table to get rid of the explicit (and apparently pointless) default clause by doing:您可以通过执行以下操作更改表以摆脱显式(显然毫无意义)的默认子句:

alter table customer alter name drop default;

etc. I am a little surprised pg_dump doesn't drop it for you.等等。我有点惊讶 pg_dump 没有为你放弃它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM