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.89) (envelope-from ) id 1iwQzf-0003nT-Sa for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2020 13:33:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iwQze-0001Wt-Kp for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jan 2020 13:33:26 +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 1iwQze-0001Wm-7A for pgsql-hackers@lists.postgresql.org; Tue, 28 Jan 2020 13:33:26 +0000 Received: from mail-yb1-xb44.google.com ([2607:f8b0:4864:20::b44]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iwQza-0002Ka-VR for pgsql-hackers@postgresql.org; Tue, 28 Jan 2020 13:33:25 +0000 Received: by mail-yb1-xb44.google.com with SMTP id k15so6684102ybd.10 for ; Tue, 28 Jan 2020 05:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=XjSBuHBfAUZT8IXsLz1gVlIx/XuSKU4lo6FTQu7qkRc=; b=RHmvggVJcwaM8JDhhHpeAM2LB1z9r6Bq9y7axEsvYPgKB7BE8ulEHOdj3hH9efzvxF IWKCWcXL+SYzyT+wsue6WlUUtMtuWAWF7VFoJx4GraLkZvqUeSMuRkf80adYBPczaKJZ 14osIhun6F/KZVYNPBYkdYTvvkn1cqZyujgxVBVzeJbxiw5gfWSWPcAOpbwuw8g0QXRG YTxUCBO2vPx1vlTSnL828ugkOj8N8mkuP85t+W01H9cF0GhRCD/AnnxzZQH2JPv+9iMf tB6vO6Nm0Aq1DrLZ8s6HqYlNTThgfiUu+fxk6ZlmnmHY/FOYTuIbFp5nthg0q7jUmeAa Dakw== 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:mime-version :content-disposition:user-agent; bh=XjSBuHBfAUZT8IXsLz1gVlIx/XuSKU4lo6FTQu7qkRc=; b=PLhzeXfNM4MbM3NiRyLnCaqeEBEDakXMa74AjRNaux1aDZIKqLyigUeL1ME7SC/zef Mxa6GARHUyQUkbNXfoo81NnxkE23MQSdgH5TKU4BoxdR7zmR0GsW4ArLnQBSjLXwfMk2 3RZ1wOrSj5JyYVMaHGPsTXleF7U+FuAuWyV00vHHHpRVecRa6plp67FhWu4CO2EiQUOh BAmzcS7XzQ4Nf7Hxu9AHasnxahrp/d+QiWaxSJoO6mL3JSbLtXXV5ZfdOttHk7B1SIrR jmQ3JucJFOqIUZjezSn7BVvKo7Ec1cwdOv/hP2Es075FSa8N1pyqhXpVzTIG8zAzaRRd SaSA== X-Gm-Message-State: APjAAAVQDwRSUlmKeEoJG+FZvQidsWW3ys/K/gLxdLo/FnawVojjDesd XdW5ezj80deMX8hPis6xUWWXUNE9wHE= X-Google-Smtp-Source: APXvYqyaifzxrUFB6lZrmcysbSTRsEORWTrul+3EkwxEMoCTgPMKMxsqMpSGVxtxA8jTDQDMP/de4g== X-Received: by 2002:a25:bd42:: with SMTP id p2mr17869100ybm.23.1580218401055; Tue, 28 Jan 2020 05:33:21 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k5sm8271421ywa.80.2020.01.28.05.33.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jan 2020 05:33:20 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 2C1EF8007F7; Tue, 28 Jan 2020 07:33:18 -0600 (CST) Date: Tue, 28 Jan 2020 07:33:17 -0600 From: Justin Pryzby To: pgsql-hackers@postgresql.org Cc: Andres Freund Subject: tableam options for pg_dump/ALTER/LIKE Message-ID: <20200128133317.GZ13621@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I made these casual comments. If there's any agreement on their merit, it'd be nice to implement at least the first for v13. In <20190818193533.GL11185@telsasoft.com>, I wrote: > . What do you think about pg_restore --no-tableam; similar to > --no-tablespaces, it would allow restoring a table to a different AM: > PGOPTIONS='-c default_table_access_method=zedstore' pg_restore --no-tableam ./pg_dump.dat -d postgres > Otherwise, the dump says "SET default_table_access_method=heap", which > overrides any value from PGOPTIONS and precludes restoring to new AM. That appears to be a trivial variation on no-tablespace: /* do nothing in --no-tablespaces mode */ if (ropt->noTablespace) return; > . it'd be nice if there was an ALTER TABLE SET ACCESS METHOD, to allow > migrating data. Otherwise I think the alternative is: > begin; lock t; > CREATE TABLE new_t LIKE (t INCLUDING ALL EXCLUDING INDEXES) USING (zedstore); > INSERT INTO new_t SELECT * FROM t; > for index; do CREATE INDEX...; done > DROP t; RENAME new_t (and all its indices). attach/inherit, etc. > commit; Ideally that would allow all at once various combinations of altering tablespace, changing AM, clustering, and reindexing, like what's discussed here: https://www.postgresql.org/message-id/flat/8a8f5f73-00d3-55f8-7583-1375ca8f6a91@postgrespro.ru > . Speaking of which, I think LIKE needs a new option for ACCESS METHOD, which > is otherwise lost.