Re: BUG #14691: Isolation failure in deferrable transaction concurrent with schema change

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: cpacejo(at)clearskydata(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14691: Isolation failure in deferrable transaction concurrent with schema change
Date: 2017-07-17 17:08:38
Message-ID: CAKFQuwZayi_XSjgR+xoB+Sogv51fYrV5vghgwxVTkbY15nS_Tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jun 5, 2017 at 12:11 PM, <cpacejo(at)clearskydata(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 14691
> Logged by: Chris Pacejo
> Email address: cpacejo(at)clearskydata(dot)com
> PostgreSQL version: 9.5.7
> Operating system: CentOS 7
> Description:
>
> Hi, issuing a SERIALIZABLE DEFERRABLE READ ONLY read from a table to which
> a
> column is being added results in an isolation failure.
>

> me=> BEGIN; ALTER TABLE foo ADD COLUMN y integer DEFAULT 0;
>

> me=> BEGIN; ALTER TABLE foo ADD COLUMN y integer; UPDATE foo SET y = 0;
>

> x | y
> ---+---
> 1 |
> 2 |
> 3 |
> (3 rows)
>

​This is a documented limitation.

​https://www.postgresql.org/docs/9.5/static/mvcc-caveats.html

"Some DDL commands, currently only TRUNCATE and the table-rewriting forms
of ALTER TABLE, are not MVCC-safe."

The first command is "table-rewriting".

The second ALTER TABLE doesn't rewrite the table but does change its
structure - so you get rows but the newly added column is null. This would
seem to be a reasonable behavior.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2017-07-17 19:35:48 Re: BUG #14691: Isolation failure in deferrable transaction concurrent with schema change
Previous Message Chris Pacejo 2017-07-17 15:56:39 Re: BUG #14691: Isolation failure in deferrable transaction concurrent with schema change