On Wed, 24 Sep 2003, Bruce Momjian wrote: > Sent for user who is having trouble posting to bugs list:
Seems like the correct behavior to me. When CONSTRAINT is given, the name is not optional AFAICS. >From SQL99: <domain definition> ::= CREATE DOMAIN <domain name> [ AS ] <data type> [ <default clause> ] [ <domain constraint>... ] [ <collate clause> ] <domain constraint> ::= [ <constraint name definition> ] <check constraint definition> [ <constraint characteristics> ] <constraint name definition> ::= CONSTRAINT <constraint name> <check constraint definition> ::= CHECK <left paren> <search condition> <right paren> <constraint name> ::= <schema qualified name> > > > > Using 7.4b2 from tar file, not cvs. > > > > > > > > PostgreSQL 7.4beta2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 > > > > (Mandrake Linux 9.1 3.2.2-3mdk) > > > > > > > > While figuring out how to use DOMAIN's, I ran across this: > > > > > > > > begin; > > > > create domain test as integer constraint check( value > 0 ); > > > > -- ERROR: syntax error at or near "check" at character 42 > > > > create domain test as integer check( value > 0 ); > > > > -- ERROR: current transaction is aborted, queries ignored until end of > > > > transaction block > > > > > > > > Forgot to name the constraint in the first form. The second form works fine > > > > on it's own. ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match