pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: GRIMOIS Eric <eric.grimois@cpam-cergypontoise.cnamts.fr>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sequence not updated after a copy ?
Date: 21 Mar 2002 19:01:24 +0000
Message-ID: <1016737285.21170.128.camel@linda> (raw)
In-Reply-To: <000c01c1d0fc$e36d1f40$3d04a837@PXXXX>
References: <000c01c1d0fc$e36d1f40$3d04a837@PXXXX>

On Thu, 2002-03-21 at 17:21, GRIMOIS Eric wrote:
> Hi All
> 
> Does 'COPY table FROM...' command update the last_value field of the
> sequence(s) related to the table ?

No

> Is a setval( ) function required after completion ? In this case, what's the
> best command for doing that ?

SELECT setval('sequence_name',
              (SELECT MAX(column_name)
                 FROM table_name)
             );

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "Thy word have I hid in mine heart, that I might not 
      sin against thee."        Psalms 119:11 




view thread (4+ messages)  latest in thread

Message-ID: <1016737285.21170.128.camel@linda>
Permalink:  ../1016737285.21170.128.camel@linda/
Also on:    postgresql.org/message-id/1016737285.21170.128.camel@linda

 · 

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: olly@lfix.co.uk, eric.grimois@cpam-cergypontoise.cnamts.fr
  Subject: Re: Sequence not updated after a copy ?
  In-Reply-To: <1016737285.21170.128.camel@linda>

* 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