Hello Dario,
lunedì, 17 agosto 98, you wrote:
DB> Hi all
DB> I have been using postgreSQL for a while now and it is doing the job
DB> I want it to. Thank you to all pgsql-hackers for their good job.
DB> I am running a vanilla 6.3.2 installed from
DB> postgresql-{,clients-,devel-,data-}6.3.2-4.rpm. Some of the problems
DB> of taht distribution stem from the rpm specfile (for instance, a
DB> world-writable and world-readable pg_pwd !!) and are not interesting
DB> for this list.
DB> However, there is one thing which I find annoying:
testdata=>> CREATE TABLE test ( number int check ( number > 3 ) );
DB> works fine, but the table is dumped with a different syntax:
DB> CREATE TABLE test (number int4) CONSTRAINT test_number CHECK number > 3;
DB> which is not accepted back:
testdata=>> CREATE TABLE test (number int4) CONSTRAINT test_number CHECK number > 3;
DB> ERROR: parser: parse error at or near "constraint"
DB> Now, the second syntax is standard SQL and the parser should
DB> recognize it, but in any case at least pg_dump compliance should be
DB> aimed at.
DB> Bye
DB> Dario
DB> --
DB> ######################################################################
DB> # Dario Besseghini, system manager,
DB> # Department of Computer Science, University of Pisa
DB> # http://www.di.unipi.it/~besseghi
Ciao Dario,
Seems that your syntax (CREATE TABLE test (number int4) CONSTRAINT
test_number CHECK number > 3;)
isn't SQL standard.
-----------------------
There are two kinds of Integrity CONSTRAINTs;
- the Column constraint:
CREATE TABLE test ( number int check ( number > 3 ) );
and
- the Table constraint:
CREATE TABLE test ( number int4 CONSTRAINT test_number CHECK (number > 3));
This one has the right syntax and it works.
Best regards,
Jose' mailto:sferac@bo.nettuno.it