Michael Paquier wrote:
> Hm. Is symmetry an important properly for sequences? It seems to me
> that if we map with the data types we had better use the MIN values
> instead for consistency. So the concept of this patch is rather weird
> and would introduce an exception with the rest of the system just for
> sequences.
Besides there's a related compatibility break in that,
if a sequence is created in an existing release like this:
CREATE SEQUENCE s MINVALUE -9223372036854775808;
And then it's dumped/reloaded on a backend that has
the patch applied, it fails with:
MINVALUE (-9223372036854775808) is too large for sequence data type bigint
This value (-2^63) is legal in current releases, although it happens
to be off-by-1 compared to the default minvalue for a sequence going
downwards. Arguably it's the default that is weird.
I've started the thread at [1] to discuss whether it makes sense
in the first place that our CREATE SEQUENCE takes -(2^63)+1 as the
default minvalue rather than -2^63, independantly of this patch.
I think the current patch transforms this oddity into an actual
issue by making it impossible to reach the real minimum of
a sequence with regard to the type tied to it (-2^15 for smallint,
-2^31 for int, -2^63 for bigint), whereas in HEAD you can still
adjust minvalue to fix the off-by-1 against the bigint range, if you
happen to care about it, the only problem being that you first
need to figure this out by yourself.
[1]
https://www.postgresql.org/message-id/4865a75e-f490-4e9b-b8e7-3d78694c3178@manitou-mail.org
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite