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 1j9voB-0007ZD-EW for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Mar 2020 19:05: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 1j9voA-0001BK-1I for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Mar 2020 19:05:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j9vo9-00016s-L3 for pgsql-hackers@lists.postgresql.org; Thu, 05 Mar 2020 19:05:21 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j9vo6-0001sx-Jp for pgsql-hackers@postgresql.org; Thu, 05 Mar 2020 19:05:20 +0000 Received: by mail-wr1-x442.google.com with SMTP id v2so8353481wrp.12 for ; Thu, 05 Mar 2020 11:05: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=ga1qsihjfjWavSwY+oF0AHOyWD0gkb+4Lg72fHcVGWE=; b=sz1e+rEdIEF/hhJHTT72g7BI1vQbEaw4E6otxNm2PV2ewDITIbkTvvlJNAigwsfJ3L H3YKQymiCYG3laKY9wYu7/bX8eeg4XukUGL02j1UNHq4k36r+qd5sWCH3YWRdDLyJP3l qhDQba8pqWcF+zju+2uKg4iQaytnQ2PULdkV0BvZ/WgzcyDLLPh1hVPBFdCfnHuKrP1I sC105f10cXv+Ai0r9PbHGKdngQKtLsZa+ZLceeJbLVbdTS9/dzKDaOStHVMPxFiHVBjY w1ZLhRQ14w/xfZCiiZVzVeGUhmQhUnIzh6fla98UXGUHLe2peyr2twL6kdtYk2p+7hku 59dQ== 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=ga1qsihjfjWavSwY+oF0AHOyWD0gkb+4Lg72fHcVGWE=; b=n2/Hzld6WOz7efTpYxX/Ak6XJpfIWZHn20OiuugiwdtRR4z+MBQH5wW4EEmjtFXsVl h2U8dsLauM7z4xHQEEETtXuvCTbTshoWzhh//a28ZW30FoUbhhqSPmYuW1Nemk+ql2Px 7xNdO6Yi8oe/0W5wDG8LhhzsBYYJcMDhhfU0ynmq/rYS+13PBY77NpmNaBRwM3+ws5ch RQhjoSgA0m9QODyODXFQRlEFDdl/lmgm/WSsMXrg0U1Bj0tSIeMxG8LOWI5hjwrCt3YG g3jM3F7iB/h0nkvsa8GO37uprPayBxD0dk8RJrD3NWowFTfoUTe9jmfy5Cg40DPx58lb qKyQ== X-Gm-Message-State: ANhLgQ3m7PXbSZA6QSIHfpV9e2XA8bxPO7AImJXyCYTEqBmhCqoYn+ED zgQ794qhWpy9tCREI9I+R/NXZghZ0Bg= X-Google-Smtp-Source: ADFU+vuMTIcD4sUiCKHQxx4CS/sUSPYW3wb5fUBHmW/RE4N57RBqztM4mvJl8dv0cxx2VKwpSUz5iw== X-Received: by 2002:adf:fc08:: with SMTP id i8mr384737wrr.104.1583435117197; Thu, 05 Mar 2020 11:05:17 -0800 (PST) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id n14sm1468720wrs.97.2020.03.05.11.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 11:05:15 -0800 (PST) Date: Thu, 5 Mar 2020 20:05:13 +0100 From: Tomas Vondra To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: Allowing ALTER TYPE to change storage strategy Message-ID: <20200305190513.y4j3ckkvpzrgiy2y@development> References: <20200228004440.b23ein4qvmxnlpht@development> <4872.1582916389@sss.pgh.pa.us> <20200229012511.7h23frunvvxwai7q@development> <9226.1582940133@sss.pgh.pa.us> <10968.1583176270@sss.pgh.pa.us> <20200302220531.cdz4rlbw5gmcicsa@development> <30065.1583347198@sss.pgh.pa.us> <14527.1583363728@sss.pgh.pa.us> <27393.1583366202@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <27393.1583366202@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Mar 04, 2020 at 06:56:42PM -0500, Tom Lane wrote: >I wrote: >> 3. Drop the ability for ALTER TYPE to promote from PLAIN to not-PLAIN >> typstorage, and adjust the typcache so that it only remembers boolean >> toastability not the specific toasting strategy. Then the cache is >> still immutable so no need for update logic. >> >> I'm kind of liking #3, ugly as it sounds, because I'm not sure how >> much of a use-case there is for the upgrade-from-PLAIN case. >> Particularly now that TOAST is so ingrained in the system, it seems >> rather unlikely that a production-grade data type wouldn't have >> been designed to be toastable from the beginning, if there could be >> any advantage to that. Either #1 or #2 seem like mighty high prices >> to pay for offering an option that might have no real-world uses. > >Here's a v5 based on that approach. I also added some comments about >the potential race conditions involved in recursing to domains. > Well, I don't know what to say, really. This very thread started with me explaining how I've repeatedly needed a way to upgrade from PLAIN, so I don't quite agree with your claim that there's no use case for that. Granted, the cases may be my faults - sometimes I have not expected the type to need TOAST initially, and then later realizing I've been wrong. In other cases I simply failed to realize PLAIN is the default value even for varlena types (yes, it's a silly mistake). FWIW I'm not suggesting you go and implement #1 or #2 for me, that'd be up to me I guess. But I disagree there's no use case for it, and #3 makes this featuer useless for me. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services