Re: Add YAML option to explain

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add YAML option to explain
Date: 2009-11-16 03:15:48
Message-ID: 20091116121548.7D5E.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Greg Sabino Mullane <greg(at)turnstep(dot)com> wrote:

> On 08/28/2009 02:16 PM, Greg Sabino Mullane wrote:
> > Attached patch adds YAML output option to explain:
> > explain (format YAML) select * from information_schema.columns;
>
> Updated version of the patch attached, fixes two small errors.

I've reviewed your patch. I had a trouble on assertion failure.
Maybe es->indent-- in ExplainEndOutput() is wrong.

TRAP: FailedAssertion("!(es.indent == 0)", File: "explain.c", Line: 198)
LOG: server process (PID 28750) was terminated by signal 6: Aborted

Second issue is a linebreak at the first line of yaml list.
Can we remove the linebreak between '-' and 'Plan' ?

=# EXPLAIN (format yaml) SELECT * FROM pgbench_accounts;
QUERY PLAN
-------------------------------------
-
Plan:
Node Type: Seq Scan
Relation Name: pgbench_accounts
...

I tried to fix the above issues in the attached v3 patch. I also rewrite
grouping_stack field in ExplainState into a *real* stack variable using
ExplainStateStack struct.

Other changes are only for minor cleanup:
- Normalize "es->indent * 2" and "2 * es->indent".
- Adjust posisions of '{' and '}'.
- Rewrite if-expressions to strchr().

My rewrite is relatively large. Please reversely-review the patch.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
yaml.explain.v3.patch application/octet-stream 26.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-11-16 03:23:08 Re: named parameters in SQL functions
Previous Message Andrew Dunstan 2009-11-16 03:14:22 Re: named parameters in SQL functions