From: Rob Nikander <rob.nikander@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: procedures and transactions
Date: Wed, 20 Feb 2019 10:45:59 -0600
Message-ID: <CB279644-3C25-4C8D-BBA2-0142495AD97B@gmail.com> (raw)
In-Reply-To: <6299b758-7851-0a6d-8bb6-8c2956d03c74@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>
> 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
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"
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: rob.nikander@gmail.com
Subject: Re: procedures and transactions
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>
* 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