From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Rob Nikander <rob.nikander@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: procedures and transactions
Date: Thu, 21 Feb 2019 20:30:54 +0100
Message-ID: <1beb45ef-5d8b-b97a-d6f0-02e336144fa2@2ndquadrant.com> (raw)
In-Reply-To: <CB279644-3C25-4C8D-BBA2-0142495AD97B@gmail.com>
References: <FB0D74E9-6CAE-4FDD-BAD6-8AA31169F363@gmail.com>
<CAKFQuwYdbkOv3HAGo=heMDQB9zs5_31mK2FR05sYVHXmq4u+Pg@mail.gmail.com>
<72DE4DF2-7013-4D03-AD28-426BFD1B78A0@gmail.com>
<6299b758-7851-0a6d-8bb6-8c2956d03c74@2ndquadrant.com>
<CB279644-3C25-4C8D-BBA2-0142495AD97B@gmail.com>
On 2019-02-20 17:45, Rob Nikander wrote:
>> On Feb 20, 2019, at 10:07 AM, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:
>>
>> You can run SET TRANSACTION ISOLATION LEVEL in a procedure.
>
> I tried that before but I get this error:
>
> create or replace procedure t_test(n integer)
> as $$
> begin
You need to commit or rollback the preceding transaction here. Yeah I
know it's a bit weird.
> set transaction isolation level serializable;
> raise notice 'current isolation level: %', (select current_setting('transaction_isolation'));
> raise notice 'current txid: %', (select txid_current());
> end;
> $$ language plpgsql;
>
> mydb=# call t_test(1);
> ERROR: SET TRANSACTION ISOLATION LEVEL must be called before any query
> CONTEXT: SQL statement "SET transaction isolation level serializable"
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, rob.nikander@gmail.com
Subject: Re: procedures and transactions
In-Reply-To: <1beb45ef-5d8b-b97a-d6f0-02e336144fa2@2ndquadrant.com>
References: <FB0D74E9-6CAE-4FDD-BAD6-8AA31169F363@gmail.com> <CAKFQuwYdbkOv3HAGo=heMDQB9zs5_31mK2FR05sYVHXmq4u+Pg@mail.gmail.com> <72DE4DF2-7013-4D03-AD28-426BFD1B78A0@gmail.com> <6299b758-7851-0a6d-8bb6-8c2956d03c74@2ndquadrant.com> <CB279644-3C25-4C8D-BBA2-0142495AD97B@gmail.com> <1beb45ef-5d8b-b97a-d6f0-02e336144fa2@2ndquadrant.com>
* 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