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

Commitbcf8e7b

Browse files
committed
take NATIVE_EXPAND_RTE_HOOK into consideration in pathman_transform_query_walker()
1 parentda061b4 commitbcf8e7b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

‎src/planner_tree_modification.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* ------------------------------------------------------------------------
99
*/
1010

11+
#include"compat/expand_rte_hook.h"
1112
#include"compat/relation_tags.h"
1213
#include"compat/rowmarks_fix.h"
1314

@@ -180,19 +181,31 @@ pathman_transform_query_walker(Node *node, void *context)
180181
staticvoid
181182
disable_standard_inheritance(Query*parse)
182183
{
183-
ListCell*lc;
184+
ListCell*lc;
185+
Indexcurrent_rti;/* current range table entry index */
184186

185-
/* Exit if it's not a SELECT query */
187+
/*
188+
* We can't handle non-SELECT queries unless
189+
* there's a pathman_expand_inherited_rtentry_hook()
190+
*/
191+
#ifndefNATIVE_EXPAND_RTE_HOOK
186192
if (parse->commandType!=CMD_SELECT)
187193
return;
194+
#endif
188195

189196
/* Walk through RangeTblEntries list */
197+
current_rti=0;
190198
foreach (lc,parse->rtable)
191199
{
192200
RangeTblEntry*rte= (RangeTblEntry*)lfirst(lc);
193201

194-
/* Operate only on simple (non-join etc) relations */
195-
if (rte->rtekind!=RTE_RELATION||rte->relkind!=RELKIND_RELATION)
202+
current_rti++;/* increment RTE index */
203+
Assert(current_rti!=0);
204+
205+
/* Process only non-result base relations */
206+
if (rte->rtekind!=RTE_RELATION||
207+
rte->relkind!=RELKIND_RELATION||
208+
parse->resultRelation==current_rti)/* is it a result relation? */
196209
continue;
197210

198211
/* Table may be partitioned */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp