Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j7r2f-0003f6-07 for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Feb 2020 01:35:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7r2d-0000Xg-Eg for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Feb 2020 01:35:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7r2d-0000XZ-5g for pgsql-hackers@lists.postgresql.org; Sat, 29 Feb 2020 01:35:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j7r2W-0005HU-JN for pgsql-hackers@postgresql.org; Sat, 29 Feb 2020 01:35:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 01T1ZXKQ009227; Fri, 28 Feb 2020 20:35:33 -0500 From: Tom Lane To: Tomas Vondra cc: pgsql-hackers@postgresql.org Subject: Re: Allowing ALTER TYPE to change storage strategy In-reply-to: <20200229012511.7h23frunvvxwai7q@development> References: <20200228004440.b23ein4qvmxnlpht@development> <4872.1582916389@sss.pgh.pa.us> <20200229012511.7h23frunvvxwai7q@development> Comments: In-reply-to Tomas Vondra message dated "Sat, 29 Feb 2020 02:25:11 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9225.1582940133.1@sss.pgh.pa.us> Date: Fri, 28 Feb 2020 20:35:33 -0500 Message-ID: <9226.1582940133@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > I think we might check if there are any attributes with the given data > type, and allow the change if there are none. That would still allow the > change when the type is used only for things like function parameters > etc. But we'd also have to check for domains (recursively). Still has race conditions. > One thing I haven't mentioned in the original message is CASCADE. It > seems useful to optionally change storage for all attributes with the > given data type. But I'm not sure it's actually a good idea, and the > amount of code seems non-trivial (it'd have to copy quite a bit of code > from ALTER TABLE). You'd need a moderately strong lock on each such table, which means there'd be serious deadlock hazards. I'm dubious that it's worth troubling with. regards, tom lane