Re: [BUGS] session variable

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: sad <sad(at)bankir(dot)ru>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [BUGS] session variable
Date: 2003-09-03 17:40:58
Message-ID: Pine.LNX.4.44.0309031940040.1035-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

sad writes:

> 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

This is a problem in plpgsql, not in temporary tables.

> 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)

Use session_user, or restrict permissions on the temporary table.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2003-09-03 17:55:03 Re: session variable
Previous Message Karel Zak 2003-09-03 16:51:47 7.3: [BUGS] to_timestamp not stable if date string shorter than

Browse pgsql-sql by date

  From Date Subject
Next Message Antony Gubert 2003-09-03 17:46:10 unsubscribe
Previous Message Tomasz Myrta 2003-09-03 08:51:52 Re: Like phrase