Re: plpgsql function returning SETOF

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: plpgsql function returning SETOF
Date: 2005-12-21 18:44:57
Message-ID: 20051221184457.GB2950@kaufbach.delug.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Johannes Brügmann <johannes(at)jottbee(dot)org> schrieb:
> I always had this in mind:
>
> ,----[ ${doc}/postgresql-8.0.3/html/xfunc-sql.html ]
> | 31.4.4. SQL Functions Returning Sets
> |
> | When an SQL function is declared as returning SETOF sometype, the
> | function's final SELECT query is executed to completion, and each row
> | it outputs is returned as an element of the result set.
> `----[ end ]

If you write the function in the language 'sql', then this is right.
But in your function there are things like 'if...', so you need plpgsql.

>
> But this is SQL isn't it, ;-)? And SQL doesn't support timestamp, does
> it? (AAaaarrggghhhh...)

???
timestamp and timestamptz are valid types in SQL.

> A new problem is now, that i still can't get it to work after all:
>
> CREATE TYPE feiertag AS (bezeichnung VARCHAR(100), datum TIMESTAMP WITH TIME ZONE);
>
> CREATE OR REPLACE FUNCTION feiertage(TIMESTAMP WITH TIME ZONE)
> ...
> END;
> $$ LANGUAGE plpgsql;
>
> Where is the bug now?

I can't see a error-message, sorry ;-)

Btw.: we have a german mailing list too ;-)

HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2005-12-21 18:50:44 Re: plpgsql function returning SETOF
Previous Message Johannes Brgmann 2005-12-21 18:28:43 Re: plpgsql function returning SETOF