Re: Problem with domains

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>, Bugs for PostgreSQL <pgsql-bugs(at)postgreSQL(dot)org>
Subject: Re: Problem with domains
Date: 2003-09-25 04:10:53
Message-ID: 20030924210459.H69610@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Creager 2003-09-25 04:54:26 Re: Problem with domains
Previous Message Bruce Momjian 2003-09-25 03:13:53 Problem with domains