Re: BUG #17706: ALTER TYPE leads to crash - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #17706: ALTER TYPE leads to crash
Date
Msg-id CAMbWs48eGK9YwbSprdwN4jWGeeC7xLLehb1ymFeZKFsTO9BmOg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #17706: ALTER TYPE leads to crash  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: BUG #17706: ALTER TYPE leads to crash
Re: BUG #17706: ALTER TYPE leads to crash
List pgsql-bugs

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

pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: BUG #17710: Slow queries (100% CPU) after auto-vacuum
Next
From: Richard Guo
Date:
Subject: Re: BUG #17713: Assert with postgres_fdw in v12