Dear Gurus,
Version: 7.3.3, 7.4.8
I don't know for sure, but something like this happened when dumping our
server from 7.3 to 7.4. Actually, it seems to be a problem in 7.4 (maybe
also in 7.3, but unlikely -- see below, "our original way").
# create table foo (bar int, constraint foobar check (true or bar=1));
CREATE TABLE
# \d foo Table "public.foo" Column | Type | Modifiers
--------+---------+----------- bar | integer |
Check constraints: "foobar" CHECK (true OR bar = 1)
# drop table foo;
DROP TABLE
# create table foo (bar int, constraint foobar check (true));
CREATE TABLE
# \d foo Table "public.foo" Column | Type | Modifiers
--------+---------+----------- bar | integer |
Check constraints: "foobar" CHECK ()
Yours,
--
G.
---------------- our original way we found the problem:
-- original create command:
CREATE TABLE foo ( bar int, CONSTRAINT foobar CHECK (true or bar=1)
);
-- 7.3 dump:
CREATE TABLE foo ( bar int, CONSTRAINT foobar CHECK (true)
);
-- fed to 7.4, then \d
...
Check constraints: "foobar" CHECK ()
-- note the empty parentheses!
-- mirroring the database caused:
ERROR: syntax error at or near ")" at character xxx
-- recreated table (actually, readded constraint) to 7.4, then \d
...
Check constraints: "foobar" CHECK (true OR bar=1)