From: Tom Lane <tgl@sss.pgh.pa.us>
To: pocm@rnl.ist.utl.pt
Cc: pgsql-sql@postgresql.org
Subject: Re: pg with different sql?
Date: Sun, 13 Jan 2002 17:39:34 -0500
Message-ID: <28929.1010961574@sss.pgh.pa.us> (raw)
In-Reply-To: <87y9j1j4bj.fsf@localhost.localdomain>
References: <87y9j1j4bj.fsf@localhost.localdomain>
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
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-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, pocm@rnl.ist.utl.pt
Subject: Re: pg with different sql?
In-Reply-To: <28929.1010961574@sss.pgh.pa.us>
* 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