pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
To: Richard Guo <guofenglinux@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17706: ALTER TYPE leads to crash
Date: Tue, 13 Dec 2022 09:58:12 +0300
Message-ID: <249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru> (raw)
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>

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/






view thread (6+ messages)

Message-ID: <249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru>
Permalink:  ../249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru/
Also on:    postgresql.org/message-id/249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: s.shinderuk@postgrespro.ru, guofenglinux@gmail.com, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17706: ALTER TYPE leads to crash
  In-Reply-To: <249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru>

* 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