Re: Custom SQL function does not like IF-statement - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: Custom SQL function does not like IF-statement
Date
Msg-id 20160926182607.4fjw2vx4oagu7wzh@depesz.com
Whole thread Raw
In response to Custom SQL function does not like IF-statement  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general
On Mon, Sep 26, 2016 at 08:22:11PM +0200, Alexander Farber wrote:
> ERROR:  syntax error at or near "IF"
> LINE 11:         IF LENGTH(TRIM(in_msg)) > 0 AND
>                  ^

of course it doesn't like it, because sql doesn't have "if" command.

If you want to use such syntax, you have to use plpgsql language for the
function.

Best regards,

depesz



pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Incrementally refreshed materialized view
Next
From: Pavel Stehule
Date:
Subject: Re: Custom SQL function does not like IF-statement