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

From Sergey Shinderuk
Subject Re: BUG #17706: ALTER TYPE leads to crash
Date
Msg-id 249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru
Whole thread Raw
In response to Re: BUG #17706: ALTER TYPE leads to crash  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-bugs
On 13.12.2022 05:58, Richard Guo wrote:
> 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?


Just in case, ALTER TABLE can also trigger the crash:

create table t (a int, b int);

create function f() returns t as $$
declare
    r t = (1, 2^30);
begin
    alter table t alter b type text;
    return r;
end;
$$ language plpgsql;

postgres=# select f();
server closed the connection unexpectedly


-- 
Sergey Shinderuk        https://postgrespro.com/




pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #17706: ALTER TYPE leads to crash
Next
From: PG Bug reporting form
Date:
Subject: BUG #17716: walsender process hang while decoding 'DROP PUBLICATION' XLOG