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 19:31:10
Message-ID: 200402021431.10790.terry@esc1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)esc1(dot)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(at)postgresql(dot)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(at)esc1(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Eckermann 2004-02-02 19:38:42 Re: Select Question
Previous Message Martijn van Oosterhout 2004-02-02 19:06:38 Re: Select Question