How to find Missing Sequences

From: "Madhavi Daroor" <madhavi(at)zoniac(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How to find Missing Sequences
Date: 2003-07-15 08:45:29
Message-ID: NHBBKMLNGKEMDMCGAMFNGEKCCAAA.madhavi@zoniac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a problem here.....I need to get a list of sequence ids of a
particular sequence. What I mean by this is....I have a table that has
say...15 records....and I'm using a sequence for the primary key of that
table. Now the values of the primary key is 1 to 10 for the 1st 10 records.
And then since the sequence has beed skipped or some other problem...the
11th record begins with 16 as the value for the primary key. So the next 5
records have primarykeys with values 16 to 20 instead of 11 to 15.

Now I want an sql statement that can fetch me a list of all these skipped
sequence id...ie, from 11 to 15. How do I do that? Or Is there any other way
(other than looping through the numbers)to find these values?

Thanx
Madhavi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message brice 2003-07-15 09:07:20 Horrible pg_restore performance, please help
Previous Message Mattias Kregert 2003-07-15 08:30:16 Re: [GENERAL] MySQL gets $19.5 MM