Transaction-specific global variable

From: Florian Weimer <fweimer(at)bfk(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Transaction-specific global variable
Date: 2011-02-03 09:10:19
Message-ID: 82zkqdscuc.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hstore greatly simplifies creating triggers for logging table changes,
which is great. However, when creating a log record, I would like to
include information about the party who made this change. We
generally do not allow direct database access for application code, so
the PostgreSQL user does not provide sufficient information on its
own. Instead, I'd like to create a transaction-specific variable
which stores context information to be included in the log table. I
suppose I could create a stored procedures in C which provides this
functionality, but I wonder if there is already something similar I
could reuse. For instance, I could reuse the application_name
configuration variable, but this seems a bit gross.

(If you could recommend logging functionality I could learn from, that
would be welcome, too.)

--
Florian Weimer <fweimer(at)bfk(dot)de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sabin Coanda 2011-02-03 10:52:57 out of shared memory - find temporary tables
Previous Message creationw 2011-02-02 22:21:43 How to workaround DROP CONSTRAINT [ IF EXISTS ] in Postgres version 8.1?