| From: | George Moga <george(at)dsn(dot)ro> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: pg with different sql? |
| Date: | 2002-01-13 23:01:43 |
| Message-ID: | 3C4211D7.20204@dsn.ro |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Paulo J. Matos wrote:
> Hi all,
> 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.
>
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(at)dsn(dot)ro
Braila, ROMANIA
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Unnikrishnan Menon | 2002-01-14 05:18:31 | Re: Problems with PL/PGSQL - functions |
| Previous Message | Tom Lane | 2002-01-13 22:39:34 | Re: pg with different sql? |