Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-10 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > So, is there still value to a YAML format vs. JSON? They look similar > > to me in this simple case: > > Well, removing the various braces and brackets reduces the line count > significantly. Not convinced it's really worth much though. Ah, I see tha

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-10 Thread Tom Lane
Bruce Momjian writes: > So, is there still value to a YAML format vs. JSON? They look similar > to me in this simple case: Well, removing the various braces and brackets reduces the line count significantly. Not convinced it's really worth much though. regards, tom lane

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-10 Thread Bruce Momjian
Robert Haas wrote: > On Wed, Jun 9, 2010 at 4:48 PM, Robert Haas wrote: > > On Wed, Jun 9, 2010 at 4:47 PM, Dean Rasheed > > wrote: > >> On 9 June 2010 20:56, Robert Haas wrote: > >>> On Wed, Jun 9, 2010 at 3:50 PM, Tom Lane wrote: > Dean Rasheed writes: > > Hmm. Well it's quite subj

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 4:48 PM, Robert Haas wrote: > On Wed, Jun 9, 2010 at 4:47 PM, Dean Rasheed wrote: >> On 9 June 2010 20:56, Robert Haas wrote: >>> On Wed, Jun 9, 2010 at 3:50 PM, Tom Lane wrote: Dean Rasheed writes: > Hmm. Well it's quite subjective, but IMO it's already more re

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 20:56, Robert Haas wrote: > On Wed, Jun 9, 2010 at 3:50 PM, Tom Lane wrote: >> Dean Rasheed 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 { }

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 4:47 PM, Dean Rasheed wrote: > On 9 June 2010 20:56, Robert Haas wrote: >> On Wed, Jun 9, 2010 at 3:50 PM, Tom Lane wrote: >>> Dean Rasheed writes: Hmm. Well it's quite subjective, but IMO it's already more readable than JSON regardless of whether or not values

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Tom Lane
Dean Rasheed 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.

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 19:50, Robert Haas wrote: > After thinking about this further, I think I'd still like to take one > more crack at fixing this without quoting absolutely everything.  I > argued against this feature, but we decided to take it, and it seems > that one of the major arguments that is be

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 3:50 PM, Tom Lane wrote: > Dean Rasheed 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 signi

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 12:58 PM, Robert Haas wrote: > On Wed, Jun 9, 2010 at 12:57 PM, Dean Rasheed > wrote: >> On 9 June 2010 17:52, Robert Haas wrote: >>> On Wed, Jun 9, 2010 at 12:25 PM, Tom Lane wrote: Robert Haas writes: > On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: >>

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 12:58 PM, Robert Haas wrote: > On Wed, Jun 9, 2010 at 12:57 PM, Dean Rasheed > wrote: >> On 9 June 2010 17:52, Robert Haas wrote: >>> On Wed, Jun 9, 2010 at 12:25 PM, Tom Lane wrote: Robert Haas writes: > On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: >>

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 14:14, Robert Haas wrote: > On Wed, Jun 9, 2010 at 8:46 AM, Dean Rasheed wrote: >> On 9 June 2010 03:48, Robert Haas 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

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 12:57 PM, Dean Rasheed wrote: > On 9 June 2010 17:52, Robert Haas wrote: >> On Wed, Jun 9, 2010 at 12:25 PM, Tom Lane wrote: >>> Robert Haas writes: On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: > Why not?  Surely we can restrict EXPLAIN's set of key names to

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 17:52, Robert Haas wrote: > On Wed, Jun 9, 2010 at 12:25 PM, Tom Lane wrote: >> Robert Haas writes: >>> On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: Why not?  Surely we can restrict EXPLAIN's set of key names to be safe. >> >>> It seems to me that it would be easy for a

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 12:25 PM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: >>> Why not?  Surely we can restrict EXPLAIN's set of key names to be safe. > >> It seems to me that it would be easy for a future patch to break this >> by accident. > > Re

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 17:25, Tom Lane wrote: > Robert Haas writes: >> On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: >>> Why not?  Surely we can restrict EXPLAIN's set of key names to be safe. > >> It seems to me that it would be easy for a future patch to break this >> by accident. > > Really?  What

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Tom Lane
Robert Haas writes: > On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: >> Why not?  Surely we can restrict EXPLAIN's set of key names to be safe. > It seems to me that it would be easy for a future patch to break this > by accident. Really? What likely key names would be in need of quoting? I

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 11:14 AM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Jun 9, 2010 at 11:03 AM, Tom Lane wrote: >>> I still agree with Dean's original proposal: always quote the values of >>> strings. > >> I'd still rather rip the format out entirely than do that. > > I'd be on board

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Kevin Grittner
Dean Rasheed wrote: > So that just leaves this sort of thing: > > explain (format yaml) select * from foo as "123"; What about other quoted identifiers? If I recall correctly, a quoted identifier can contain *any* characters (although a quote must be represented as two adjacent quotes). te

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 16:05, Robert Haas wrote: > On Wed, Jun 9, 2010 at 11:03 AM, Tom Lane wrote: >> Robert Haas writes: >>> On Wed, Jun 9, 2010 at 9:35 AM, Dean Rasheed >>> wrote: > Does anyone care that Alias will sometimes be a string, and sometimes a > number? >> >>> After further revie

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Tom Lane
Robert Haas writes: > On Wed, Jun 9, 2010 at 11:03 AM, Tom Lane wrote: >> I still agree with Dean's original proposal: always quote the values of >> strings. > I'd still rather rip the format out entirely than do that. I'd be on board with that too ;-) > Dean's > proposal was based on the idea

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 11:03 AM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Jun 9, 2010 at 9:35 AM, Dean Rasheed >> wrote: Does anyone care that Alias will sometimes be a string, and sometimes a number? > >> After further review, it appears to me that this change is pretty much

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Tom Lane
Robert Haas writes: > On Wed, Jun 9, 2010 at 9:35 AM, Dean Rasheed wrote: >>> Does anyone care that Alias will sometimes be a string, and sometimes a >>> number? > After further review, it appears to me that this change is pretty much > required, because otherwise a string like 0xa won't be quo

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 9:35 AM, Dean Rasheed wrote: >>> Does anyone care that Alias will sometimes be a string, and sometimes a >>> number? >> 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,

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 8:46 AM, Dean Rasheed wrote: > On 9 June 2010 03:48, Robert Haas 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

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 03:48, Robert Haas 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

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 12:32, Robert Haas wrote: > On Wed, Jun 9, 2010 at 7:23 AM, Dean Rasheed wrote: >> On 9 June 2010 12:07, Robert Haas wrote: >>> On Wed, Jun 9, 2010 at 2:58 AM, Dean Rasheed >>> wrote: On 9 June 2010 03:48, Robert Haas wrote: > Er, I should also say, thanks for the repo

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 7:23 AM, Dean Rasheed wrote: > On 9 June 2010 12:07, Robert Haas wrote: >> On Wed, Jun 9, 2010 at 2:58 AM, Dean Rasheed >> wrote: >>> On 9 June 2010 03:48, Robert Haas wrote: Er, I should also say, thanks for the report, and please test.  I am definitely not an

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 12:07, Robert Haas wrote: > On Wed, Jun 9, 2010 at 2:58 AM, Dean Rasheed wrote: >> On 9 June 2010 03:48, Robert Haas wrote: >>> Er, I should also say, thanks for the report, and please test.  I am >>> definitely not an expert on YAML. >>> >> >> I'm not an expert on YAML either, bu

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Robert Haas
On Wed, Jun 9, 2010 at 2:58 AM, Dean Rasheed wrote: > On 9 June 2010 03:48, Robert Haas wrote: >> Er, I should also say, thanks for the report, and please test.  I am >> definitely not an expert on YAML. >> > > I'm not an expert on YAML either, but I don't think this works (at > least it breaks a

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-09 Thread Dean Rasheed
On 9 June 2010 07:58, Dean Rasheed wrote: > I prefer my patch - but then I suppose I would say that :-) > Seriously though, I can think of a number of good arguments in favour of the "quote all string values unconditionally" approach: - It's the simplest, least obtrusive fix to our code. - It's

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-08 Thread Dean Rasheed
On 9 June 2010 03:48, Robert Haas wrote: > Er, I should also say, thanks for the report, and please test.  I am > definitely not an expert on YAML. > I'm not an expert on YAML either, but I don't think this works (at least it breaks against the online YAML parser here: http://yaml-online-parser.a

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-08 Thread Robert Haas
On Tue, Jun 8, 2010 at 10:47 PM, Robert Haas wrote: > On Mon, Jun 7, 2010 at 4:14 AM, Dean Rasheed wrote: >> Testing 9.0 beta, I found that EXPLAINing certain queries in YAML >> format will produce invalid YAML, for example: >> >> explain (format yaml) select * from foo where str_val = 'a: b'; >>

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-08 Thread Robert Haas
On Mon, Jun 7, 2010 at 4:14 AM, Dean Rasheed wrote: > Testing 9.0 beta, I found that EXPLAINing certain queries in YAML > format will produce invalid YAML, for example: > > explain (format yaml) select * from foo where str_val = 'a: b'; > > The problem in this case is that a colon followed by whit

Re: [HACKERS] [BUGS] Invalid YAML output from EXPLAIN

2010-06-08 Thread Florian Weimer
* Greg Smith: > Florian Weimer wrote: >> It has been claimed before that YAML is a superset of JSON, so why >> can't the YAML folks use the existing JSON output instead? >> > > Because JSON just crosses the line where it feels like there's so much > markup that people expect a tool is necessary

Re: [HACKERS] [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Greg Smith
Tom Lane wrote: This doesn't look amazingly unlike the current JSON output, and to the extent that we have to add more quoting to it, it's going to look even more like the JSON output. I don't know about that; here's the JSON one: EXPLAIN (FORMAT JSON) SELECT * FROM customers WHERE customer

Re: [HACKERS] [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Tom Lane
Greg Smith writes: > The complaints about YAML taking up too much vertical space are > understandable, but completely opposite of what I care about. I can > e-mail a customer a YAML plan and it will survive to the other side and > even in a reply back to me. Whereas any non-trivial text forma

Re: [HACKERS] [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Greg Smith
Florian Weimer wrote: It has been claimed before that YAML is a superset of JSON, so why can't the YAML folks use the existing JSON output instead? Because JSON just crosses the line where it feels like there's so much markup that people expect a tool is necessary to read it, which has alw

Re: [HACKERS] [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Florian Weimer
* Tom Lane: > Egad ... this is supposed to be an easily machine-generatable format? Perhaps you could surround all strings with "" in the generator, and escape all potentially special characters (which seems to include some whitespace even in quoted strings, unfortunately)? It has been claimed b

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Dean Rasheed
On 7 June 2010 15:56, Tom Lane wrote: > "Greg Sabino Mullane" writes: >> I don't think the above would be particularly hard to implement myself, >> but if it becomes a really big deal, we can certainly punt by simply >> quoting anything containing an indicator (the special characters above). > >

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Tom Lane
"Greg Sabino Mullane" writes: > I don't think the above would be particularly hard to implement myself, > but if it becomes a really big deal, we can certainly punt by simply > quoting anything containing an indicator (the special characters above). I would go with that. The quoting rules you

Re: [HACKERS] [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Andrew Dunstan
Robert Haas wrote: On Mon, Jun 7, 2010 at 10:37 AM, Greg Sabino Mullane wrote: Tom Lane wrote: I don't think the above would be particularly hard to implement myself, but if it becomes a really big deal, we can certainly punt by simply quoting anything containing an indicator (the special

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Robert Haas
On Mon, Jun 7, 2010 at 10:37 AM, Greg Sabino Mullane wrote: > Tom Lane wrote: > I don't think the above would be particularly hard to implement myself, > but if it becomes a really big deal, we can certainly punt by simply > quoting anything containing an indicator (the special characters above).

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Tom Lane wrote: ... > Egad ... this is supposed to be an easily machine-generatable format? > > If it's really as broken as the above suggests, I think we should > rip it out while we still can. Heh ... not like you to shrink from a challenge.

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Tom Lane
"Greg Sabino Mullane" writes: > The rules should be: > Requires quoting only if the first character: > & * ! | > ' " % @ ` # > Same as above, but no quoting if the second character is "safe": > - ? : > Always requires quoting: > ":" "#" aka ': ' ' #' > Always requires quoting

Re: [BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Dean Rasheed wrote: ... > So the current code in escape_yaml() is inadequate for producing valid > YAML. I think it would have to also consider at least the following > characters as special "-" ":" "[" "]" "{" "}" "," "\"" "'" > "|" "*"

[BUGS] Invalid YAML output from EXPLAIN

2010-06-07 Thread Dean Rasheed
Testing 9.0 beta, I found that EXPLAINing certain queries in YAML format will produce invalid YAML, for example: explain (format yaml) select * from foo where str_val = 'a: b'; The problem in this case is that a colon followed by whitespace is not allowed in an unquoted plain YAML string because