mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Further tweaks to support display of sort keys in EXPLAIN --- initial
implementation didn't work for Sort nodes associated with Append plans.
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.78 2002/05/18 21:38:40 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.79 2002/06/13 03:40:49 tgl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -681,7 +681,8 @@ show_scan_qual(List *qual, bool is_or_qual, const char *qlabel,
|
||||
outercontext = NULL;
|
||||
|
||||
context = deparse_context_for_plan(scanrelid, scancontext,
|
||||
OUTER, outercontext);
|
||||
OUTER, outercontext,
|
||||
NIL);
|
||||
|
||||
/* Deparse the expression */
|
||||
exprstr = deparse_expression(node, context, (outercontext != NULL));
|
||||
@ -726,7 +727,8 @@ show_upper_qual(List *qual, const char *qlabel,
|
||||
else
|
||||
innercontext = NULL;
|
||||
context = deparse_context_for_plan(outer_varno, outercontext,
|
||||
inner_varno, innercontext);
|
||||
inner_varno, innercontext,
|
||||
NIL);
|
||||
|
||||
/* Deparse the expression */
|
||||
node = (Node *) make_ands_explicit(qual);
|
||||
@ -761,11 +763,30 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
|
||||
|
||||
/*
|
||||
* In this routine we expect that the plan node's tlist has not been
|
||||
* processed by set_plan_references(), so any Vars will contain valid
|
||||
* varnos referencing the actual rtable.
|
||||
* processed by set_plan_references(). Normally, any Vars will contain
|
||||
* valid varnos referencing the actual rtable. But we might instead be
|
||||
* looking at a dummy tlist generated by prepunion.c; if there are
|
||||
* Vars with zero varno, use the tlist itself to determine their names.
|
||||
*/
|
||||
context = deparse_context_from_rtable(es->rtable);
|
||||
useprefix = length(es->rtable) > 1;
|
||||
if (intMember(0, pull_varnos((Node *) tlist)))
|
||||
{
|
||||
Node *outercontext;
|
||||
|
||||
outercontext = deparse_context_for_subplan("sort",
|
||||
tlist,
|
||||
es->rtable);
|
||||
context = deparse_context_for_plan(0, outercontext,
|
||||
0, NULL,
|
||||
NIL);
|
||||
useprefix = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
context = deparse_context_for_plan(0, NULL,
|
||||
0, NULL,
|
||||
es->rtable);
|
||||
useprefix = length(es->rtable) > 1;
|
||||
}
|
||||
|
||||
for (keyno = 1; keyno <= nkeys; keyno++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user