Re: Autonomous Transaction is back

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: Autonomous Transaction is back
Date: 2015-09-03 20:21:55
Message-ID: CA+TgmoZc-Z7wtL6Zvs+1Q+PVF+PKwwQkcazm2pVtbRPFNitQFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 22, 2015 at 2:23 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
>> > Can you get away with only looking at tuples though? For example,
>> > what about advisory locks? Table locks?
>>
>> Well, that's an interesting question. Can we get away with regarding
>> those things as non-conflicting, as between the parent and child
>> transactions?
>
> For system lock types, no. While one could define advisory locks to work
> differently, we should assume that today's advisory lockers have expectations
> like those of system lockers. An autonomous transaction should not bypass any
> lock that a transaction of another backend could not bypass.

Why?

Suppose you do this:

BEGIN;
DECLARE CURSOR foo FOR SELECT * FROM foo;
BEGIN AUTONOMOUS TRANSACTION;
ALTER TABLE foo ALTER bar TYPE int;

This has got to fail for safety reasons, but CheckTableNotInUse() is
on it. Suppose you do this:

BEGIN;
LOCK foo;
BEGIN AUTONOMOUS TRANSACTION;
INSERT INTO foo VALUES ('spelunk');

How will making this fail improve anything?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-09-03 20:31:22 Re: strange test in psql:startup.c
Previous Message Alvaro Herrera 2015-09-03 20:21:14 Re: pg_ctl/pg_rewind tests vs. slow AIX buildfarm members