Re: plPGSQL bug in function creation - Mailing list pgsql-sql

From Tom Lane
Subject Re: plPGSQL bug in function creation
Date
Msg-id 10945.1063030783@sss.pgh.pa.us
Whole thread Raw
In response to plPGSQL bug in function creation  ("Marek Lewczuk" <newsy@lewczuk.com>)
List pgsql-sql
"Marek Lewczuk" <newsy@lewczuk.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

pgsql-sql by date:

Previous
From: Rod Taylor
Date:
Subject: Re: MINUS & ROWNUM in PostGres
Next
From: Tom Lane
Date:
Subject: plpgsql doesn't coerce boolean expressions to boolean