From: sad <sad@bankir.ru>
To: pgsql-sql@postgresql.org
Subject: Re: [BUGS] session variable
Date: Tue, 2 Sep 2003 17:13:24 +0400
Message-ID: <200309021713.24846.sad@bankir.ru> (raw)
In-Reply-To: <3F548FD0.5070600@pse-consulting.de>
References: <200309011657.h81Gva817128@candle.pha.pa.us>
<200309021629.26156.sad@bankir.ru>
<3F548FD0.5070600@pse-consulting.de>
On Tuesday 02 September 2003 16:40, you wrote:
> No problem to use a temp table in a trigger (which is local to the
> session), I do so myself. Still, session variables would be nice, making
> coding a little bit more comfortable.
(it would be very good if you implement session variables in PostgreSQL.)
The first problem using temp table is:
CREATE TABLE locals (name text, value text);
CREATE OR REPLACE FUNCTION test_locals_access() RETURNS text AS '
DECLARE i text;
BEGIN
SELECT value INTO i FROM locals WHERE name=''n1''
RETURN i;
END;
' LANGUAGE 'plpgsql';
SELECT test_locals_access() ;
column
-------------
<null>
CREATE TEMP TABLE locals (name text, value text);
INSERT INTO locals VALUES ('n1','xxx');
SELECT test_locals_access() ;
column
-------------
<null> <=== the Function seing global table
SELECT value FROM locals WHERE name='n1';
value
---------
xxx
the second problem may be resolved with your advise.
look:
i want to log operations on the data in some tables.
so i declared sufficient triggers which write to the log-table.
and now i want to mark each log-record with the "operator_id"
(e.g. to log who made an update)
what possible ways are there ?
if i use temp table to inform the triggers about "operator_id"
then i have problems in manual updates of these tables
(temp table in my session needed too)
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: sad@bankir.ru
Subject: Re: [BUGS] session variable
In-Reply-To: <200309021713.24846.sad@bankir.ru>
* 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