Received: from ns.dsn.ro (ns.dsn.ro [217.156.107.1]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0DND9B80180 for ; Sun, 13 Jan 2002 18:13:09 -0500 (EST) (envelope-from george@dsn.ro) Received: from dsn.ro (george.dsn.ro [217.156.107.12]) by ns.dsn.ro (8.10.2/8.10.2) with ESMTP id g0DNBEW31693 for ; Mon, 14 Jan 2002 01:11:14 +0200 Message-ID: <3C4211D7.20204@dsn.ro> Date: Mon, 14 Jan 2002 01:01:43 +0200 From: George Moga Organization: DataSystems Srl Slobozia User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us, ro MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: pg with different sql? References: <87y9j1j4bj.fsf@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200201/117 X-Sequence-Number: 6206 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