Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Constantin Teodorescu <teo(at)flex(dot)ro>
Cc: PostgreSQL general <pgsql-general(at)postgreSQL(dot)org>, PostgreSQL Interfaces <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?
Date: 1998-10-29 03:32:15
Message-ID: 3637E1BF.C9C56EE0@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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

In response to

pgsql-interfaces by date

Next:From: Murad NayalDate: 1998-10-29 05:54:31
Subject: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]
Previous:From: Peter T MountDate: 1998-10-28 22:05:35
Subject: Re: [INTERFACES] [Fwd: postgresql JDBC driver question]

pgsql-general by date

Next:From: TaralDate: 1998-10-29 05:31:51
Subject: RE: [GENERAL] Solaris Compile problems
Previous:From: The Hermit HackerDate: 1998-10-29 02:23:48
Subject: Re: [GENERAL] Solaris Compile problems

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group