Re: function for setting/getting same timestamp during whole transaction - Mailing list pgsql-hackers

From Robert Haas
Subject Re: function for setting/getting same timestamp during whole transaction
Date
Msg-id CA+TgmoZf7YoHS24dVOCx6LHVTP1=2LJY=gd6Cf_=bT-XBLVBtg@mail.gmail.com
Whole thread Raw
In response to Re: function for setting/getting same timestamp during whole transaction  (Miroslav Šimulčík <simulcik.miro@gmail.com>)
Responses Re: function for setting/getting same timestamp during whole transaction
List pgsql-hackers
On Wed, Feb 6, 2013 at 7:26 AM, Miroslav Šimulčík
<simulcik.miro@gmail.com> wrote:
>> Alternately, you might be able to use a custom GUC from a rather smaller
>> PL/PgSQL function. At transaction start, issue:
>>
>>     set_config('myapp.trigger_time', '', 't');
>
>
> This is problem with using custom GUC - clearing variable at transaction
> start. Without clearing it's not sufficient solution (see my response to
> Pavel's mail).

I might be confused here, but I think the point is that if you pass
"true" as the third argument to set_config, the setting lasts only for
the duration of the current transaction, like SET LOCAL.  Which I
think solves your problem.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Alias hstore's ? to ~ so that it works with JDBC
Next
From: Phil Sorber
Date:
Subject: Re: [PATCH] pg_isready (was: [WIP] pg_ping utility)