Re: plpgsql function returning SETOF - Mailing list pgsql-novice

From Andreas Kretschmer
Subject Re: plpgsql function returning SETOF
Date
Msg-id 20051221184457.GB2950@kaufbach.delug.de
Whole thread Raw
In response to Re: plpgsql function returning SETOF  ("Johannes Brügmann" <johannes@jottbee.org>)
Responses Re: plpgsql function returning SETOF
List pgsql-novice
Johannes Brügmann <johannes@jottbee.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°

pgsql-novice by date:

Previous
From: "Johannes Brügmann"
Date:
Subject: Re: plpgsql function returning SETOF
Next
From: Tom Lane
Date:
Subject: Re: plpgsql function returning SETOF