Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3b421d

Browse files
committed
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 toint64, but that fails in this case. One effect is thatheap_form_tuple() writes tuples in a different layout thanForm_pg_sequence expects.Rather than rewrite the whole alignment code, work around the issue byreordering the columns in pg_sequence so that the first int64 columnnaturally comes out at an 8-byte boundary.
1 parentecbdc4c commitf3b421d

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5627,6 +5627,13 @@
56275627
<entry>The OID of the <structname>pg_class</> entry for this sequence</entry>
56285628
</row>
56295629

5630+
<row>
5631+
<entry><structfield>seqcycle</structfield></entry>
5632+
<entry><type>bool</type></entry>
5633+
<entry></entry>
5634+
<entry>Whether the sequence cycles</entry>
5635+
</row>
5636+
56305637
<row>
56315638
<entry><structfield>seqstart</structfield></entry>
56325639
<entry><type>int8</type></entry>
@@ -5661,13 +5668,6 @@
56615668
<entry></entry>
56625669
<entry>Cache size of the sequence</entry>
56635670
</row>
5664-
5665-
<row>
5666-
<entry><structfield>seqcycle</structfield></entry>
5667-
<entry><type>bool</type></entry>
5668-
<entry></entry>
5669-
<entry>Whether the sequence cycles</entry>
5670-
</row>
56715671
</tbody>
56725672
</tgroup>
56735673
</table>

‎src/backend/commands/sequence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
227227
memset(pgs_nulls,0,sizeof(pgs_nulls));
228228

229229
pgs_values[Anum_pg_sequence_seqrelid-1]=ObjectIdGetDatum(seqoid);
230+
pgs_values[Anum_pg_sequence_seqcycle-1]=BoolGetDatum(seqform.seqcycle);
230231
pgs_values[Anum_pg_sequence_seqstart-1]=Int64GetDatumFast(seqform.seqstart);
231232
pgs_values[Anum_pg_sequence_seqincrement-1]=Int64GetDatumFast(seqform.seqincrement);
232233
pgs_values[Anum_pg_sequence_seqmax-1]=Int64GetDatumFast(seqform.seqmax);
233234
pgs_values[Anum_pg_sequence_seqmin-1]=Int64GetDatumFast(seqform.seqmin);
234235
pgs_values[Anum_pg_sequence_seqcache-1]=Int64GetDatumFast(seqform.seqcache);
235-
pgs_values[Anum_pg_sequence_seqcycle-1]=BoolGetDatum(seqform.seqcycle);
236236

237237
tuple=heap_form_tuple(tupDesc,pgs_values,pgs_nulls);
238238
simple_heap_insert(rel,tuple);
@@ -622,11 +622,11 @@ nextval_internal(Oid relid)
622622
if (!HeapTupleIsValid(pgstuple))
623623
elog(ERROR,"cache lookup failed for sequence %u",relid);
624624
pgsform= (Form_pg_sequence)GETSTRUCT(pgstuple);
625+
cycle=pgsform->seqcycle;
625626
incby=pgsform->seqincrement;
626627
maxv=pgsform->seqmax;
627628
minv=pgsform->seqmin;
628629
cache=pgsform->seqcache;
629-
cycle=pgsform->seqcycle;
630630
ReleaseSysCache(pgstuple);
631631

632632
/* lock page' buffer and read tuple */

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO201612201
56+
#defineCATALOG_VERSION_NO201612202
5757

5858
#endif

‎src/include/catalog/pg_sequence.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
CATALOG(pg_sequence,2224)BKI_WITHOUT_OIDS
99
{
1010
Oidseqrelid;
11+
boolseqcycle;
1112
int64seqstart;
1213
int64seqincrement;
1314
int64seqmax;
1415
int64seqmin;
1516
int64seqcache;
16-
boolseqcycle;
1717
}FormData_pg_sequence;
1818

1919
typedefFormData_pg_sequence*Form_pg_sequence;
2020

2121
#defineNatts_pg_sequence7
2222
#defineAnum_pg_sequence_seqrelid1
23-
#defineAnum_pg_sequence_seqstart2
24-
#defineAnum_pg_sequence_seqincrement3
25-
#defineAnum_pg_sequence_seqmax4
26-
#defineAnum_pg_sequence_seqmin5
27-
#defineAnum_pg_sequence_seqcache6
28-
#defineAnum_pg_sequence_seqcycle7
23+
#defineAnum_pg_sequence_seqcycle2
24+
#defineAnum_pg_sequence_seqstart3
25+
#defineAnum_pg_sequence_seqincrement4
26+
#defineAnum_pg_sequence_seqmax5
27+
#defineAnum_pg_sequence_seqmin6
28+
#defineAnum_pg_sequence_seqcache7
2929

3030
#endif/* PG_SEQUENCE_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp