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 1j89nX-0006uN-Gw for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Feb 2020 21:37:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j89nW-00085a-9Q for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Feb 2020 21:37:22 +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 1j89nW-00085T-0Q for pgsql-hackers@lists.postgresql.org; Sat, 29 Feb 2020 21:37:22 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j89nT-0006Hz-98 for pgsql-hackers@postgresql.org; Sat, 29 Feb 2020 21:37:21 +0000 Received: by mail-wm1-x331.google.com with SMTP id i10so10936488wmd.1 for ; Sat, 29 Feb 2020 13:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=+nqvxuieDDkLXUHoJxVnV0eXfgC3WLaeQyGyQ//vzxc=; b=Qeqjw2/zrJxTqfX/YszfI5EEr7fkkszcj09DRLRdbc0Uohffe+ao6+ysTUTKwGlzeL UQYx+MCVLBir4ry2KGyXD/oI/d14D6a+ts6WPDh3sS+Qbn6SFZTqJX16pexIkadnjhp2 s3faZDyN89x2TUCNqpGmscg21RAC4aQWtmvPlXJAmNHTFZNnu0rkHh2DMk37c7lZ50G6 2nP2gGiZ8hh6nFiKHCiFaOUo0gRnrALboLzyevAuOTIAyjOpWPgWBIsF+jY0Vp4pWwsv D9uP/o/ZKfnh4wY8hgUxhTcyIdzaqID4KSkdbw7MldFKe4p9lmtgL+2KGSn2TMw31c26 9qOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+nqvxuieDDkLXUHoJxVnV0eXfgC3WLaeQyGyQ//vzxc=; b=IgCmv8zampYPFayue+kxDsvMpFg9vRJOG3ep7jjC4lK3ef/uEr/OUJ8c8zgv8E2UKD cWwfm8ZayRxzLOvx5bVHhtkq+SlDe/oivjOrlSF53OECD3LhSCnPlZKeixc/seN5LRZj 777Fb+ccuXuVjIl2GbEzIWVr0b2eLXVlRGfmTXTRphWDGMxV6iHqByf3Y6WdY+fRu3Sq gjggC7JFplpLgcHM6e+aMMaTLPCfJeQknOynzupoo1S7YgFl0igKNxErSwB8mL4nycbE 8P3xO+aIPlGNFYIicEXEpGRIvXp7/FfZXIwYoXdjUOKG6A2CE7qKd6qprpWN2IqNhZc4 Ev5g== X-Gm-Message-State: ANhLgQ1p/XWdx3AcUfSpkazsDnYAtR0kW0TRBIYQvJ+vWxLQWDypKGJr 2KkTHd+PzBbCqQvUM0xTBPTnTw== X-Google-Smtp-Source: ADFU+vtIwhB34elYIxW+3V49Gr83Dyn0hiBzbbh92DYL49qXy5w+Owukwr6wVmm3Sz01R8UL+4mMDQ== X-Received: by 2002:a05:600c:2199:: with SMTP id e25mr2399133wme.142.1583012237379; Sat, 29 Feb 2020 13:37:17 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id j15sm19640873wrp.9.2020.02.29.13.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 13:37:16 -0800 (PST) Date: Sat, 29 Feb 2020 22:37:14 +0100 From: Tomas Vondra To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: Allowing ALTER TYPE to change storage strategy Message-ID: <20200229213714.7osohwlvup24ugd2@development> References: <20200228004440.b23ein4qvmxnlpht@development> <4872.1582916389@sss.pgh.pa.us> <20200229012511.7h23frunvvxwai7q@development> <9226.1582940133@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <9226.1582940133@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Feb 28, 2020 at 08:35:33PM -0500, Tom Lane wrote: >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. > Yeah, I have no problem believing that. >> 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. > Yeah, I don't plan to do this in v1 (and I have no immediate plan to work on it after that). But I wonder how is the deadlock risk any different compared e.g. to DROP TYPE ... CASCADE? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services