Re: Bug with serial columns

From: Michael Fork <mfork(at)toledolink(dot)com>
To: Evelio Martinez <evelio(dot)martinez(at)testanet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Bug with serial columns
Date: 2001-01-31 12:46:43
Message-ID: Pine.BSI.4.21.0101310744240.23421-100000@glass.toledolink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Insert your values with out the idfam in them, i.e.:

INSERT INTO fam (nombre) VALUES ('TEM');
INSERT INTO fam (nombre) VALUES ('ESC');
INSERT INTO fam (nombre) VALUES ('EXP');
INSERT INTO fam (nombre) VALUES ('STA');
INSERT INTO fam (nombre) VALUES ('AME');
INSERT INTO fam (nombre) VALUES ('VOL');
INSERT INTO fam (nombre) VALUES ('FAL');
INSERT INTO fam (nombre) VALUES ('CAR');
INSERT INTO fam (nombre) VALUES ('ELE');

Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio

On Wed, 31 Jan 2001, Evelio Martinez wrote:

> Hi!
> If I execute "psql database < file.sql"
> where file.sql contents are as follow below.
>
> last_value it does not get update after inserts.
>
> I have several options :
> CREATE SEQUENCE START 9 or
> SELECT SETVAL('fam_idfam_seq', 9);
>
> Why if I execute the sentences directly from psql it works ok?
> It seems to be a bug, doesn't it ?
>
>
> CREATE TABLE fam (
> idfam serial,
> nombre varchar(60) not null,
> descrip text,
> PRIMARY KEY (idfam)
> );
>
> INSERT INTO fam (idfam,nombre) VALUES ( 1, 'TEM' );
> INSERT INTO fam (idfam,nombre) VALUES ( 2, 'ESC' );
> INSERT INTO fam (idfam,nombre) VALUES ( 3, 'EXP');
> INSERT INTO fam (idfam,nombre) VALUES ( 4, 'STA');
> INSERT INTO fam (idfam,nombre) VALUES ( 5, 'AME');
> INSERT INTO fam (idfam,nombre) VALUES ( 6, 'VOL);
> INSERT INTO fam (idfam,nombre) VALUES ( 7, 'FAL');
> INSERT INTO fam (idfam,nombre) VALUES ( 8, 'CAR');
> INSERT INTO fam (idfam,nombre) VALUES ( 9, 'ELE');
>
>
>
>
>
> --
> Evelio Martnez
> Testanet. Dept. desarrollo software.
> Av. Reino de Valencia, 15 - 5
> 46005 Valencia (Spain)
> Tel: +34 96 395 90 00
> Fax: +34 96 316 23 19
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Heise 2001-01-31 14:57:37 Index tuning - Howto
Previous Message Evelio Martinez 2001-01-31 10:56:40 Bug with serial columns