Re: Return Value of a Function - Mailing list pgsql-general

From Tom Lane
Subject Re: Return Value of a Function
Date
Msg-id 10863.1075740127@sss.pgh.pa.us
Whole thread Raw
In response to Return Value of a Function  (Terry Lee Tucker <terry@esc1.com>)
Responses Re: Return Value of a Function  (Terry Lee Tucker <terry@esc1.com>)
Re: Return Value of a Function  (Joe Conway <mail@joeconway.com>)
List pgsql-general
Terry Lee Tucker <terry@esc1.com> writes:
> I need to return a row of data from a function. I've been looking the the HTML
> docs and have found nothing of value. If I try to return a variable of type
> RECORD, I get the following error:
> NOTICE:  plpgsql: ERROR during compile of last_log near line 0
> ERROR:  fmgr_info: function 0: cache lookup failed

What Postgres version are you running?  We used to have some bugs that
would allow unhelpful error messages like that to emerge in corner
cases.  I'm not completely sure that they're all gone.  If you're on
7.4.* I'd be interested to see exactly what you did.

> I may have several other things wrong with this function, so my real question
> is, "Can I return a value of type RECORD?"

If you know what you're doing.  The calling query has to specify a
structure for the record.

(Joe, I couldn't find a self-contained example using a function-returning-
record after a bit of searching in the 7.4 docs.  Surely there is one?)

            regards, tom lane

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: DB cache size strategies
Next
From: Tom Lane
Date:
Subject: Re: Return Value of a Function