Skip site navigation (1) Skip section navigation (2)

Simple way to get missing number

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: pgsql-sql(at)postgresql(dot)org, "pgsql-general(at)postgresql(dot)org >> \"pgsql-general(at)postgresql(dot)org\"" <pgsql-general(at)postgresql(dot)org>
Subject: Simple way to get missing number
Date: 2012-04-24 14:15:26
Message-ID: 4F96B57E.8080306@encs.concordia.ca (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-sql
Good morning,

May I know is there a simple sql command which could return missing 
numbers please?

For example,

t1(id integer)

values= 1, 2, 3 .... 5000000

select miss_num(id)
from   t1 ;


Will return:
===============
37, 800, 8001

Thanks a lot!
Emi


Responses

pgsql-sql by date

Next:From: hubert depesz lubaczewskiDate: 2012-04-24 14:31:39
Subject: Re: Simple way to get missing number
Previous:From: Jasen BettsDate: 2012-04-24 09:48:02
Subject: Re: getting the OS user name

pgsql-general by date

Next:From: hubert depesz lubaczewskiDate: 2012-04-24 14:31:39
Subject: Re: Simple way to get missing number
Previous:From: Andrew DunstanDate: 2012-04-24 14:10:24
Subject: Re: [HACKERS] Namespace of array of user defined types is confused by the parser in insert?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group