Re: BUG #8582: field serial getted incorrect value from automaticaly created its sequence

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8582: field serial getted incorrect value from automaticaly created its sequence
Date: 2013-11-07 19:16:51
Message-ID: 1383851811735-5777396.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

John R Pierce wrote
> On 11/7/2013 10:41 AM, Tom Lane wrote:
>>

> evgeniy.skomorokhov@

> writes:
>>> >Automaticaly created sequence takes values ​​from the range [1;
>>> >9223372036854775807] but max value of field which will be filled from
>>> >sequence - max of type integer (2147483647).
>> If you want a bigint column, use "bigserial". Not everybody wants
>> to take that space penalty, though.
>
>
> I think he's suggesting that a sequence generated from a regular serial
> probably shouldn't have that 63 bit max_value

The main advantage of the current behavior is if you hit the limit for an
integer you can alter the column type to bigint without having to mess
around with the associated sequence. If the sequence was upper-bound
limited that same conditions that caused the out-of-range error will just
generate a different kind of error (not sure which one if the sequence is
exhausted).

Its definitely not a "bug" whether you believe the behavior should be
changed or not. A sequence is de-coupled from any particular type. Maybe
if there were short, normal, and big sequences with matching performance
improvements it would matter but having only a single sequence
implementation makes the current behavior/defaults reasonable for normal
usage.

I am curious why this even came up. This seems to be the kind of thing most
people would be oblivious to.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-8582-field-serial-getted-incorrect-value-from-automaticaly-created-its-sequence-tp5777360p5777396.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-11-07 19:22:34 Re: BUG #8408: Not exactly correct error messages for failed check in presence of dropped columns.
Previous Message John R Pierce 2013-11-07 18:55:51 Re: BUG #8582: field serial getted incorrect value from automaticaly created its sequence