pg.ddx.io pgsql-interfaces@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Premil Agarwal <preagarw@gmail.com>
To: Alvaro Herrera <alvherre@commandprompt.com>
Cc: pgsql-interfaces@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: Function's final statement must be a SELECT
Date: Wed, 14 May 2008 16:47:55 -0400
Message-ID: <92aa956e0805141347w2b6f803bq4540c8aa910915e0@mail.gmail.com> (raw)
In-Reply-To: <20080514203621.GI9838@alvh.no-ip.org>
References: <92aa956e0805141323y3c14fe2p4e10ba9c67637c49@mail.gmail.com>
<20080514203621.GI9838@alvh.no-ip.org>
Great !!! COALESCE() does the job for me.
( BTW, replacing "SQL" by "PLPGSQL " still gets the same error ..... )
Thanks a lot Alvaro !!!
On Wed, May 14, 2008 at 4:36 PM, Alvaro Herrera <alvherre@commandprompt.com>
wrote:
> Premil Agarwal escribió:
> > I am trying to write a function in PgAdmin 1.8.2 for postgres 8.3. The
> > function should check the input parameter for NULL. If its NULL then
> > function should return 'Auto' otherwise return the input as such.
>
> >
> > CREATE FUNCTION check_for_null( inp character varying) RETURNS character
> > varying AS $$
> [...]
> > $$ LANGUAGE SQL;
>
> ^^^
>
> There's your problem. Try using PLPGSQL instead.
>
> In any case, you can do this with COALESCE() and it's much easier.
>
> --
> Alvaro Herrera
> http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>
view thread (6+ messages) latest in thread
Message-ID: <92aa956e0805141347w2b6f803bq4540c8aa910915e0@mail.gmail.com> Permalink: ../92aa956e0805141347w2b6f803bq4540c8aa910915e0@mail.gmail.com/ Also on: postgresql.org/message-id/92aa956e0805141347w2b6f803bq4540c8aa910915e0@mail.gmail.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-interfaces@postgresql.org Cc: preagarw@gmail.com, alvherre@commandprompt.com, pgsql-admin@postgresql.org Subject: Re: Function's final statement must be a SELECT In-Reply-To: <92aa956e0805141347w2b6f803bq4540c8aa910915e0@mail.gmail.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox