pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Premil Agarwal <preagarw@gmail.com>
To: Dave Page <dpage@pgadmin.org>
Cc: pgsql-interfaces@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: [INTERFACES] Function's final statement must be a SELECT
Date: Wed, 14 May 2008 16:38:31 -0400
Message-ID: <92aa956e0805141338p1a496ecdje36e03d8805e5f51@mail.gmail.com> (raw)
In-Reply-To: <937d27e10805141336l601c4aa2x8972c2bd7fda07e6@mail.gmail.com>
References: <92aa956e0805141323y3c14fe2p4e10ba9c67637c49@mail.gmail.com>
	<937d27e10805141336l601c4aa2x8972c2bd7fda07e6@mail.gmail.com>

Tried that already, still the same error




On Wed, May 14, 2008 at 4:36 PM, Dave Page <dpage@pgadmin.org> wrote:

> On Wed, May 14, 2008 at 9:23 PM, Premil Agarwal <preagarw@gmail.com>
> wrote:
> > 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 $$
> >     DECLARE
> >         temp1 character varying := 'Auto';
> >         temp2 character varying := inp;
> >     BEGIN
> >
> >         IF temp2 IS NOT NULL THEN
> >         temp1 := temp2;
> >         END IF;
> >
> >         RETURN temp1;
> >     END;
> > $$ LANGUAGE SQL;
> >
> > When I hit 'OK' in create function window, I get following error :-
> >
> > ERROR: return type mismatch in function declared to return character
> varying
> > DETAIL: Function's final statement must be a SELECT.
> > CONTEXT: SQL function "check_for_null"
> >
> > Any suggestions why this happens ??
>
> Choose pl/pgsql as the language, not SQL.
>
> --
> Dave Page
> EnterpriseDB UK: http://www.enterprisedb.com
>

view thread (6+ messages)  latest in thread

Message-ID: <92aa956e0805141338p1a496ecdje36e03d8805e5f51@mail.gmail.com>
Permalink:  ../92aa956e0805141338p1a496ecdje36e03d8805e5f51@mail.gmail.com/
Also on:    postgresql.org/message-id/92aa956e0805141338p1a496ecdje36e03d8805e5f51@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: preagarw@gmail.com, dpage@pgadmin.org, pgsql-interfaces@postgresql.org
  Subject: Re: [INTERFACES] Function's final statement must be a SELECT
  In-Reply-To: <92aa956e0805141338p1a496ecdje36e03d8805e5f51@mail.gmail.com>
  References: <92aa956e0805141323y3c14fe2p4e10ba9c67637c49@mail.gmail.com> <937d27e10805141336l601c4aa2x8972c2bd7fda07e6@mail.gmail.com> <92aa956e0805141338p1a496ecdje36e03d8805e5f51@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