From: Michael Paquier <michael@paquier.xyz>
To: Bruce Momjian <bruce@momjian.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robins Tharakan <tharakan@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: ALTER TABLE ALTER COLUMN SET TYPE crash
Date: Wed, 26 Aug 2020 16:30:01 +0900
Message-ID: <20200826073001.GH2017@paquier.xyz> (raw)
In-Reply-To: <20200825173511.GA20679@momjian.us>
References: <CAEP4nAzwokLht2Bi3RCHNcCJBdOa8d7LnqJkDO1xiaH+biW8fw@mail.gmail.com>
<20200825060511.GF2017@paquier.xyz>
<20200825155544.GG32540@momjian.us>
<2745154.1598372060@sss.pgh.pa.us>
<20200825173511.GA20679@momjian.us>
On Tue, Aug 25, 2020 at 01:35:11PM -0400, Bruce Momjian wrote:
> On Tue, Aug 25, 2020 at 12:14:20PM -0400, Tom Lane wrote:
>> I think the nature of the problem (and Robins' other report too) is pretty
>> clear. We have a SQL or plpgsql function that's trying to access a table
>> that is inconsistent during an ALTER TABLE operation. The function would
>> be locked out from seeing that transient state if it were in another
>> session, thanks to normal locking rules; but the lock acquisition rules
>> don't prevent same-session accesses.
There are already some safeguards to prevent directly the use of
aggregates in USING, and here we have a function that itself calls an
aggregate on the table.
>> ALTER TABLE and related utility commands contain guards against the
>> reverse form of this problem: CheckTableNotInUse will bitch if there's
>> some already-active outer query referencing the table. But we haven't
>> thought about the possibility of one of these commands executing
>> user-defined code midway through.
Hmm. That's not an easy problem as this would need restrictions for
high-level commands directly in the executor.. And it is not like you
should restrict everything either.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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-bugs@postgresql.org
Cc: michael@paquier.xyz, bruce@momjian.us, tgl@sss.pgh.pa.us, tharakan@gmail.com
Subject: Re: ALTER TABLE ALTER COLUMN SET TYPE crash
In-Reply-To: <20200826073001.GH2017@paquier.xyz>
References: <CAEP4nAzwokLht2Bi3RCHNcCJBdOa8d7LnqJkDO1xiaH+biW8fw@mail.gmail.com> <20200825060511.GF2017@paquier.xyz> <20200825155544.GG32540@momjian.us> <2745154.1598372060@sss.pgh.pa.us> <20200825173511.GA20679@momjian.us> <20200826073001.GH2017@paquier.xyz>
* 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