Re: Problem with domains - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: Problem with domains
Date
Msg-id 20030924210459.H69610@megazone.bigpanda.com
Whole thread Raw
In response to Problem with domains  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Problem with domains  (Robert Creager <Robert_Creager@LogicalChaos.org>)
List pgsql-bugs
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.

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Problem with domains
Next
From: Robert Creager
Date:
Subject: Re: Problem with domains