diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2016-12-21 12:00:00 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2016-12-21 09:06:49 -0500 |
commit | f3b421da5f4addc95812b9db05a24972b8fd9739 (patch) | |
tree | 89a189a33e6eb712353b5f6397dd728a54d2d9e9 /src/backend/commands/sequence.c | |
parent | ecbdc4c555f43b1ac284c734752b00c2ea6f277b (diff) | |
download | postgresql-f3b421da5f4addc95812b9db05a24972b8fd9739.tar.gz postgresql-f3b421da5f4addc95812b9db05a24972b8fd9739.zip |
Reorder pg_sequence columns to avoid alignment issue
On AIX, doubles are aligned at 4 bytes, but int64 is aligned at 8 bytes.
Our code assumes that doubles have alignment that can also be applied to
int64, but that fails in this case. One effect is that
heap_form_tuple() writes tuples in a different layout than
Form_pg_sequence expects.
Rather than rewrite the whole alignment code, work around the issue by
reordering the columns in pg_sequence so that the first int64 column
naturally comes out at an 8-byte boundary.
Diffstat (limited to 'src/backend/commands/sequence.c')
-rw-r--r-- | src/backend/commands/sequence.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index cdd32bc17e0..668d82771a8 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -227,12 +227,12 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq) memset(pgs_nulls, 0, sizeof(pgs_nulls)); pgs_values[Anum_pg_sequence_seqrelid - 1] = ObjectIdGetDatum(seqoid); + pgs_values[Anum_pg_sequence_seqcycle - 1] = BoolGetDatum(seqform.seqcycle); pgs_values[Anum_pg_sequence_seqstart - 1] = Int64GetDatumFast(seqform.seqstart); pgs_values[Anum_pg_sequence_seqincrement - 1] = Int64GetDatumFast(seqform.seqincrement); pgs_values[Anum_pg_sequence_seqmax - 1] = Int64GetDatumFast(seqform.seqmax); pgs_values[Anum_pg_sequence_seqmin - 1] = Int64GetDatumFast(seqform.seqmin); pgs_values[Anum_pg_sequence_seqcache - 1] = Int64GetDatumFast(seqform.seqcache); - pgs_values[Anum_pg_sequence_seqcycle - 1] = BoolGetDatum(seqform.seqcycle); tuple = heap_form_tuple(tupDesc, pgs_values, pgs_nulls); simple_heap_insert(rel, tuple); @@ -622,11 +622,11 @@ nextval_internal(Oid relid) if (!HeapTupleIsValid(pgstuple)) elog(ERROR, "cache lookup failed for sequence %u", relid); pgsform = (Form_pg_sequence) GETSTRUCT(pgstuple); + cycle = pgsform->seqcycle; incby = pgsform->seqincrement; maxv = pgsform->seqmax; minv = pgsform->seqmin; cache = pgsform->seqcache; - cycle = pgsform->seqcycle; ReleaseSysCache(pgstuple); /* lock page' buffer and read tuple */ |