Generating History

From: "Rod Taylor" <rod(dot)taylor(at)inquent(dot)com>
To: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Generating History
Date: 2001-01-22 19:53:50
Message-ID: 02a101c084ad$0a8ff8b0$6500000a@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is there any easy method for getting a hold of the OID and XID for a
given row within a plpgsql (or another type) of function?

Statements like NEW.oid appear to fail, and xid isn't to be found.
I'd like to use these to create the history of an application which
can be rolled back (by the application) which is stored in another
table for easy stats generation.

The reason for having the database do the work is that we want to keep
the actions of the DBA's available to our clients to scrutinize,
otherwise the wrappers could do the extra required dirty work to
accomplish this.

Is there an easier way of doing this? Since there's no environment
variable type entity (variables common for an entire transaction) I
was wondering if a cursor can flow between multiple functions?
Each function uses FETCH -1 FROM transaction_id; to get information.
Passing the transaction_id as a parameter isn't really an option as
most of the functions() would be run via automated triggers.

BEGIN WORK;
DECLARE transaction_id CURSOR FOR SELECT 8329;
FETCH 1 FROM transaction_id;

select function1();
select function2();
select function3();

CLOSE transaction_id;
COMMIT WORK;

Thanks for your help in advance.

--
Rod Taylor

There are always four sides to every story: your side, their side, the
truth, and what really happened.

Attachment Content-Type Size
Taylor, Rod B.vcf text/x-vcard 451 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Emmanuel Charpentier 2001-01-22 20:18:34 Re: Re: MySQL and BerkleyDB (fwd)
Previous Message Dan Lyke 2001-01-22 18:50:32 'enum' equivalent?