1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Skip junk nodes when comparing UNION target list lengths.

This commit is contained in:
Bruce Momjian
1999-05-17 18:22:19 +00:00
parent 585c967720
commit 19c4e862d4
2 changed files with 25 additions and 7 deletions

View File

@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.42 1999/05/17 17:03:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.43 1999/05/17 18:22:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -2762,11 +2762,20 @@ QueryRewrite(Query *parsetree)
* attributes and the types are compatible */
void check_targetlists_are_compatible(List *prev_target, List *current_target)
{
List *next_target;
List *tl, *next_target;
int prev_len = 0, next_len = 0;
foreach(tl, prev_target)
if (!((TargetEntry *) lfirst(tl))->resdom->resjunk)
prev_len++;
foreach(next_target, current_target)
if (!((TargetEntry *) lfirst(next_target))->resdom->resjunk)
next_len++;
if (length(prev_target) !=
length(current_target))
elog(ERROR,"Each UNION | EXCEPT | INTERSECT query must have the same number of columns.");
if (prev_len != next_len)
elog(ERROR,"Each UNION | EXCEPT | INTERSECT query must have the same number of columns.");
foreach(next_target, current_target)
{
Oid itype;