Re: Return Value of a Function

From: Terry Lee Tucker <terry(at)esc1(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Return Value of a Function
Date: 2004-02-02 16:53:39
Message-ID: 200402021153.39334.terry@esc1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom,

My version is: 7.2.3-RH

Is this my problem? The example you mention would be great to see if it can be
located. I'm trying to write a function that will return the last record in a
sequence of logs, "last" being defined by an ORDER BY statement containing
time stamp criteria in conjuction with other data. The function would always
be called by trigger code.

Thanks...

On Monday 02 February 2004 11:42 am, Tom Lane wrote:
> Terry Lee Tucker <terry(at)esc1(dot)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

--

Work: 1-336-372-6812
Cell: 1-336-363-4719
email: terry(at)esc1(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-02-02 16:58:09 Re: Return Value of a Function
Previous Message Tom Lane 2004-02-02 16:42:07 Re: Return Value of a Function