Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type
Date
Msg-id 31859.1521992600@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:
>  PG> While migrating a view from another RDBMS,I reached something that
>  PG> looks lie a bug in postgres.

> It's not a bug in the code, though perhaps you could point out a place
> where the documentation could be improved?

It strikes me that section 10.5 doesn't say explicitly that multiple
UNIONs are resolved pairwise.  Someone who expected "x union y union z"
to be resolved holistically, like a 3-way CASE would be, is not going
to be enlightened by that section.  Perhaps an additional example
using this exact situation would be helpful.

> (The SQL standard is of no particular help here since it does not allow
> NULL to appear "bare", except in contextually typed expressions.)

I think the SQL spec does offer considerable support for our pairwise
resolution approach --- nowhere does it suggest that "x union y union z"
is a construct that should be considered as a whole rather than as a
nest of two independent union operations.

            regards, tom lane


pgsql-bugs by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: BUG #15129: Problem with UNION/UNION ALL type setting when several NULL values before defining the proper type
Next
From: PG Bug reporting form
Date:
Subject: BUG #15130: outer-join-escape syntax seems not to work with latestjdbc-driver