mirror of https://github.com/citusdata/citus.git
Introduce an RTE for the grouping step
247dea89f7616fdf06b7272b74abafc29e8e5860m3hm3t/pg18_dev_relation_oid_0
parent
8383666109
commit
8db2f4144b
|
@ -2218,11 +2218,28 @@ get_query_def_extended(Query *query, StringInfo buf, List *parentnamespace,
|
|||
{
|
||||
deparse_context context;
|
||||
deparse_namespace dpns;
|
||||
int rtable_size;
|
||||
|
||||
/* Guard against excessively long or deeply-nested queries */
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
check_stack_depth();
|
||||
|
||||
rtable_size = query->hasGroupRTE ?
|
||||
list_length(query->rtable) - 1 :
|
||||
list_length(query->rtable);
|
||||
|
||||
/*
|
||||
* Replace any Vars in the query's targetlist and havingQual that
|
||||
* reference GROUP outputs with the underlying grouping expressions.
|
||||
*/
|
||||
if (query->hasGroupRTE)
|
||||
{
|
||||
query->targetList = (List *)
|
||||
flatten_group_exprs(NULL, query, (Node *) query->targetList);
|
||||
query->havingQual =
|
||||
flatten_group_exprs(NULL, query, query->havingQual);
|
||||
}
|
||||
|
||||
/*
|
||||
* Before we begin to examine the query, acquire locks on referenced
|
||||
* relations, and fix up deleted columns in JOIN RTEs. This ensures
|
||||
|
@ -2247,7 +2264,7 @@ get_query_def_extended(Query *query, StringInfo buf, List *parentnamespace,
|
|||
context.targetList = NIL;
|
||||
context.windowClause = NIL;
|
||||
context.varprefix = (parentnamespace != NIL ||
|
||||
list_length(query->rtable) != 1);
|
||||
rtable_size != 1);
|
||||
context.prettyFlags = prettyFlags;
|
||||
context.wrapColumn = wrapColumn;
|
||||
context.indentLevel = startIndent;
|
||||
|
|
Loading…
Reference in New Issue