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

Commit8a71ee6

Browse files
committed
Fix StoreCatalogInheritance1 to use 32bit inhseqno
For no apparent reason, this function was using a 16bit-wide inhseqnovalue, rather than the correct 32 bit width which is what is stored inthe pg_inherits catalog. This becomes evident if you try to create atable with more than 65535 parents, because this error appears:ERROR: duplicate key value violates unique constraint «pg_inherits_relid_seqno_index»DETAIL: Key (inhrelid, inhseqno)=(329371, 0) already exists.Needless to say, having so many parents is an uncommon situations, whichexplains why this error has never been reported despite being havingbeen introduced with the Postgres95 1.01 sources in commitd31084e:https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/commands/creatinh.c;hb=d31084e9d111#l349Backpatch all the way back.David Rowley noticed this while reviewing a patch of mine.Discussion:https://postgr.es/m/CAKJS1f8Dn7swSEhOWwzZzssW7747YB=2Hi+T7uGud40dur69-g@mail.gmail.com
1 parent456cab2 commit8a71ee6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static void MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel)
279279
staticvoidMergeConstraintsIntoExisting(Relationchild_rel,Relationparent_rel);
280280
staticvoidStoreCatalogInheritance(OidrelationId,List*supers);
281281
staticvoidStoreCatalogInheritance1(OidrelationId,OidparentOid,
282-
int16seqNumber,RelationinhRelation);
282+
int32seqNumber,RelationinhRelation);
283283
staticintfindAttrByName(constchar*attributeName,List*schema);
284284
staticvoidAlterIndexNamespaces(RelationclassRel,Relationrel,
285285
OidoldNspOid,OidnewNspOid,ObjectAddresses*objsMoved);
@@ -1977,7 +1977,7 @@ static void
19771977
StoreCatalogInheritance(OidrelationId,List*supers)
19781978
{
19791979
Relationrelation;
1980-
int16seqNumber;
1980+
int32seqNumber;
19811981
ListCell*entry;
19821982

19831983
/*
@@ -2017,7 +2017,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
20172017
*/
20182018
staticvoid
20192019
StoreCatalogInheritance1(OidrelationId,OidparentOid,
2020-
int16seqNumber,RelationinhRelation)
2020+
int32seqNumber,RelationinhRelation)
20212021
{
20222022
TupleDescdesc=RelationGetDescr(inhRelation);
20232023
Datumvalues[Natts_pg_inherits];
@@ -2031,7 +2031,7 @@ StoreCatalogInheritance1(Oid relationId, Oid parentOid,
20312031
*/
20322032
values[Anum_pg_inherits_inhrelid-1]=ObjectIdGetDatum(relationId);
20332033
values[Anum_pg_inherits_inhparent-1]=ObjectIdGetDatum(parentOid);
2034-
values[Anum_pg_inherits_inhseqno-1]=Int16GetDatum(seqNumber);
2034+
values[Anum_pg_inherits_inhseqno-1]=Int32GetDatum(seqNumber);
20352035

20362036
memset(nulls,0,sizeof(nulls));
20372037

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp