Re: Having a problem with my stored procedure

From: Alan Hodgson <ahodgson(at)simkin(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Having a problem with my stored procedure
Date: 2007-02-13 19:45:52
Message-ID: 200702131145.53015@hal.simkin.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 13 February 2007 11:35, Laura McCord
<mccordl(at)southwestern(dot)edu> wrote:
> Here is a question that I am stumped on:
>
> Does postgres even recognize last_inserted() as mysql does? I notice
> that the function fails on that line.
>

Not, that's just a MySQL function. You could, however, look for the
last value of the sequence generator for the table's primary key, which
should be (but may not always be) equivalent.

However, you are doing far more work than necessary getting the
inserted/updated data; you can just access it through the OLD. and NEW.
records already provided to the trigger.

http://www.postgresql.org/docs/8.2/interactive/plpgsql-trigger.html

--
"If a nation expects to be ignorant and free, in a state of
civilization, it expects what never was and never will be." -- Thomas
Jefferson

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laura McCord 2007-02-13 19:51:01 Re: Having a problem with my stored procedure
Previous Message Dhaval Shah 2007-02-13 19:39:35 Using PITR for creating Hot Standby