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

Commit8f2e53b

Browse files
committed
Disable the recently-added use_physical_tlist optimization in cases
where the table contains dropped columns. If the columns are dropped,then their types may be gone as well, which causes ExecTypeFromTL() tofail if the dropped columns appear in a plan node's tlist. This couldbe worked around but I don't think the optimization is valuable enoughto be worth the trouble.
1 parenta4e775a commit8f2e53b

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

‎src/backend/optimizer/plan/createplan.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.139 2003/05/06 00:20:32 tgl Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.140 2003/05/11 15:03:52 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -295,6 +295,12 @@ use_physical_tlist(RelOptInfo *rel)
295295
*/
296296
if (rel->reloptkind!=RELOPT_BASEREL)
297297
return false;
298+
/*
299+
* Can't do it if relation contains dropped columns. This is detected
300+
* in plancat.c, see notes there.
301+
*/
302+
if (rel->varlist==NIL)
303+
return false;
298304
/*
299305
* Can't do it if any system columns are requested, either. (This could
300306
* possibly be fixed but would take some fragile assumptions in setrefs.c,

‎src/backend/optimizer/util/plancat.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.79 2003/02/09 06:56:27 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.80 2003/05/11 15:03:52 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -62,15 +62,29 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
6262
relation=heap_open(relationObjectId,AccessShareLock);
6363

6464
/*
65-
* Make list of physical Vars. Note we do NOT ignore dropped columns;
66-
* the intent is to model the physical tuples of the relation.
65+
* Make list of physical Vars. But if there are any dropped columns,
66+
* punt and set varlist to NIL. (XXX Ideally we would like to include
67+
* dropped columns so that the varlist models the physical tuples
68+
* of the relation. However this creates problems for ExecTypeFromTL,
69+
* which may be asked to build a tupdesc for a tlist that includes vars
70+
* of no-longer-existent types. In theory we could dig out the required
71+
* info from the pg_attribute entries of the relation, but that data is
72+
* not readily available to ExecTypeFromTL. For now, punt and don't
73+
* apply the physical-tlist optimization when there are dropped cols.)
6774
*/
6875
numattrs=RelationGetNumberOfAttributes(relation);
6976

7077
for (attrno=1;attrno <=numattrs;attrno++)
7178
{
7279
Form_pg_attributeatt_tup=relation->rd_att->attrs[attrno-1];
7380

81+
if (att_tup->attisdropped)
82+
{
83+
/* found a dropped col, so punt */
84+
varlist=NIL;
85+
break;
86+
}
87+
7488
varlist=lappend(varlist,
7589
makeVar(varno,
7690
attrno,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp