Re: pg with different sql?
От | Tom Lane |
---|---|
Тема | Re: pg with different sql? |
Дата | |
Msg-id | 28929.1010961574@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | pg with different sql? (pocm@rnl.ist.utl.pt (Paulo J. Matos)) |
Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: