pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedvacuum and serial primary keys
2+ messages / 2 participants
[nested] [flat]
* vacuum and serial primary keys
@ 2003-02-01 12:45 Carmen Marincu <marincuc@eeng.dcu.ie>
2003-02-01 14:16 ` Re: vacuum and serial primary keys D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 1 reply; 2+ messages in thread
From: Carmen Marincu @ 2003-02-01 12:45 UTC (permalink / raw)
To: pgsql-sql
Hello -
I am using Postgresql 7.1.3 and I have deleted 3000 rows from a table
(with DELETE).
Than I used vacuum <mytable> to actually delete the rows markes as deleted
by the DELETE command..
The trouble is that the "counter" for the serial primary key (ID field)
wasn't reset. So now althought I have only 2 rows in my table they have
the ID 3001 and 3002.
Is this normal ? If not could someone please explain me how could I reset
the "counter" to ignore the deleted rows ?
Thank you very much
Carmen
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: vacuum and serial primary keys
2003-02-01 12:45 vacuum and serial primary keys Carmen Marincu <marincuc@eeng.dcu.ie>
@ 2003-02-01 14:16 ` D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 0 replies; 2+ messages in thread
From: D'Arcy J.M. Cain @ 2003-02-01 14:16 UTC (permalink / raw)
To: Carmen Marincu <marincuc@eeng.dcu.ie>; pgsql-sql
On Saturday 01 February 2003 07:45, Carmen Marincu wrote:
> I am using Postgresql 7.1.3 and I have deleted 3000 rows from a table
> (with DELETE).
> Than I used vacuum <mytable> to actually delete the rows markes as deleted
> by the DELETE command..
> The trouble is that the "counter" for the serial primary key (ID field)
> wasn't reset. So now althought I have only 2 rows in my table they have
> the ID 3001 and 3002.
>
> Is this normal ? If not could someone please explain me how could I reset
> the "counter" to ignore the deleted rows ?
It is very normal. The last thing you need is a database engine that changes
your primary key without an explicit command to do so. In fact, sometimes I
think that the database should enforce the rule that primary keys are
immutable and not even allow it explicitely. Perhaps a configuration option.
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-02-01 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-01 12:45 vacuum and serial primary keys Carmen Marincu <marincuc@eeng.dcu.ie>
2003-02-01 14:16 ` D'Arcy J.M. Cain <darcy@druid.net>
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