[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

Re: [BUGS] Re: BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail

2010-06-07 Thread Dimitri Fontaine
Craig Ringer writes: >> - other products are happy to solve the DISTINCT restriction without >> any hint as far as what the datatype really is > > ... and so is Pg. That's not the problem; Pg complains after resolving the > SELECT DISTINCT, when it finds that it's trying to insert values of

Re: [BUGS] BUG #5490: Using distinct for select list causes insert of timestamp string literal to fail

2010-06-07 Thread Farid Zidan
Craig, I know it's not what you want (Pg behaving how you expect out of the box) but creating implicit casts to the desired types will resolve your immediate issue. You still have to run some Pg-specific code, but it can be restricted to your DDL where there's (presumably) already plenty. My

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 "-" ":" "[" "]" "{" "}" "," "\"" "'" > "|" "*"

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] BUG #5490: INSERT doesn't force cast from text to timestamp

2010-06-07 Thread Andy Balholm
Craig Ringer wrote: > showing that your issue isn't actually with DISTINCT at all, but with Pg's > unwillingness to *implicitly* cast a value of explict text type to another > type. Is there a way to make values of "undefined" type pass through the SELECT DISTINCT filter (getting checked for un

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 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] BUG #5490: INSERT doesn't force cast from text to timestamp

2010-06-07 Thread Robert Haas
On Mon, Jun 7, 2010 at 10:30 AM, Andy Balholm wrote: > Craig Ringer wrote: >> showing that your issue isn't actually with DISTINCT at all, but with Pg's >> unwillingness to *implicitly* cast a value of explict text type to another >> type. > > Is there a way to make values of "undefined" type pa

Re: [BUGS] BUG #5490: INSERT doesn't force cast from text to timestamp

2010-06-07 Thread Tom Lane
Andy Balholm writes: > Is there a way to make values of "undefined" type pass through the > SELECT DISTINCT filter (getting checked for uniqueness) but remain > "undefined" No. What is your criterion for deciding that two values are distinct? It's not possible to do that without imputing a data

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 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: [BUGS] BUG #5490: INSERT doesn't force cast from text to timestamp

2010-06-07 Thread Andy Balholm
On Jun 7, 2010, at 7:53 AM, Tom Lane wrote: > Andy Balholm writes: >> Is there a way to make values of "undefined" type pass through the >> SELECT DISTINCT filter (getting checked for uniqueness) but remain >> "undefined" > > No. What is your criterion for deciding that two values are distinct?

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] BUG #5490: INSERT doesn't force cast from text to timestamp

2010-06-07 Thread Greg Stark
On Mon, Jun 7, 2010 at 3:52 PM, Robert Haas wrote: >> Is there a way to make values of "undefined" type pass through the SELECT >> DISTINCT filter (getting checked for uniqueness) but remain "undefined" if >> all the values supplied for the column are "undefined"? The concept of "uniqueness" de

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: [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 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
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

[BUGS] BUG #5491: Queries performing slowly

2010-06-07 Thread Piergiorgio Buongiovanni
The following bug has been logged online: Bug reference: 5491 Logged by: Piergiorgio Buongiovanni Email address: piergiorgio.buongiova...@netspa.it PostgreSQL version: 8.4.3 Operating system: x86_64-redhat-linux-gnu Description:Queries performing slowly Details: Her

[BUGS] BUG #5492: Query performs slowly and sequence corrupted

2010-06-07 Thread Piergiorgio Buongiovanni
The following bug has been logged online: Bug reference: 5492 Logged by: Piergiorgio Buongiovanni Email address: piergiorgio.buongiova...@netspa.it PostgreSQL version: 8:4.3 Operating system: x86_64-redhat-linux-gnu Description:Query performs slowly and sequence corru

Re: [BUGS] BUG #5492: Query performs slowly and sequence corrupted

2010-06-07 Thread Greg Stark
On Mon, Jun 7, 2010 at 5:36 PM, Piergiorgio Buongiovanni wrote: > I reused the previous command to re-set the sequence value to the right one, > but I see that the START value is now 59100. I reused the previous command > another time and the START value is now 30440. > > I think this is a bug. I

Re: [BUGS] BUG #5491: Queries performing slowly

2010-06-07 Thread Craig Ringer
On 7/06/2010 11:34 PM, Piergiorgio Buongiovanni wrote: The following bug has been logged online: Bug reference: 5491 Logged by: Piergiorgio Buongiovanni Email address: piergiorgio.buongiova...@netspa.it PostgreSQL version: 8.4.3 Operating system: x86_64-redhat-linux-gnu Des