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

Commit2403e54

Browse files
committed
Fix RelationIdGetRelation calls that weren't bothering with error checks.
Some of these are quite old, but that doesn't make them not bugs.We'd rather report a failure via elog than SIGSEGV.While at it, uniformly spell the error check as !RelationIsValid(rel)rather than a bare rel == NULL test. The machine code is the samebut it seems better to be consistent.Coverity complained about this today, not sure why, because themistake is in fact old.
1 parente6af7b3 commit2403e54

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
15531553

15541554
relation=RelationIdGetRelation(reloid);
15551555

1556-
if (relation==NULL)
1556+
if (!RelationIsValid(relation))
15571557
elog(ERROR,"could not open relation with OID %u (for filenode \"%s\")",
15581558
reloid,
15591559
relpathperm(change->data.tp.relnode,
@@ -1671,7 +1671,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
16711671

16721672
relation=RelationIdGetRelation(relid);
16731673

1674-
if (relation==NULL)
1674+
if (!RelationIsValid(relation))
16751675
elog(ERROR,"could not open relation with OID %u",relid);
16761676

16771677
if (!RelationIsLogicallyLogged(relation))
@@ -3031,6 +3031,10 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn,
30313031
desc=RelationGetDescr(relation);
30323032

30333033
toast_rel=RelationIdGetRelation(relation->rd_rel->reltoastrelid);
3034+
if (!RelationIsValid(toast_rel))
3035+
elog(ERROR,"could not open relation with OID %u",
3036+
relation->rd_rel->reltoastrelid);
3037+
30343038
toast_desc=RelationGetDescr(toast_rel);
30353039

30363040
/* should we allocate from stack instead? */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp