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

From George Moga
Subject Re: pg with different sql?
Date
Msg-id 3C4211D7.20204@dsn.ro
Whole thread Raw
In response to pg with different sql?  (pocm@rnl.ist.utl.pt (Paulo J. Matos))
List pgsql-sql
Paulo J. Matos wrote:
> Hi all,> CREATE TABLE socio (>     id integer SERIAL PRIMARY KEY,>     nome varchar,>     alcunha string,>
data_filiacaodate)>> 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
2ndtable). I> just can't imagine what it might be.>
 



First ...
SERIAL means an integer with primary key [tableName]_pkey (socio_pkey),
not null and default set to sequence: [tableName]_[fieldName]_seq
(socio_id_seq).

Probably this is what you want!!
CREATE TABLE socio (id SERIAL,
...

Second ...
String ?? ... maybe char(x) or varchar(x) or text or ...

Third ...
FOREIGN KEY(id) REFERENCES socio ...




George Moga,george@dsn.roBraila, ROMANIA




pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg with different sql?
Next
From: "Unnikrishnan Menon"
Date:
Subject: Re: Problems with PL/PGSQL - functions