From: George Moga <george@dsn.ro>
To: pgsql-sql@postgresql.org
Subject: Re: pg with different sql?
Date: Mon, 14 Jan 2002 01:01:43 +0200
Message-ID: <3C4211D7.20204@dsn.ro> (raw)
References: <87y9j1j4bj.fsf@localhost.localdomain>
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@dsn.ro
Braila, ROMANIA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: george@dsn.ro
Subject: Re: pg with different sql?
In-Reply-To: <3C4211D7.20204@dsn.ro>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox