Re: Auto-increment and data importing: problem pointed out in PHP builder review?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Randall Parker" <randall(at)nls(dot)net>
Cc: "PostgreSQL General" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: Auto-increment and data importing: problem pointed out in PHP builder review?
Date: 2000-07-11 02:46:18
Message-ID: 14694.963283578@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Randall Parker" <randall(at)nls(dot)net> writes:
> In particular, on his second complaint about the import and
> auto_increment: via what manner can one import a bunch of records and
> then not have the auto_increment next value be correct?

I *think* what he's griping about is that a COPY IN doesn't
automagically change the sequence counter to be >= last imported value
for the serial column.

Of course you can set the counter --- pg_dump scripts do so --- but it
doesn't happen automatically.

You could maybe force that to happen with a trigger, but IMHO the next
work that ought to be done on SERIAL is to convert it into a "real"
datatype. Then stuff like this could be made to happen in the datatype-
specific I/O routines, which seems like a better answer ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yves Dorfsman 2000-07-11 03:15:53 Re: importing into postgres from access
Previous Message Jeff Waugh 2000-07-11 02:14:47 Re: Slashdot discussion