Re: How to perform an identical insert? - Mailing list pgsql-general

From Darren Ferguson
Subject Re: How to perform an identical insert?
Date
Msg-id Pine.LNX.4.10.10203220856280.29630-100000@thread.crystalballinc.com
Whole thread Raw
In response to How to perform an identical insert?  ("Axel Selk" <sel@biba.uni-bremen.de>)
List pgsql-general
You can make the field an integer field and then have a sequence that will
be your autonumber counter such as

CREATE SEQUENCE test_seq START
<the_last_number_plus_1_in_your_MS-Access_sequence>;

CREATE TABLE foo (
  foo_id INTEGER DEFAULT NEXTVAL('test_seq') NOT NULL
);

This will then mean you do not have to insert anything into that field
since it will take the next value in the sequence.
But if you do insert a value then you can still specify your own integer
if you want. Note though that when you specify your own integer you will
have to be careful since the sequence will not know about that integer.

HTH

Darren Ferguson

On Fri, 22 Mar 2002, Axel Selk wrote:

> Dear list,
> I have collected data in a Microsoft Access data base and I am trying
> now to transfer this data to a postgres data base running on a Linux
> computer. I generated SQL scripts for the structure as well as for the
> data. I have trouble with the data inserts. I want to insert the MS
> Access IDs into Postgres as all references are made to those IDs.
> But I found only the ID serial format in Postgres, which does not accept
> inserted IDs. Is there any way to insert the IDs from Access and then
> using the serial ID for any further action in Postgres?
>
> Please, advice.
>
>
> With kind regards
>
> Axel Selk
> --
>
> Dipl.-Ing. Axel Selk
>
> Bremen Institute of Industrial Technology and
> Applied Work Science (BIBA)
> - Division BIBA PPC -
> Hochschulring 20
> 28359 Bremen
> Germany
>
> phone:  +49 (0)421-218-5637
> fax: +49 (0)421-218-5551
> www.biba.uni-bremen.de
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


pgsql-general by date:

Previous
From: "Nigel J. Andrews"
Date:
Subject: Re: Huge Performance Difference on Similar Query in Pg7.2
Next
From: Heiko Klein
Date:
Subject: Re: How to perform an identical insert?