Re: Definition of return types for own functions? - Mailing list pgsql-general

From Lexington Luthor
Subject Re: Definition of return types for own functions?
Date
Msg-id efh2jn$hsa$1@sea.gmane.org
Whole thread Raw
In response to Definition of return types for own functions?  (Matthias.Pitzl@izb.de)
List pgsql-general
Matthias.Pitzl@izb.de wrote:
> Is it possible to define a complex return type like a record in a function
> without having some table around with the needed structure of the return
> values?

Sure, you just have to specify the columns at select time instead (and
this is easy enough to wrap inside a view).

CREATE FUNCTION foo(TEXT) RETURNS SETOF RECORD AS '...' LANGUAGE 'plpgsql' ;

SELECT * FROM foo('bar') AS x(a,b,c,d) ;


Regards,
LL

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dead Lock problem with 8.1.3
Next
From: Joost Kraaijeveld
Date:
Subject: Re: Strange query results with invalid multibyte