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