Re: ?How create a one serial decimal(500,0) column or simulate itwith bigint multicolumns serial? - Mailing list pgsql-novice

From David G. Johnston
Subject Re: ?How create a one serial decimal(500,0) column or simulate itwith bigint multicolumns serial?
Date
Msg-id CAKFQuwaNZS5ODiZgR=Lps2ELXFdq5Jf5Dq8NFCbkadAmJwAgDA@mail.gmail.com
Whole thread Raw
In response to Re: ?How create a one serial decimal(500,0) column or simulate itwith bigint multicolumns serial?  (Dani <danielcheagle@gmail.com>)
List pgsql-novice
On Sunday, January 7, 2018, Dani <danielcheagle@gmail.com> wrote:
Hi!
  Thanks for the quotes!

  My need is one column per table (primary id and auto_increment) and bigger max value than bigint :-). for now the max value for a sequence
in Postgresql is bigint.


Create two bigint sequences.  Call nextval on the first one. If the value given is somewhere near the max call nextval on the other and reset the first one,  otherwise use currentval on the other sequence.

That should get you started: the docs should be able to fill in the blanks.

Frankly, I'd wait to add that second bigint until you are nearing exhaustion of the first bigint sequence.  Given you expected volume how long until the first sequence is exhausted?

David J.

pgsql-novice by date:

Previous
From: Dani
Date:
Subject: Re: ?How create a one serial decimal(500,0) column or simulate itwith bigint multicolumns serial?
Next
From: Andreas Kretschmer
Date:
Subject: Re: ?How create a one serial decimal(500,0) column or simulate itwith bigint multicolumns serial?