pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Keyerror Smart <smartkeyerror@gmail.com>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17812: LOCK TABLE IN ACCESS EXCLUSIVE MODE with a view returns an empty tuple set
Date: Wed, 01 Mar 2023 01:53:22 -0500
Message-ID: <1328697.1677653602@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZTYxHmGvFyWBp3BQXmi7RBwRq8fkgLn+=sK+GOTdye_Q@mail.gmail.com>
References: <17812-206eaec1d133a94a@postgresql.org>
	<20230228135252.agaj42dik5qfjjxi@jrouhaud>
	<CAD=-kXaPVQtO3ivEY-Wvz4BkFCntnshPfcV2DCG7ujqwCNF3pA@mail.gmail.com>
	<20230301025229.rxmmjxfvg45w2cj4@jrouhaud>
	<CAD=-kXb1UUGqrHjVs47m6sS=tD0VQz3y=1y6d7nfTWYckNDrsw@mail.gmail.com>
	<CAKFQuwb5U84yZGRRiGsRtLm3D3_jtc=TtXE=7y-z0ORg+Jy1bQ@mail.gmail.com>
	<1311639.1677643997@sss.pgh.pa.us>
	<CAKFQuwZTYxHmGvFyWBp3BQXmi7RBwRq8fkgLn+=sK+GOTdye_Q@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Session 4:
> create table tbl2 as select * from view1;
> SELECT 0

> Why is it OK for session 4 to be different here?

Maybe it isn't.  The code flow for CREATE TABLE AS is a bit weird
IIRC, and maybe it's missing a step where we should update the
active snapshot.

> It is unclear to me whether you were instead talking about other sessions
> dropping tables as another way of saying "ACCESS EXCLUSIVE" in which case
> at what lock level should this anomaly go away, and does it?

The originally-proposed tests seemed to all involve either TRUNCATE
or DROP TABLE, which are outside what I consider to be our MVCC
guarantees.  Your example here does seem a bit strange though.
Views generally ought not have different semantics from writing
out the view query in-line.

			regards, tom lane





view thread (13+ messages)  latest in thread

Message-ID: <1328697.1677653602@sss.pgh.pa.us>
Permalink:  ../1328697.1677653602@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1328697.1677653602@sss.pgh.pa.us

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, smartkeyerror@gmail.com, rjuju123@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17812: LOCK TABLE IN ACCESS EXCLUSIVE MODE with a view returns an empty tuple set
  In-Reply-To: <1328697.1677653602@sss.pgh.pa.us>

* 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