Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ? - Mailing list pgsql-interfaces

From Thomas G. Lockhart
Subject Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?
Date
Msg-id 3637E1BF.C9C56EE0@alumni.caltech.edu
Whole thread Raw
In response to Does "constraint" and "check" work in 6.3.2 ?  (Constantin Teodorescu <teo@flex.ro>)
List pgsql-interfaces
> I'm wondering if "constraint" and "check" are working !
> I am using PostgreSQL 6.3.2 and this example from man create_table is
> not working for me !
> testdb=> create table emppay (name text not null, wage float4 default
> 10.00)  constraint empcon check (wage > 5.30 and wage <= 30.00), check
> (name <> '');
> ERROR:  parser: parse error at or near "constraint"

The syntax changed slightly (in v6.3 I recall) to conform to SQL92. The
constraint clauses moved to inside the column declaration parens. Try:

create table emppay (
    name text not null,
    wage float4 default 10.00,
    constraint empcon
        check (wage > 5.30 and wage <= 30.00),
    check (name <> '')
);

                   - Tom

pgsql-interfaces by date:

Previous
From: Peter T Mount
Date:
Subject: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]
Next
From: Murad Nayal
Date:
Subject: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]