Re: pg with different sql? - Mailing list pgsql-sql

From Ian Barwick
Subject Re: pg with different sql?
Date
Msg-id 200201132238.XAA22036@post.webmailer.de
Whole thread Raw
In response to pg with different sql?  (pocm@rnl.ist.utl.pt (Paulo J. Matos))
List pgsql-sql
On Sunday 13 January 2002 23:04, Paulo J. Matos wrote:
> Hi all,
>
> I'm new to postgres and I'm doing a database project for a
> subject at college in postgres. I've studied databases using
> DataBases Management Systems by Ramakrishnan.
> I've done some create tables and at psql interactive prompt I've
> done:
> \i proj.sql
> (where proj.sql is the filename with the CREATE TABLEs)
>
> AFAIK, SQL is standard and should be the same for all DBMSs.

Happy April 1st! ;-)

Your statement would be true if you interpret it thus:

"There are SQL standards which in an ideal world would be 
implemented uniformly by all (R)DBMSs".

Unfortunately, in the real world each system has its own
very individual view of SQL, meaning only the most
basic statements are universally executable. Postgres
is pretty close to SQL92 AFAIK.

> For example:
> CREATE TABLE socio (
>     id integer SERIAL PRIMARY KEY,
>     nome varchar,
>     alcunha string,
>     data_filiacao date)
>
> CREATE TABLE paga_cota (
>     ano integer,
>     mes integer,
>     valor integer,
>     id integer,
>     PRIMARY KEY(id,ano,mes),
>     FOREIGN KEY(id) REFERENCES(socio))
>
>
> After this I get an error around CREATE (of the 2nd table). I
> just can't imagine what it might be.

Nor can anyone else, if you don't provide the error message...

Just a wild guess, but try reading up on the SERIAL and STRING
data types ;-)

The docs are a good starting point:

http://www.postgresql.org/idocs/

particularly the SQL reference:

http://www.postgresql.org/idocs/index.php?reference.html


HTH 

Ian Barwick


pgsql-sql by date:

Previous
From: Jean-Luc Lachance
Date:
Subject: Re: pg with different sql?
Next
From: Tom Lane
Date:
Subject: Re: pg with different sql?