Re: Invalid YAML output from EXPLAIN

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Invalid YAML output from EXPLAIN
Date: 2010-06-09 13:14:02
Message-ID: AANLkTikdxM9D8Thm9uLOnKXSdhH8rZ43GYQfXLgQ8qEE@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, Jun 9, 2010 at 8:46 AM, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> On 9 June 2010 03:48, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> please test.
>
> Well your patch definitely fixes my original bug, and AFAICT always
> produces valid YAML output now. I've only found one case where a
> particular parser has difficulty parsing the output, and you'd have to
> write a pretty perverse query to hit that case.

Excellent.

> So that just leaves this sort of thing:
>
> explain (format yaml) select * from foo as "123";
>       QUERY PLAN
> -------------------------
>  - Plan:                +
>     Node Type: Seq Scan+
>     Relation Name: foo +
>     Alias: 123         +
>     Startup Cost: 0.00 +
>     Total Cost: 23.10  +
>     Plan Rows: 1310    +
>     Plan Width: 32
> (1 row)
>
> Does anyone care that Alias will sometimes be a string, and sometimes a number?
>
> ITSM that, since postgresql knows that it's a string, it ought to
> output something that parsers can unambiguously treat as a string too.
>
> But this is also a pretty obscure case that probably only someone
> deliberately trying to be awkward would do (which is me, with my
> tester hat on :-)).

I guess we could do this by (a) conditionalizing the YAML case in
ExplainProperty() in the same way that the JSON case is currently
conditionalized, and (b) changing the first if statement in
escape_yaml() to set needs_quoting = true unless the first character
is alphabetic or an underscore.

By the way, can I ask why you're not just using the JSON format for
this? I mean, I'm glad you are, because it exposed a bug that we got
fixed before release, but it seems a little masochistic...!

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2010-06-09 13:16:35 Re: BUG #5475: Problem during Instalation
Previous Message Craig Ringer 2010-06-09 13:03:54 Re: BUG #5475: Problem during Instalation

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-06-09 13:33:02 Re: hstore ==> and deprecate =>
Previous Message rupendra.chulyadyo 2010-06-09 13:11:41 Performance of Bit String