pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Guo <guofenglinux@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: s.shinderuk@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17706: ALTER TYPE leads to crash
Date: Tue, 13 Dec 2022 10:58:30 +0800
Message-ID: <CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwa6NpZc2aQJkM0V=1FVQMR5C+nEeKLW_UCR=o4Ym7g4xg@mail.gmail.com>
References: <17706-fa10a46c1ac9ce5a@postgresql.org>
	<CAMbWs48beVBjLyjza3mCNzOT1qYAt9NcV=VMzeOMbCAVAXBLGg@mail.gmail.com>
	<CAKFQuwa6NpZc2aQJkM0V=1FVQMR5C+nEeKLW_UCR=o4Ym7g4xg@mail.gmail.com>

On Thu, Dec 8, 2022 at 1:01 PM David G. Johnston <david.g.johnston@gmail.com>
wrote:

> We don't need to fix this though (i.e., make the query continue to somehow
> work), we need to detect the situation and return some kind of error as
> opposed to crashing the server.  The transaction itself is doing something
> illegal and can be forced to abort.  Alternatively, maybe the ALTER TYPE
> command can emit the error that it is unable to alter the type as it is
> already in use by the current session.  But that would close off possible
> non-problematic uses of ALTER TYPE in this situation
>

Yeah, that makes sense.  If we create a table using type foo, the alter
operation would error out like that.

create table t (a foo);

alter type foo alter attribute b type text;
ERROR:  cannot alter type "foo" because column "t.a" uses it

Maybe we can likewise record the dependencies for the type if it's being
used in other more scenarios besides as a column in some table?

Thanks
Richard

view thread (6+ messages)  latest in thread

Message-ID: <CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com>
Permalink:  ../CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com/
Also on:    postgresql.org/message-id/CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com

 · 

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 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: guofenglinux@gmail.com, david.g.johnston@gmail.com, s.shinderuk@postgrespro.ru
  Subject: Re: BUG #17706: ALTER TYPE leads to crash
  In-Reply-To: <CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com>
  References: <17706-fa10a46c1ac9ce5a@postgresql.org> <CAMbWs48beVBjLyjza3mCNzOT1qYAt9NcV=VMzeOMbCAVAXBLGg@mail.gmail.com> <CAKFQuwa6NpZc2aQJkM0V=1FVQMR5C+nEeKLW_UCR=o4Ym7g4xg@mail.gmail.com> <CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com>

* 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