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/