On 8 Jul 2005, Adam Pritchard wrote:
> so I have a singleton table that keeps track of where we are in the
> pseudo-sequence. The table is very simple:
>
> CREATE TABLE t ( next BIGINT );
> INSERT INTO t ( next ) VALUES ( 0 );
>
> UPDATE t SET next = $1; -- $1 = next+1
>
> The problem is that
My application needs a counter that's guaranteed to not lose any values
even in case of rollbacks (so sequences are out), so I have a singleton
table that keeps track of where we are in the pseudo-sequence. The
table is very simple:
CREATE TABLE t ( next BIGINT );
INSERT INTO t ( next ) VALUES ( 0