Re: Definition of return types for own functions?

From: Lexington Luthor <Lexington(dot)Luthor(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Definition of return types for own functions?
Date: 2006-09-28 18:00:16
Message-ID: efh2jn$hsa$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matthias(dot)Pitzl(at)izb(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joost Kraaijeveld 2006-09-28 18:09:28 Re: Strange query results with invalid multibyte
Previous Message Volker Hetzer 2006-09-28 17:33:51 Re: cyclical redundancy checksum algorithm(s)?