Re: [SQL] plPGSQL bug in function creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: newsy(at)lewczuk(dot)com
Cc: "Lista dyskusyjna pgsql-general" <pgsql-general(at)postgresql(dot)org>, "Lista dyskusyjna pgsql-sql" <pgsql-sql(at)postgresql(dot)org>, "Lista dyskusyjna pgsql-bugs" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: [SQL] plPGSQL bug in function creation
Date: 2003-09-08 14:19:43
Message-ID: 10945.1063030783@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general pgsql-sql

"Marek Lewczuk" <newsy(at)lewczuk(dot)com> writes:
> CREATE FUNCTION "public"."test" (text, text) RETURNS text AS'
> BEGIN
> IF $1 THEN
> RETURN $1;
> ELSE
> RETURN $2;
> END IF;
> END;
> 'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

If there's a bug here at all, it's that this function doesn't report a
type violation. What in the world do you think the semantics of that
IF-test are? text is not boolean.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-09-08 14:43:35 Re: heap_mark4update: (am)invalid tid
Previous Message Dennis Gearon 2003-09-08 14:15:23 Re: [GENERAL] plPGSQL bug in function creation

Browse pgsql-general by date

  From Date Subject
Next Message Franco Bruno Borghesi 2003-09-08 14:21:39 SRF question
Previous Message Dennis Gearon 2003-09-08 14:15:23 Re: [GENERAL] plPGSQL bug in function creation

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-09-08 15:40:32 plpgsql doesn't coerce boolean expressions to boolean
Previous Message Dennis Gearon 2003-09-08 14:15:23 Re: [GENERAL] plPGSQL bug in function creation