| From: | Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it> | 
|---|---|
| To: | pgsql-general(at)postgreSQL(dot)org, Dario Besseghini <besseghi(at)Di(dot)Unipi(dot)IT> | 
| Subject: | Re: [GENERAL] CREATE TABLE ... CONSTRAINT | 
| Date: | 1998-08-09 13:12:49 | 
| Message-ID: | 17633.980809@bo.nettuno.it | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
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(at)bo(dot)nettuno(dot)it
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dustin Sallings | 1998-08-09 19:51:50 | Re: [GENERAL] Postgres CGI Security Problem | 
| Previous Message | Maarten Boekhold | 1998-08-09 09:09:34 | Re: [GENERAL] Postgres CGI Security Problem |