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

Commit60dd40b

Browse files
committed
Under wal_level=logical, when saving old tuples, always save OID.
There's no real point in not doing this. It doesn't cost anythingin performance or space. So let's go wild.Andres Freund, with substantial editing as to style by me.
1 parent09df854 commit60dd40b

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6638,7 +6638,6 @@ ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_changed, bool *
66386638
TupleDescidx_desc;
66396639
charreplident=relation->rd_rel->relreplident;
66406640
HeapTuplekey_tuple=NULL;
6641-
boolcopy_oid= false;
66426641
boolnulls[MaxHeapAttributeNumber];
66436642
Datumvalues[MaxHeapAttributeNumber];
66446643
intnatt;
@@ -6697,20 +6696,30 @@ ExtractReplicaIdentity(Relation relation, HeapTuple tp, bool key_changed, bool *
66976696
{
66986697
intattno=idx_rel->rd_index->indkey.values[natt];
66996698

6700-
if (attno==ObjectIdAttributeNumber)
6701-
copy_oid= true;
6702-
elseif (attno<0)
6699+
if (attno<0)
6700+
{
6701+
/*
6702+
* The OID column can appear in an index definition, but that's
6703+
* OK, becuse we always copy the OID if present (see below).
6704+
* Other system columns may not.
6705+
*/
6706+
if (attno==ObjectIdAttributeNumber)
6707+
continue;
67036708
elog(ERROR,"system column in index");
6704-
else
6705-
nulls[attno-1]= false;
6709+
}
6710+
nulls[attno-1]= false;
67066711
}
67076712

67086713
key_tuple=heap_form_tuple(desc,values,nulls);
67096714
*copy= true;
67106715
RelationClose(idx_rel);
67116716

6712-
/* XXX: we could also do this unconditionally, the space is used anyway */
6713-
if (copy_oid)
6717+
/*
6718+
* Always copy oids if the table has them, even if not included in the
6719+
* index. The space in the logged tuple is used anyway, so there's little
6720+
* point in not including the information.
6721+
*/
6722+
if (relation->rd_rel->relhasoids)
67146723
HeapTupleSetOid(key_tuple,HeapTupleGetOid(tp));
67156724

67166725
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp