From: Vladimir Vukicevic <vladimir@ximian.com>
To: pgsql-sql@postgresql.org
Subject: getting OID from PL/PgSQL AFTER trigger
Date: Fri, 05 Oct 2001 07:06:45 -0400
Message-ID: <E15pSoX-00043B-00@rain> (raw)
Howdy,
I'm trying to get the OID of the NEW/OLD rows in an AFTER trigger
implemented in PL/PgSQL. Unfortunately, those end up as records in
the trigger, and I can't just use NEW.oid. Is there any way to do
this? I could do it using a trigger written in C, but I'd rather not
have to carry around a C .so just for this.
Note that I effectively have no knowledge of the format of the record
that's passed in new/old, so I can't either add a sequence or use some
already existing primary key to identify the row uniquely. One quick
hack is to "INSERT INTO dummy VALUES (NULL);" and then GET DIAGNOSTICS
z = RESULT_OID; and then use z - 1, but that will get me into lots of
trouble with multiple cilents accessing the database. :-)
For the time being, I'm going to implement the trigger in C, but I'm
open to suggestions on how to implement this in straight PL/PgSQL.
Thanks in advance,
- Vlad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: vladimir@ximian.com
Subject: Re: getting OID from PL/PgSQL AFTER trigger
In-Reply-To: <E15pSoX-00043B-00@rain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox