mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Fix PlaceHolderVar mechanism's interaction with outer joins.
The point of a PlaceHolderVar is to allow a non-strict expression to be evaluated below an outer join, after which its value bubbles up like a Var and can be forced to NULL when the outer join's semantics require that. However, there was a serious design oversight in that, namely that we didn't ensure that there was actually a correct place in the plan tree to evaluate the placeholder :-(. It may be necessary to delay evaluation of an outer join to ensure that a placeholder that should be evaluated below the join can be evaluated there. Per recent bug report from Kirill Simonov. Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.
This commit is contained in:
@ -1806,6 +1806,7 @@ _copyPlaceHolderInfo(PlaceHolderInfo *from)
|
||||
COPY_NODE_FIELD(ph_var);
|
||||
COPY_BITMAPSET_FIELD(ph_eval_at);
|
||||
COPY_BITMAPSET_FIELD(ph_needed);
|
||||
COPY_BITMAPSET_FIELD(ph_may_need);
|
||||
COPY_SCALAR_FIELD(ph_width);
|
||||
|
||||
return newnode;
|
||||
|
@ -838,6 +838,7 @@ _equalPlaceHolderInfo(PlaceHolderInfo *a, PlaceHolderInfo *b)
|
||||
COMPARE_NODE_FIELD(ph_var);
|
||||
COMPARE_BITMAPSET_FIELD(ph_eval_at);
|
||||
COMPARE_BITMAPSET_FIELD(ph_needed);
|
||||
COMPARE_BITMAPSET_FIELD(ph_may_need);
|
||||
COMPARE_SCALAR_FIELD(ph_width);
|
||||
|
||||
return true;
|
||||
|
@ -1768,6 +1768,7 @@ _outPlaceHolderInfo(StringInfo str, PlaceHolderInfo *node)
|
||||
WRITE_NODE_FIELD(ph_var);
|
||||
WRITE_BITMAPSET_FIELD(ph_eval_at);
|
||||
WRITE_BITMAPSET_FIELD(ph_needed);
|
||||
WRITE_BITMAPSET_FIELD(ph_may_need);
|
||||
WRITE_INT_FIELD(ph_width);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user