Re: Isolation level in a function

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: bgolda <e9syuk002(at)sneakemail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Isolation level in a function
Date: 2006-01-24 10:22:58
Message-ID: 20060124102258.GA18870@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 19, 2006 at 02:05:41 -0800,
bgolda <e9syuk002(at)sneakemail(dot)com> wrote:
> Hello, this is my first post, please don't shoot...
>
> I was just experimenting with transactions (PG 8.1), and there is
> something which puzzles me. If i write 'SET TRANSACTION ISOLATION LEVEL
> SERIALIZABLE;' in my function, it breaks. Error informs me, that it was
> executed after some query, while it is a first command in the function
> after declares and begin!

Because there is already a transaction which the function is executing in
and for which a query has been started (e.g. the one that calls the function).

> However, it seems to work perfectly well if I change in the same place
> the system variable, responsible for the transaction level. I used
> set_config, if I remember well. The function is only for a DBA task, so
> it seems to be all right to use set_config, isn't it?
>
> And my questions are:
> 1) Why in the first case it is not possible? Is it an error or am I
> just doing something wrong? Should have set something before?
> 2) Are there any downsides of the mentioned solution (changing
> transaction_isolation value), except of the fact that it is an
> administration command and should not be used :)?
>
> Thanks,
>
> _-_-_-_
> Bart Golda
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

In response to

Browse pgsql-general by date

  From Date Subject
Next Message FERREIRA, William (VALTECH) 2006-01-24 10:33:56 execution plan : Oracle vs PostgreSQL
Previous Message Bruno Wolff III 2006-01-24 09:57:44 Re: Surrogate keys (Was: enums)