Re: Invalid YAML output from EXPLAIN - Mailing list pgsql-bugs

From Dean Rasheed
Subject Re: Invalid YAML output from EXPLAIN
Date
Msg-id AANLkTili-wQbRsrhutJoSvTy1EQWCv7TSDLqhRyRickJ@mail.gmail.com
Whole thread Raw
In response to Re: Invalid YAML output from EXPLAIN  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Invalid YAML output from EXPLAIN  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-bugs
On 9 June 2010 14:14, Robert Haas <robertmhaas@gmail.com> wrote:
> On Wed, Jun 9, 2010 at 8:46 AM, Dean Rasheed <dean.a.rasheed@gmail.com> w=
rote:
>> On 9 June 2010 03:48, Robert Haas <robertmhaas@gmail.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";
>> =A0 =A0 =A0 QUERY PLAN
>> -------------------------
>> =A0- Plan: =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+
>> =A0 =A0 Node Type: Seq Scan+
>> =A0 =A0 Relation Name: foo +
>> =A0 =A0 Alias: 123 =A0 =A0 =A0 =A0 +
>> =A0 =A0 Startup Cost: 0.00 +
>> =A0 =A0 Total Cost: 23.10 =A0+
>> =A0 =A0 Plan Rows: 1310 =A0 =A0+
>> =A0 =A0 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 =3D true unless the first character
> is alphabetic or an underscore.
>

Yes, I think that would do it.


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

Actually I doubt that I will use this feature at all! I only use
EXPLAIN from psql, and usually I'm the only one who needs to read it,
so the TEXT format will remain my preferred option.

I was just doing some random beta testing, working through the list of
cool new features.

Dean

pgsql-bugs by date:

Previous
From: Dave Page
Date:
Subject: Re: BUG #5475: Problem during Instalation
Next
From: Tom Lane
Date:
Subject: Re: Bad optimizer data for xml (WAS: xml data type implications of no =)