File tree 2 files changed +25
-7
lines changed
2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.33 1999/05/17 17:03:32 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.34 1999/05/17 18:22:18 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -767,8 +767,17 @@ transformUnionClause(List *unionClause, List *targetlist)
767
767
Query * query = (Query * ) lfirst (qlist_item );
768
768
List * prev_target = targetlist ;
769
769
List * next_target ;
770
+ int prev_len = 0 , next_len = 0 ;
770
771
771
- if (length (targetlist ) != length (query -> targetList ))
772
+ foreach (prev_target , targetlist )
773
+ if (!((TargetEntry * ) lfirst (prev_target ))-> resdom -> resjunk )
774
+ prev_len ++ ;
775
+
776
+ foreach (next_target , query -> targetList )
777
+ if (!((TargetEntry * ) lfirst (next_target ))-> resdom -> resjunk )
778
+ next_len ++ ;
779
+
780
+ if (prev_len != next_len )
772
781
elog (ERROR , "Each UNION clause must have the same number of columns" );
773
782
774
783
foreach (next_target , query -> targetList )
Original file line number Diff line number Diff line change 6
6
*
7
7
*
8
8
* IDENTIFICATION
9
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.42 1999/05/17 17:03:38 momjian Exp $
9
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.43 1999/05/17 18:22:19 momjian Exp $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -2762,11 +2762,20 @@ QueryRewrite(Query *parsetree)
2762
2762
* attributes and the types are compatible */
2763
2763
void check_targetlists_are_compatible (List * prev_target , List * current_target )
2764
2764
{
2765
- List * next_target ;
2765
+ List * tl , * next_target ;
2766
+ int prev_len = 0 , next_len = 0 ;
2767
+
2768
+ foreach (tl , prev_target )
2769
+ if (!((TargetEntry * ) lfirst (tl ))-> resdom -> resjunk )
2770
+ prev_len ++ ;
2771
+
2772
+ foreach (next_target , current_target )
2773
+ if (!((TargetEntry * ) lfirst (next_target ))-> resdom -> resjunk )
2774
+ next_len ++ ;
2766
2775
2767
- if (length ( prev_target ) !=
2768
- length ( current_target ))
2769
- elog ( ERROR , "Each UNION | EXCEPT | INTERSECT query must have the same number of columns." );
2776
+ if (prev_len != next_len )
2777
+ elog ( ERROR , "Each UNION | EXCEPT | INTERSECT query must have the same number of columns." );
2778
+
2770
2779
foreach (next_target , current_target )
2771
2780
{
2772
2781
Oid itype ;
You can’t perform that action at this time.
0 commit comments