[HACKERS] plpgsql's case bug?

2010-03-27 Thread Jaime Casanova
Hi, I found something strange (at least for my limited view). in pl_exec.c:1549 in the function exec_stmt_case() we have this: /* SQL2003 mandates this error if there was no ELSE clause */ if (!stmt-have_else) ereport(ERROR, (errcode(ERRCODE_CASE_NOT_FOUND),

Re: [HACKERS] plpgsql's case bug?

2010-03-27 Thread Jaime Casanova
On Sat, Mar 27, 2010 at 10:08 PM, Jaime Casanova jcasa...@systemguards.com.ec wrote: Hi, [...] this is based on General Rules case 1 of chapter 13.6 (case statement) but i don't think that behaviour is the meaning of that Rule. Even if it is, the exception should be: case not found for case

Re: [HACKERS] plpgsql's case bug?

2010-03-27 Thread Robert Haas
On Sat, Mar 27, 2010 at 10:08 PM, Jaime Casanova jcasa...@systemguards.com.ec wrote: I found something strange (at least for my limited view). in pl_exec.c:1549 in the function exec_stmt_case() we have this:    /* SQL2003 mandates this error if there was no ELSE clause */    if

Re: [HACKERS] plpgsql's case bug?

2010-03-27 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Sat, Mar 27, 2010 at 10:08 PM, Jaime Casanova jcasa...@systemguards.com.ec wrote: this is based on General Rules case 1 of chapter 13.6 (case statement) but i don't think that behaviour is the meaning of that Rule. Even if it is, the exception

Re: [HACKERS] plpgsql's case bug?

2010-03-27 Thread Jaime Casanova
On Sun, Mar 28, 2010 at 12:38 AM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: It seems odd to require a dummy ELSE clause that does nothing just to avoid having an exception thrown, but I'm not sure what else to make of the quoted portion of the spec.  What do

Re: [HACKERS] plpgsql's case bug?

2010-03-27 Thread Tom Lane
Jaime Casanova jcasa...@systemguards.com.ec writes: well actually i get here when translating the plpgsql messages and found very strange a message like case not found, and as a last argument (a weak one, i have to admit) i will say that the hint could be innecesary if we use the same message

Re: [HACKERS] plpgsql's case bug?

2010-03-27 Thread Pavel Stehule
It seems odd to require a dummy ELSE clause that does nothing just to avoid having an exception thrown, but I'm not sure what else to make of the quoted portion of the spec.  What do you think it's saying? I thinking so it designed to be protected before processing CASE statement without any