Re: pgsql: Add pg_sequence system catalog

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Add pg_sequence system catalog
Date: 2016-12-20 17:51:32
Message-ID: 87e0c1ae-d909-ec17-289c-2064747343da@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 12/20/16 11:12 AM, Peter Eisentraut wrote:
> create table test1 (id serial, t text);
> ERROR: MINVALUE (4294967296) must be less than MAXVALUE (-4294967296)
>
> Normal sequence creation works.
>
> I think this error comes from the ALTER SEQUENCE OWNED BY call that the
> serial column creation synthesizes. This would read the existing
> sequence parameters from the catalog (AlterSequence()), then parse the
> parameters (init_params()), where nothing changes except the owner. It
> still runs the crosscheck min/max, which produces the error message.
> The values complained about are 0x100000000 and 0xFFFFFFFF00000000, so
> it's possible that it's reading the catalog off by 4 bytes or some bytes
> are flipped somewhere else.

It looks like the catalog data is written without padding (relid(4),
start(8), inc(8), max(8), min(8), ...) but read with padding (relid(4),
padding(4), start(8), inc(8), max(8), min(8), ...). The difference is
that the write goes through heap_form_tuple but the read uses the Form_
struct. What is suspicious is this from the configure output:

checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 4
checking alignment of long long int... 8
checking alignment of double... 4

We use DOUBLEALIGN to align int64 values, but on this platform, that is
not correct.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2016-12-20 17:57:33 Re: pgsql: Add pg_sequence system catalog
Previous Message Alvaro Herrera 2016-12-20 17:22:14 Re: [COMMITTERS] pgsql: Implement table partitioning.

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-12-20 17:57:33 Re: pgsql: Add pg_sequence system catalog
Previous Message Alvaro Herrera 2016-12-20 17:22:14 Re: [COMMITTERS] pgsql: Implement table partitioning.