Re: Invalid YAML output from EXPLAIN

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Invalid YAML output from EXPLAIN
Date: 2010-06-10 22:54:57
Message-ID: 201006102254.o5AMsve26331@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas wrote:
> On Wed, Jun 9, 2010 at 4:48 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > On Wed, Jun 9, 2010 at 4:47 PM, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> >> On 9 June 2010 20:56, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> >>> On Wed, Jun 9, 2010 at 3:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >>>> Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> >>>>> Hmm. Well it's quite subjective, but IMO it's already more readable
> >>>>> than JSON regardless of whether or not values are quoted, simply
> >>>>> because it doesn't have [ ] and { } for lists and maps, which for JSON
> >>>>> adds significantly to the number of lines in longer plans.
> >>>>
> >>>> Yeah. ?Also, I think it would be fair to not quote values that are known
> >>>> constants (for example, Node Type: Seq Scan) and are chosen to not need
> >>>> quoting. ?It's just the things that are variables that worry me.
> >>>
> >>> Passing down information about which things are known constants seems
> >>> more complicated to me than just getting the quoting rules right in
> >>> the first place. ?If you look at the patch I proposed, you'll see that
> >>> it's really quite simple and only a slight tightening of what I
> >>> committed already.
> >>>
> >>
> >> Reading the YAML spec, I've just spotted yet another case that'll
> >> break what you're proposing: if you don't quote "true" and "false",
> >> the parser will think they're booleans rather than strings.
> >>
> >> This is really why I'm opposed to this approach. There are just so
> >> many gotchas that it's impossible to be 100% sure that you've
> >> accounted for them all.
> >
> > OK, I give up.
>
> I have committed your patch, with some changes to the comments.
>
> Thanks for bearing with me.

So, is there still value to a YAML format vs. JSON? They look similar
to me in this simple case:

test=> EXPLAIN (FORMAT JSON) SELECT * FROM pg_class;
QUERY PLAN
------------------------------------
[ +
{ +
"Plan": { +
"Node Type": "Seq Scan", +
"Relation Name": "pg_class",+
"Alias": "pg_class", +
"Startup Cost": 0.00, +
"Total Cost": 9.53, +
"Plan Rows": 253, +
"Plan Width": 190 +
} +
} +
]
(1 row)

test=> EXPLAIN (FORMAT YAML) SELECT * FROM pg_class;
QUERY PLAN
-------------------------------
- Plan: +
Node Type: "Seq Scan" +
Relation Name: "pg_class"+
Alias: "pg_class" +
Startup Cost: 0.00 +
Total Cost: 9.53 +
Plan Rows: 253 +
Plan Width: 190
(1 row)

Is unquoted identifiers the only value for YAML?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ None of us is going to be here forever. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-06-10 23:09:50 Re: Invalid YAML output from EXPLAIN
Previous Message David Gardner 2010-06-10 21:39:31 Re: BUG #5497: plpythonu gives cache lookup error

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-06-10 23:09:50 Re: Invalid YAML output from EXPLAIN
Previous Message Bruce Momjian 2010-06-10 22:23:09 Re: ps display "waiting for max_standby_delay"