postgresql/src/include/nodes
Tom Lane ff673f558a Fix convert_IN_to_join to properly handle the case where the subselect's
output is not of the same type that's needed for the IN comparison (ie,
where the parser inserted an implicit coercion above the subselect result).
We should record the coerced expression, not just a raw Var referencing
the subselect output, as the quantity that needs to be unique-ified if
we choose to implement the IN as Unique followed by a plain join.

As of 8.3 this error was causing crashes, as seen in bug #4113 from Javier
Hernandez, because the executor was being told to hash or sort the raw
subselect output column using operators appropriate to the coerced type.

In prior versions there was no crash because the executor chose the
hash or sort operators for itself based on the column type it saw.
However, that's still not really right, because what's unique for one data
type might not be unique for another.  In corner cases we could get multiple
outputs of a row that should appear only once, as demonstrated by the
regression test case included in this commit.

However, this patch doesn't apply cleanly to 8.2 or before, and the code
involved has shifted enough over time that I'm hesitant to try to back-patch.
Given the lack of complaints from the field about such corner cases, I think
the bug may not be important enough to risk breaking other things with a
back-patch.
2008-04-21 20:54:15 +00:00
..
bitmapset.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
execnodes.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
makefuncs.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
memnodes.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
nodeFuncs.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
nodes.h Arrange for an explicit cast applied to an ARRAY[] constructor to be applied 2008-03-20 21:42:48 +00:00
params.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
parsenodes.h Push index operator lossiness determination down to GIST/GIN opclass 2008-04-14 17:05:34 +00:00
pg_list.h Fix TransactionIdIsCurrentTransactionId() to use binary search instead of 2008-03-17 02:18:55 +00:00
plannodes.h Since createplan.c no longer cares whether index operators are lossy, it has 2008-04-13 20:51:21 +00:00
primnodes.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
print.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
readfuncs.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00
relation.h Fix convert_IN_to_join to properly handle the case where the subselect's 2008-04-21 20:54:15 +00:00
tidbitmap.h Replace "amgetmulti" AM functions with "amgetbitmap", in which the whole 2008-04-10 22:25:26 +00:00
value.h Update copyrights in source tree to 2008. 2008-01-01 19:46:01 +00:00