mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Refactor pull_var_clause's API to make it less tedious to extend.
In commit1d97c19a0f
and laterc1d9579dd8
, we extended pull_var_clause's API by adding enum-type arguments. That's sort of a pain to maintain, though, because it means every time we add a new behavior we must touch every last one of the call sites, even if there's a reasonable default behavior that most of them could use. Let's switch over to using a bitmask of flags, instead; that seems more maintainable and might save a nanosecond or two as well. This commit changes no behavior in itself, though I'm going to follow it up with one that does add a new behavior. In passing, remove flatten_tlist(), which has not been used since 9.1 and would otherwise need the same API changes. Removing these enums means that optimizer/tlist.h no longer needs to depend on optimizer/var.h. Changing that caused a number of C files to need addition of #include "optimizer/var.h" (probably we can thank old runs of pgrminclude for that); but on balance it seems like a good change anyway.
This commit is contained in:
@ -43,6 +43,7 @@
|
||||
#include "optimizer/prep.h"
|
||||
#include "optimizer/subselect.h"
|
||||
#include "optimizer/tlist.h"
|
||||
#include "optimizer/var.h"
|
||||
#include "parser/analyze.h"
|
||||
#include "parser/parsetree.h"
|
||||
#include "parser/parse_agg.h"
|
||||
@ -3840,7 +3841,7 @@ make_group_input_target(PlannerInfo *root, List *tlist)
|
||||
* pulled out here, too.
|
||||
*/
|
||||
non_group_vars = pull_var_clause((Node *) non_group_cols,
|
||||
PVC_RECURSE_AGGREGATES,
|
||||
PVC_RECURSE_AGGREGATES |
|
||||
PVC_INCLUDE_PLACEHOLDERS);
|
||||
sub_tlist = add_to_flat_tlist(sub_tlist, non_group_vars);
|
||||
|
||||
@ -4088,7 +4089,7 @@ make_window_input_target(PlannerInfo *root,
|
||||
* at higher levels.
|
||||
*/
|
||||
flattenable_vars = pull_var_clause((Node *) flattenable_cols,
|
||||
PVC_INCLUDE_AGGREGATES,
|
||||
PVC_INCLUDE_AGGREGATES |
|
||||
PVC_INCLUDE_PLACEHOLDERS);
|
||||
new_tlist = add_to_flat_tlist(new_tlist, flattenable_vars);
|
||||
|
||||
|
Reference in New Issue
Block a user