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

Commit2c7b5da

Browse files
committed
Include TableFunc references when computing expression dependencies.
The TableFunc node (i.e., XMLTABLE) includes type and collation OIDsthat might not be referenced anywhere else in the expression tree,so they need to be accounted for when extracting dependencies.Fortunately, the practical effects of this are limited, since(a) it's somewhat unlikely that people would be extractingcolumns of non-builtin types from an XML document, and (b)in many scenarios, the query would contain other referencesto such types, or functions depending on them. However, it'snot hard to construct examples wherein the existing code letsone drop a type used in XMLTABLE and thereby break a view.This is evidently an original oversight in the XMLTABLE patch,so back-patch to v10 where that came in.Discussion:https://postgr.es/m/18427.1573508501@sss.pgh.pa.us
1 parent29aeda6 commit2c7b5da

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎src/backend/catalog/dependency.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,28 @@ find_expr_references_walker(Node *node,
22562256
context->addrs);
22572257
}
22582258
}
2259+
elseif (IsA(node,TableFunc))
2260+
{
2261+
TableFunc*tf= (TableFunc*)node;
2262+
ListCell*ct;
2263+
2264+
/*
2265+
* Add refs for the datatypes and collations used in the TableFunc.
2266+
*/
2267+
foreach(ct,tf->coltypes)
2268+
{
2269+
add_object_address(OCLASS_TYPE,lfirst_oid(ct),0,
2270+
context->addrs);
2271+
}
2272+
foreach(ct,tf->colcollations)
2273+
{
2274+
Oidcollid=lfirst_oid(ct);
2275+
2276+
if (OidIsValid(collid)&&collid!=DEFAULT_COLLATION_OID)
2277+
add_object_address(OCLASS_COLLATION,collid,0,
2278+
context->addrs);
2279+
}
2280+
}
22592281
elseif (IsA(node,TableSampleClause))
22602282
{
22612283
TableSampleClause*tsc= (TableSampleClause*)node;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp