Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0DMecB75352 for ; Sun, 13 Jan 2002 17:40:38 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g0DMdYg28932; Sun, 13 Jan 2002 17:39:34 -0500 (EST) To: pocm@rnl.ist.utl.pt (Paulo J. Matos) cc: pgsql-sql@postgresql.org Subject: Re: pg with different sql? In-reply-to: <87y9j1j4bj.fsf@localhost.localdomain> References: <87y9j1j4bj.fsf@localhost.localdomain> Comments: In-reply-to pocm@rnl.ist.utl.pt (Paulo J. Matos) message dated "13 Jan 2002 22:04:16 +0000" Date: Sun, 13 Jan 2002 17:39:34 -0500 Message-ID: <28929.1010961574@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200201/116 X-Sequence-Number: 6205 pocm@rnl.ist.utl.pt (Paulo J. Matos) writes: > AFAIK, SQL is standard and should be the same for all DBMSs. ...rotfl... The standard is what it is, but almost everybody has their own set of extensions, variations, etc. You seem to have acquired a few nonstandardisms from your previous exposure. > CREATE TABLE socio ( > id integer SERIAL PRIMARY KEY, > nome varchar, > alcunha string, > data_filiacao date) integer OR serial, please, not both. (Serial isn't standard, btw.) "string" is not a datatype known to Postgres. Try "text", or if you want to actually conform to the standard, "varchar(N)". (varchar with no length limit, as in your second field, isn't standard either.) Also, if you're entering these commands via psql, you need a semicolon after each one. > CREATE TABLE paga_cota ( > ano integer, > mes integer, > valor integer, > id integer, > PRIMARY KEY(id,ano,mes), > FOREIGN KEY(id) REFERENCES(socio)) By my reading of the SQL spec the last line should be FOREIGN KEY(id) REFERENCES socio) There's nothing I can see in the SQL92 syntax that allows parentheses around the name of the referenced table. If this stuff works as-is on some other RDBMS, then you've learned some nonstandard habits. We're not any better; we've got our own set of nonstandardisms. Just not those ones. regards, tom lane