Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 07cf99a

Browse files
committed
Relax an Assert() that has been found to be too strict in some situations
involving unions of types having typmods. Variants of the failure are known to occur in 8.1 and up; not sure if it's possible in 8.0 and 7.4, but since the code exists that far back, I'll just patch 'em all. Per report from Brian Hurt.
1 parent 4e8b5cd commit 07cf99a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/backend/executor/execScan.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/backend/executor/execScan.c,v 1.39 2007/01/05 22:19:27 momjian Exp $
15+
* $PostgreSQL: pgsql/src/backend/executor/execScan.c,v 1.40 2007/01/24 01:25:47 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -215,8 +215,18 @@ tlist_matches_tupdesc(PlanState *ps, List *tlist, Index varno, TupleDesc tupdesc
215215
return false; /* out of order */
216216
if (att_tup->attisdropped)
217217
return false; /* table contains dropped columns */
218+
/*
219+
* Note: usually the Var's type should match the tupdesc exactly,
220+
* but in situations involving unions of columns that have different
221+
* typmods, the Var may have come from above the union and hence have
222+
* typmod -1. This is a legitimate situation since the Var still
223+
* describes the column, just not as exactly as the tupdesc does.
224+
* We could change the planner to prevent it, but it'd then insert
225+
* projection steps just to convert from specific typmod to typmod -1,
226+
* which is pretty silly.
227+
*/
218228
Assert(var->vartype == att_tup->atttypid);
219-
Assert(var->vartypmod == att_tup->atttypmod);
229+
Assert(var->vartypmod == att_tup->atttypmod || var->vartypmod == -1);
220230

221231
tlist_item = lnext(tlist_item);
222232
}

0 commit comments

Comments
 (0)