pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Milen A. Radev <milen@radev.net>
To: pgsql-sql@postgresql.org
Subject: Re: PL/pgSQL question
Date: Thu, 14 Feb 2008 15:50:13 +0200
Message-ID: <fp1guu$6co$1@ger.gmane.org> (raw)
In-Reply-To: <99b656cb0802140523o165f69ebtcb4a42307c085f18@mail.gmail.com>
References: <99b656cb0802140523o165f69ebtcb4a42307c085f18@mail.gmail.com>

Sebastian Ritter написа:
> Hi all,
> 
> I have a question regarding functions.  How can I return zero rows from a
> function whose return type is a table row?  I did the following test and it
> did not work as expected:
[...]


CREATE OR REPLACE FUNCTION foobar(boolean) RETURNS SETOF x AS $_$
DECLARE
     res x%ROWTYPE;
BEGIN

     if $1 THEN
         RETURN NEXT res;
     ELSE
         RETURN;
     END IF;
END;$_$

LANGUAGE plpgsql;



-- 
Milen A. Radev




view thread (15+ messages)

Message-ID: <fp1guu$6co$1@ger.gmane.org>
Permalink:  ../fp1guu$6co$1@ger.gmane.org/
Also on:    postgresql.org/message-id/fp1guu$6co$1@ger.gmane.org

 · 

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-sql@postgresql.org
  Cc: milen@radev.net
  Subject: Re: PL/pgSQL question
  In-Reply-To: <fp1guu$6co$1@ger.gmane.org>

* 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