Re: Inserting values into a SERIAL field

From: GH <grasshacker(at)over-yonder(dot)net>
To: Ian deSouza <iandesouza(at)earthlink(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Inserting values into a SERIAL field
Date: 2001-03-06 23:13:09
Message-ID: 20010306171309.B14057@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Mar 04, 2001 at 05:22:46PM +0000, some SMTP stream spewed forth:
> Hi all,
>
> Is there any SQL statement to PostgreSQL that will allow me to insert rows
> with a specified value for the SERIAL value. I know this is not what you
> want to do normally, but I'm trying to provide a kind of general export and
> import function to a generic database. Since there exists foreign key values
> in instances of other tables that point into field values for a table that
> has a SERIAL id, I'd like to somehow import all this data and continue using
> the SERIAL functionality for the highest value of the id fields.

I think what you want is
insert into table (<serial_col>, <whatever>,...) values (...);

dan

>
> Ian
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Warren Vanichuk 2001-03-06 23:42:40 Re: Inserting values into a SERIAL field
Previous Message Fernando P. Schapachnik 2001-03-06 22:35:41 Re: interval question