Re: [HACKERS] Possible bug in CASE evaluation

2013-06-26 Thread Noah Misch
On Mon, Jun 24, 2013 at 01:41:51PM +, Albe Laurenz wrote: > Noah Misch wrote: > >> If fixing the behaviour is undesirable, at least the documentation > >> should be fixed. > > > > A brief documentation mention sounds fine. Perhaps add a paragraph on > > constant folding in general and referen

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-25 Thread Tom Lane
Andres Freund writes: > But I guess given the objections on performance the combined approach is > the way to go? I think the documentation approach is the way to go. It was pointed out in the pgsql-general thread about this that a naive user might expect that, say, syntax or datatype violations

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-25 Thread Andres Freund
Hi Noah, On 2013-06-25 19:05:15 -0400, Noah Misch wrote: > On Tue, Jun 25, 2013 at 03:01:52PM +0200, Andres Freund wrote: > > On 2013-06-24 21:35:53 -0400, Noah Misch wrote: > > > Simple enough, yes. The other point still stands. > > > > You mean performance? Primarily I still think we should fi

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-25 Thread Noah Misch
On Tue, Jun 25, 2013 at 03:01:52PM +0200, Andres Freund wrote: > On 2013-06-24 21:35:53 -0400, Noah Misch wrote: > > Simple enough, yes. The other point still stands. > > You mean performance? Primarily I still think we should first worry > about correctness first and then about performance. And

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-25 Thread Pavel Stehule
2013/6/25 Andres Freund : > On 2013-06-24 21:35:53 -0400, Noah Misch wrote: >> On Sat, Jun 22, 2013 at 04:54:50PM +0200, Andres Freund wrote: >> > On 2013-06-21 16:45:28 +0200, Andres Freund wrote: >> > > On 2013-06-21 09:51:05 -0400, Noah Misch wrote: >> > > > That being said, if we discover a sim

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-25 Thread Andres Freund
On 2013-06-24 21:35:53 -0400, Noah Misch wrote: > On Sat, Jun 22, 2013 at 04:54:50PM +0200, Andres Freund wrote: > > On 2013-06-21 16:45:28 +0200, Andres Freund wrote: > > > On 2013-06-21 09:51:05 -0400, Noah Misch wrote: > > > > That being said, if we discover a simple-enough fix that performs wel

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-24 Thread Noah Misch
On Sat, Jun 22, 2013 at 04:54:50PM +0200, Andres Freund wrote: > On 2013-06-21 16:45:28 +0200, Andres Freund wrote: > > On 2013-06-21 09:51:05 -0400, Noah Misch wrote: > > > That being said, if we discover a simple-enough fix that performs well, > > > we may > > > as well incorporate it. > > > >

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-24 Thread Albe Laurenz
Noah Misch wrote: >> If fixing the behaviour is undesirable, at least the documentation >> should be fixed. > > A brief documentation mention sounds fine. Perhaps add a paragraph on > constant folding in general and reference that from the CASE page. How about the attached? Yours, Laurenz Albe

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-22 Thread Andres Freund
On 2013-06-21 16:45:28 +0200, Andres Freund wrote: > On 2013-06-21 09:51:05 -0400, Noah Misch wrote: > > That being said, if we discover a simple-enough fix that performs well, we > > may > > as well incorporate it. > > What about passing another parameter down eval_const_expressions_mutator > (w

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Noah Misch
On Fri, Jun 21, 2013 at 04:12:32PM +0200, Andres Freund wrote: > On 2013-06-21 09:51:05 -0400, Noah Misch wrote: > > On Fri, Jun 21, 2013 at 09:20:21AM +, Albe Laurenz wrote: > > Even if you could skip it, queries with expensive > > constant expressions would notice the performance loss. The

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Pavel Stehule
2013/6/21 Andres Freund : > On 2013-06-21 09:51:05 -0400, Noah Misch wrote: >> On Fri, Jun 21, 2013 at 09:20:21AM +, Albe Laurenz wrote: >> > Andres Freund wrote: >> > > Yes, I think it's pretty clearly a bug - Tom doesn't seem think so >> > > though. If we can agree it is, the fix outlined ove

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Andres Freund
On 2013-06-21 09:51:05 -0400, Noah Misch wrote: > That being said, if we discover a simple-enough fix that performs well, we may > as well incorporate it. What about passing another parameter down eval_const_expressions_mutator (which is static, so changing the API isn't a problem) that basically

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Andres Freund
On 2013-06-21 09:51:05 -0400, Noah Misch wrote: > On Fri, Jun 21, 2013 at 09:20:21AM +, Albe Laurenz wrote: > > Andres Freund wrote: > > > Yes, I think it's pretty clearly a bug - Tom doesn't seem think so > > > though. If we can agree it is, the fix outlined over on -bugs seems to > > > be eas

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Noah Misch
On Fri, Jun 21, 2013 at 09:20:21AM +, Albe Laurenz wrote: > Andres Freund wrote: > > Yes, I think it's pretty clearly a bug - Tom doesn't seem think so > > though. If we can agree it is, the fix outlined over on -bugs seems to > > be easily enough implemented... If you refer to this: On Tue,

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Pavel Stehule
2013/6/21 Andres Freund : > Hi, > > > On 2013-06-21 08:16:22 +, Albe Laurenz wrote: >> I want to draw attention to this thread on -general: >> camq5dgq4sujpbht2-9xlapasvknul2-bb0cpyci2fp+pfsf...@mail.gmail.com > > There's also a bug reported for it: > #8237: e1uovmc-0007ft...@wrigleys.postgresq

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Albe Laurenz
Andres Freund wrote: > On 2013-06-21 08:16:22 +, Albe Laurenz wrote: > > I want to draw attention to this thread on -general: > > camq5dgq4sujpbht2-9xlapasvknul2-bb0cpyci2fp+pfsf...@mail.gmail.com > > There's also a bug reported for it: > #8237: e1uovmc-0007ft...@wrigleys.postgresql.org > > >

Re: [HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Andres Freund
Hi, On 2013-06-21 08:16:22 +, Albe Laurenz wrote: > I want to draw attention to this thread on -general: > camq5dgq4sujpbht2-9xlapasvknul2-bb0cpyci2fp+pfsf...@mail.gmail.com There's also a bug reported for it: #8237: e1uovmc-0007ft...@wrigleys.postgresql.org > Would you concur that this is

[HACKERS] Possible bug in CASE evaluation

2013-06-21 Thread Albe Laurenz
I want to draw attention to this thread on -general: camq5dgq4sujpbht2-9xlapasvknul2-bb0cpyci2fp+pfsf...@mail.gmail.com Would you concur that this is a bug? The fine manual says about CASE: If the condition's result is true, the value of the CASE expression is the result that follows the con