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

Commit943140d

Browse files
committed
Avoid dangling pointer to relation name in RLS code path in DoCopy().
With RLS active, "COPY tab TO ..." failed under -DRELCACHE_FORCE_RELEASE,and would sometimes fail without that, because it used the relation namedirectly from the relcache as part of the parsetree it's building. Thatbecomes a potentially-dangling pointer as soon as the relcache entry isclosed, a bit further down. Typical symptom if the relcache entry chancedto get cleared would be "relation does not exist" error with a garbagerelation name, or possibly a core dump; but if you were really trulyunlucky, the COPY might copy from the wrong table.Per report from Andrew Dunstan that regression tests fail with-DRELCACHE_FORCE_RELEASE. The core tests now pass for me (but havenot tried "make check-world" yet).Discussion:https://postgr.es/m/7b52f900-0579-cda9-ae2e-de5da17090e6@2ndQuadrant.com
1 parent68f7b91 commit943140d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/commands/copy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,8 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
938938
* relation which we have opened and locked.
939939
*/
940940
from=makeRangeVar(get_namespace_name(RelationGetNamespace(rel)),
941-
RelationGetRelationName(rel),-1);
941+
pstrdup(RelationGetRelationName(rel)),
942+
-1);
942943

943944
/* Build query */
944945
select=makeNode(SelectStmt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp