Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4zF6-0000zI-OR for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Dec 2022 06:58:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p4zF5-0001LE-Hg for pgsql-bugs@arkaria.postgresql.org; Tue, 13 Dec 2022 06:58:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4zF5-0001Ky-4I for pgsql-bugs@lists.postgresql.org; Tue, 13 Dec 2022 06:58:19 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p4zF1-0005tU-Uf for pgsql-bugs@lists.postgresql.org; Tue, 13 Dec 2022 06:58:18 +0000 Received: from [192.168.31.120] (unknown [62.217.188.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id E263621C05D7; Tue, 13 Dec 2022 09:58:12 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1670914692; bh=udW79+QbHYznd+VCFsHHYRfjXhzfsgKCC1J0EIw7PgU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=dlDP2TddYY+1Akug+PmRMqY43fvNLGYXLe0EQDTkyb4T9X0Xt0sDIYwt0a+taipo7 1BkboxJ7NSxmYPSGzYWABZc3dAloXt0sjYnPZrd6zZytdddmzLiKNxWQZVTgeF/jJy QtEEDhTFbr4Zu1jPzm/65lU+yPP5WeCpt1Ev7BkE= Message-ID: <249fa239-3e30-6060-087d-394f36c498f6@postgrespro.ru> Date: Tue, 13 Dec 2022 09:58:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: BUG #17706: ALTER TYPE leads to crash To: Richard Guo , "David G. Johnston" Cc: pgsql-bugs@lists.postgresql.org References: <17706-fa10a46c1ac9ce5a@postgresql.org> Content-Language: en-US From: Sergey Shinderuk In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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/