how to return 0 rows in function

From: Tomas Macek <macek(at)fortech(dot)cz>
To: pgsql-general(at)postgresql(dot)org
Subject: how to return 0 rows in function
Date: 2007-05-18 08:20:41
Message-ID: alpine.LFD.0.99.0705181020080.12374@maca.fortech.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, I have simplified function like this:

----------------
CREATE OR REPLACE FUNCTION f(varchar) RETURNS varchar AS $FUNC$
DECLARE
addr ALIAS FOR $1;
BEGIN
-- return NULL;
-- return '';
END
$FUNC$ LANGUAGE 'plpgsql';
-----------------

This function is returning varchar and it always returns at least one row. How
can I make it to return 0 rows? Is it possible or not and how?
Returning NULL does not help (return NULL string in 1 row). Not to return a
value leads to error output.

Many thanks for help

Tomas

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas 2007-05-18 08:42:22 Re: Admin-Functions in Ubuntu's PG 8.2 missing?
Previous Message Tomas Macek 2007-05-18 08:10:47