Re: Column with recycled sequence value

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Column with recycled sequence value
Date: 2005-01-14 09:09:40
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB1654E@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> -----Original Message-----
> From: Andrew Sullivan [mailto:ajs(at)crankycanuck(dot)ca]
> Sent: Donnerstag, 13. Jänner 2005 20:49
> To: 'pgsql-sql(at)postgresql(dot)org'
> Subject: Re: [SQL] Column with recycled sequence value
>
...
> > used 2^32 will be reached soon and then? There are far less
> than 4G-records
> > saved thus these values may be reused. How can this be accomplished?
>
> You can set the sequence up to cycle (so once it gets to the end, it
> wraps around to the beginning again). The keyword is CYCLE at CREATE
> SEQUENCE time. It defaults to NO CYCLE.
>
> One potential problem, of course, are collisions on the table,
> because some value wasn't cleared out. It sounds like you don't have
> that problem though.

actually I am asking just because of that.
The thing is, that I am able to synthetisize wonderful SELECTs but I have no
unterstanding of how to first find out wether a record doesn't exist in
order to create it in the same transaction. As user of procedural languages
I'm thinking of variables and so on. But AFAIK SQL has a way to also find a
way without them.
OR I'd like to read that I can't use SQL for this purpose and at minimum
PL/pgSQL would be appropriate for me.

PS. 32-Bit is my bussiness limitation - but also that is thinkable.

thanks

Browse pgsql-sql by date

  From Date Subject
Next Message Din Adrian 2005-01-14 09:52:46 Trick to 'run' a view on two databases and combine the result ?
Previous Message Greg Stark 2005-01-14 05:06:12 Re: Column with recycled sequence value