7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.20 1998/07/09 14:34:05 thomas Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.21 1998/07/14 03:51:42 thomas Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -472,7 +472,25 @@ transformUnionClause(List *unionClause, List *targetlist)
472
472
Oid otype ;
473
473
otype = ((TargetEntry * )lfirst (prev_target ))-> resdom -> restype ;
474
474
itype = ((TargetEntry * )lfirst (next_target ))-> resdom -> restype ;
475
- if (itype != otype )
475
+
476
+ #ifdef PARSEDEBUG
477
+ printf ("transformUnionClause: types are %d -> %d\n" , itype , otype );
478
+ #endif
479
+
480
+ /* one or both is a NULL column? then don't convert... */
481
+ if (otype == InvalidOid )
482
+ {
483
+ /* propagate a known type forward, if available */
484
+ if (itype != InvalidOid )
485
+ {
486
+ ((TargetEntry * )lfirst (prev_target ))-> resdom -> restype = itype ;
487
+ }
488
+ }
489
+ else if (itype == InvalidOid )
490
+ {
491
+ }
492
+ /* they don't match in type? then convert... */
493
+ else if (itype != otype )
476
494
{
477
495
Node * expr ;
478
496
@@ -488,6 +506,7 @@ transformUnionClause(List *unionClause, List *targetlist)
488
506
((TargetEntry * )lfirst (next_target ))-> expr = expr ;
489
507
((TargetEntry * )lfirst (next_target ))-> resdom -> restype = otype ;
490
508
}
509
+
491
510
/* both are UNKNOWN? then evaluate as text... */
492
511
else if (itype == UNKNOWNOID )
493
512
{
0 commit comments