pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas G. Lockhart <lockhart@alumni.caltech.edu>
To: Constantin Teodorescu <teo@flex.ro>
Cc: PostgreSQL general <pgsql-general@postgreSQL.org>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgreSQL.org>
Subject: Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?
Date: Thu, 29 Oct 1998 03:32:15 +0000
Message-ID: <3637E1BF.C9C56EE0@alumni.caltech.edu> (raw)
References: <36376670.E573456E@flex.ro>

> 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



view thread (3+ messages)  latest in thread

Message-ID: <3637E1BF.C9C56EE0@alumni.caltech.edu>
Permalink:  ../3637E1BF.C9C56EE0@alumni.caltech.edu/
Also on:    postgresql.org/message-id/3637E1BF.C9C56EE0@alumni.caltech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: lockhart@alumni.caltech.edu, teo@flex.ro, pgsql-general@postgreSQL.org
  Subject: Re: [INTERFACES] Does "constraint" and "check" work in 6.3.2 ?
  In-Reply-To: <3637E1BF.C9C56EE0@alumni.caltech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox