Peviously, plan_cluster_use_sort() and plan_create_index_workers()
did nothing to make the dummy Query object that they generate look
any different from a user-supplied query. This is inconvenient for
exensions that use both get_relation_info_hook and planner_hook, as
there's no easy way to figure out whether a call to get_relation_info
is associated with the most recent planner invocation, or whether
it's the result of an intervening call to one of these functions.
This makes it easy to tell the difference.
/* Set up mostly-dummy planner state */
query = makeNode(Query);
query->commandType = CMD_SELECT;
+ query->querySource = QSRC_DUMMY;
glob = makeNode(PlannerGlobal);
/* Set up largely-dummy planner state */
query = makeNode(Query);
query->commandType = CMD_SELECT;
+ query->querySource = QSRC_DUMMY;
glob = makeNode(PlannerGlobal);
QSRC_INSTEAD_RULE, /* added by unconditional INSTEAD rule */
QSRC_QUAL_INSTEAD_RULE, /* added by conditional INSTEAD rule */
QSRC_NON_INSTEAD_RULE, /* added by non-INSTEAD rule */
+ QSRC_DUMMY /* internally-generated dummy query */
} QuerySource;
/* Sort ordering options for ORDER BY and CREATE INDEX */