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

Commiteeaeb1b

Browse files
committed
RewritePreprocessQuery tried to match resjunk targets against
result relation ... wrong ...
1 parentf8d856a commiteeaeb1b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

‎src/backend/rewrite/rewriteHandler.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.47 1999/06/21 01:26:56 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.48 1999/07/11 17:54:30 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -2610,25 +2610,28 @@ RewritePreprocessQuery(Query *parsetree)
26102610
* target relation. FixNew() depends on it when replacing
26112611
* *new* references in a rule action by the expressions
26122612
* from the rewritten query.
2613+
* resjunk targets are somewhat arbitrarily given a resno of 0;
2614+
* this is to prevent FixNew() from matching them to var nodes.
26132615
* ----------
26142616
*/
26152617
if (parsetree->resultRelation>0)
26162618
{
26172619
RangeTblEntry*rte;
26182620
Relationrd;
26192621
List*tl;
2620-
TargetEntry*tle;
2621-
intresdomno;
26222622

26232623
rte= (RangeTblEntry*)nth(parsetree->resultRelation-1,
26242624
parsetree->rtable);
26252625
rd=heap_openr(rte->relname);
26262626

26272627
foreach(tl,parsetree->targetList)
26282628
{
2629-
tle= (TargetEntry*)lfirst(tl);
2630-
resdomno=attnameAttNum(rd,tle->resdom->resname);
2631-
tle->resdom->resno=resdomno;
2629+
TargetEntry*tle= (TargetEntry*)lfirst(tl);
2630+
2631+
if (!tle->resdom->resjunk)
2632+
tle->resdom->resno=attnameAttNum(rd,tle->resdom->resname);
2633+
else
2634+
tle->resdom->resno=0;
26322635
}
26332636

26342637
heap_close(rd);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp