Re: pg with different sql?

From: Ian Barwick <barwick(at)gmx(dot)net>
To: pocm(at)rnl(dot)ist(dot)utl(dot)pt (Paulo J(dot) Matos), pgsql-sql(at)postgresql(dot)org
Subject: Re: pg with different sql?
Date: 2002-01-13 22:38:25
Message-ID: 200201132238.XAA22036@post.webmailer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-01-13 22:38:34 Re: pg with different sql?
Previous Message Paulo J. Matos 2002-01-13 22:04:16 pg with different sql?