CREATE TABLE ... CONSTRAINT

Started by Dario Besseghiniover 27 years ago2 messagesgeneral
Jump to latest
#1Dario Besseghini
besseghi@Di.Unipi.IT

Hi all

I have been using postgreSQL for a while now and it is doing the job
I want it to. Thank you to all pgsql-hackers for their good job.

I am running a vanilla 6.3.2 installed from
postgresql-{,clients-,devel-,data-}6.3.2-4.rpm. Some of the problems
of taht distribution stem from the rpm specfile (for instance, a
world-writable and world-readable pg_pwd !!) and are not interesting
for this list.

However, there is one thing which I find annoying:

testdata=> CREATE TABLE test ( number int check ( number > 3 ) );

works fine, but the table is dumped with a different syntax:

CREATE TABLE test (number int4) CONSTRAINT test_number CHECK number > 3;

which is not accepted back:

testdata=> CREATE TABLE test (number int4) CONSTRAINT test_number CHECK number > 3;
ERROR: parser: parse error at or near "constraint"

Now, the second syntax is standard SQL and the parser should
recognize it, but in any case at least pg_dump compliance should be
aimed at.

Bye
Dario

--
######################################################################
# Dario Besseghini, system manager,
# Department of Computer Science, University of Pisa
# http://www.di.unipi.it/~besseghi

#2Bruce Momjian
bruce@momjian.us
In reply to: Dario Besseghini (#1)
Re: [GENERAL] CREATE TABLE ... CONSTRAINT

Hi all

I have been using postgreSQL for a while now and it is doing the job
I want it to. Thank you to all pgsql-hackers for their good job.

I am running a vanilla 6.3.2 installed from
postgresql-{,clients-,devel-,data-}6.3.2-4.rpm. Some of the problems
of taht distribution stem from the rpm specfile (for instance, a
world-writable and world-readable pg_pwd !!) and are not interesting
for this list.

However, there is one thing which I find annoying:

testdata=> CREATE TABLE test ( number int check ( number > 3 ) );

works fine, but the table is dumped with a different syntax:

CREATE TABLE test (number int4) CONSTRAINT test_number CHECK number > 3;

which is not accepted back:

testdata=> CREATE TABLE test (number int4) CONSTRAINT test_number CHECK number > 3;
ERROR: parser: parse error at or near "constraint"

Now, the second syntax is standard SQL and the parser should
recognize it, but in any case at least pg_dump compliance should be
aimed at.

This is fixed. 6.4 beta is September 1. [ I ought to make this text a
macro.]

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)