pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: GRIMOIS Eric <eric.grimois@cpam-cergypontoise.cnamts.fr>
To: pgsql-sql@postgresql.org
Subject: Re: Sequence not updated after a copy ?
Date: Thu, 21 Mar 2002 12:34:13 -0800 (PST)
Message-ID: <20020321203413.58637.qmail@web20806.mail.yahoo.com> (raw)
In-Reply-To: <000c01c1d0fc$e36d1f40$3d04a837@PXXXX>


--- GRIMOIS Eric
<eric.grimois@cpam-cergypontoise.cnamts.fr> wrote:
> Hi All
> 
> Does 'COPY table FROM...' command update the
> last_value field of the
> sequence(s) related to the table ?

No.  I assume you have specified values in your source
file that take the place of the sequence-supplied
values, otherwise the COPY operation would almost
certainly fail.

> Is a setval( ) function required after completion ?

Yes: preferably before, if you want the sequence to be
available to other users while you are doing the
import.

> In this case, what's the
> best command for doing that ?

I can't find the reference in the docs just now, but I
believe it's:
SELECT setval ('sequence_name', new_value);

> 
> Thanks
> 
> Eric GRIMOIS
> Analyste programmeur
> SEI - CPAM du Val d'Oise
> 01.34.22.24.56
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo@postgresql.org
> so that your
> message can get through to the mailing list cleanly


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/



view thread (4+ messages)  latest in thread

Message-ID: <20020321203413.58637.qmail@web20806.mail.yahoo.com>
Permalink:  ../20020321203413.58637.qmail@web20806.mail.yahoo.com/
Also on:    postgresql.org/message-id/20020321203413.58637.qmail@web20806.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeff_eckermann@yahoo.com, eric.grimois@cpam-cergypontoise.cnamts.fr
  Subject: Re: Sequence not updated after a copy ?
  In-Reply-To: <20020321203413.58637.qmail@web20806.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox