From: John Scalia <jscalia@cityblueprinting.com>
To: pgsql-admin@postgresql.org
Subject: getting a sequence to update properly
Date: Fri, 17 Jun 2005 16:04:12 -0400
Message-ID: <20050617194806.A04F0D2@bitstream.cityblueprinting.com> (raw)
I'm trying to add a sequence function to an already existing field. All the
4000 records for this table currently have a value already in this field,
but I'd like new ones to just get the next value by default as opposed to
users being forced to type something. What I'd like to do is to reload this
table and get the field to be updated by the sequence on the reload. I
thought that by dumping the table with pg_dump and reloading with the
generated datafile, this would happen, but the sequence's last_value field
didn't change. Apparently, the values contained in the dump file won't
update the sequence. Short of thoroughly massaging the datafile generated by
the dump and turning all those record lines into SQL INSERT statements, is
there any way to effectively update a field for an existing record so that
the field gets the value from the sequence? I would normally just set
minimum value to something greater than what already in the table, but the
manually keyed values are all over the place, and I guess I'd really like to
remove the gaps in the current values.
--
John
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: jscalia@cityblueprinting.com
Subject: Re: getting a sequence to update properly
In-Reply-To: <20050617194806.A04F0D2@bitstream.cityblueprinting.com>
References: <20050617194806.A04F0D2@bitstream.cityblueprinting.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