Re: ?How create a one serial decimal(500,0) column or simulate it with bigint multicolumns serial?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dani <danielcheagle(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: ?How create a one serial decimal(500,0) column or simulate it with bigint multicolumns serial?
Date: 2018-01-07 17:18:46
Message-ID: CAKFQuwaNZS5ODiZgR=Lps2ELXFdq5Jf5Dq8NFCbkadAmJwAgDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sunday, January 7, 2018, Dani <danielcheagle(at)gmail(dot)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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2018-01-07 18:16:00 Re: ?How create a one serial decimal(500,0) column or simulate it with bigint multicolumns serial?
Previous Message Dani 2018-01-07 14:11:22 Re: ?How create a one serial decimal(500,0) column or simulate it with bigint multicolumns serial?