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 1nUYy8-0002O3-3c for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Mar 2022 19:06:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nUYy6-0002Ct-RN for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Mar 2022 19:05:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUYy6-0002Ce-IR for pgsql-bugs@lists.postgresql.org; Wed, 16 Mar 2022 19:05:58 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUYy1-0000ud-DR for pgsql-bugs@lists.postgresql.org; Wed, 16 Mar 2022 19:05:57 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 82BEA3202046; Wed, 16 Mar 2022 15:05:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 16 Mar 2022 15:05:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=ScqAijbwvADNI6Q4kv7XC5JPvu1oTgv29kbvm6u9/ ds=; b=TfTMJqhsC7wY8gSr9HvLP3L8zf/xE2yUuNmM6YK+x0ZUuT/cgXgvlDn3k Ba5EkPmo/cJ7BwJo+PgtkfLXRfbsZgA+jazhSdUTSzHql3ieoz6ZLNEse24/ypNt ww4+4jA6yvm+SNfLtsCBgV6kl6N2zwlmiuEuxoXeP+HmkQJyOu5JUXcBLTyChIIt 7thng7CkLTqyVPzRu1agn+i3h7fNP/fV5de3AeLzAqXfOSRSZmkTU+G6I2rIUg50 9tusPyFHNYbFpFmj/F1x28CHHc2aL5vRH+GhXw3QDHr4ZcnBr8yxxkssiWp1j+g/ ucNZZZtcmL9DI42Sx6lGZZZTr9b6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudefvddguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ejredttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgv rhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomheqnecuggftrf grthhtvghrnhepfeejgeehteeuhfevveduleeufedtjeetiefftedvudfhtdeifefgueet tdevgefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epphgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Mar 2022 15:05:48 -0400 (EDT) Message-ID: <1a0a5a4c-5ab0-3e84-9d1b-9e0ed650b729@enterprisedb.com> Date: Wed, 16 Mar 2022 20:05:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE Content-Language: en-US To: Tom Lane Cc: kmanh999@gmail.com, pgsql-bugs@lists.postgresql.org References: <17439-7df4421197e928f0@postgresql.org> <339142.1647369200@sss.pgh.pa.us> <412466.1647374777@sss.pgh.pa.us> From: Peter Eisentraut In-Reply-To: <412466.1647374777@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 15.03.22 21:06, Tom Lane wrote: > I looked into SQL:2021, and AFAICS the existing behavior is flat wrong, > even for cross references to other table columns. I think you read > 11.23 general rule 3, which seems to say to > unconditionally drop any generated column depending on the target column > ... but you missed syntax rule 7f, which says > > 7) If RESTRICT is specified, then C shall not be referenced in any of the > following: > ... > f) The generation expression of any column descriptor. > > GR3 would be very strange if read in isolation anyway, because it > says to drop the generated column with CASCADE, which could cause > arbitrary stuff to go away. That is sensible if you know that 7f > prevents us from getting here unless the original drop said CASCADE, > but otherwise it's a pretty astonishing thing. The reported case is a DROP FUNCTION, but looking at , it doesn't say anything about what to do with generation expressions. That might be a bug in the standard, too.