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

From Terry Lee Tucker
Subject Re: Return Value of a Function
Date
Msg-id 200402021431.10790.terry@esc1.com
Whole thread Raw
In response to Re: Return Value of a Function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
We will be upgrading soon. Thanks for all the great advice.

On Monday 02 February 2004 01:58 pm, Tom Lane wrote:
> Terry Lee Tucker <terry@esc1.com> writes:
> > My version is: 7.2.3-RH
> > Is this my problem?
>
> Probably.  I don't recall the exact state of play of functions returning
> rows in 7.2, but certainly Joe Conway has greatly improved it in the
> last couple of releases.  You should think about updating to 7.4.
>
> > 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.
>
> You could try declaring the function to return the specific rowtype of
> the log table, rather than the generic RECORD type.  I'm quite certain
> generic RECORD didn't do anything useful in 7.2.  But even then, the
> most useful way to call it (namely, a function call in SELECT's FROM
> clause) wasn't there in 7.2.
>
> Probably what you should do as long as you're on 7.2 is just have the
> function determine and return the primary key of the correct log table
> entry, and then SELECT using that key in the calling trigger functions.
>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
Quote: 27
"The GOP Congress seems...resigned to grit its collective teeth and
 swallow a massive Medicare prescription drug benefit. Deep down,
 Republican lawmakers surely lack the appetite for this fat-drenched
 legislative entree. Yet they look obligated to finish it, as if leaving
 their meal untouched would be impolite. Instead, they should send this
 pricey dish back to the kitchen and order a snack instead."

 --Deroy Murdock

 Work: 1-336-372-6812
 Cell: 1-336-363-4719
email: terry@esc1.com

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Select Question
Next
From: Jeff Eckermann
Date:
Subject: Re: Select Question