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 1ikgfW-0001D1-Db for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2019 03:52:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikgfV-0002j2-71 for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2019 03:52:05 +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 1ikgfU-0002dy-NY for pgsql-hackers@lists.postgresql.org; Fri, 27 Dec 2019 03:52:04 +0000 Received: from mail-yw1-xc43.google.com ([2607:f8b0:4864:20::c43]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ikgfR-0006cP-Ik for pgsql-hackers@postgresql.org; Fri, 27 Dec 2019 03:52:03 +0000 Received: by mail-yw1-xc43.google.com with SMTP id d7so10880805ywl.12 for ; Thu, 26 Dec 2019 19:52:01 -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 :in-reply-to:user-agent; bh=Kw+ICAVo1OEdLStniaKy08fxd+ciOVnDiI/o96EOXZg=; b=hQ+4H7uihwgEpBA3gsoVicBHvdyzVBZ5XdHKlkkrlKmAvD8k/M6HYrYu3u7lP8dMdy J2inMP5rxdtdrBbOgnFRH8BT8vlzTt6IRSAAxde6c4IqJvfYLj88Xbvrxyvvyl2Q48km 26cVCtjjWBY/9sQDmK9e4swenxvy8PF3GzuHTQiaTSRrtjZ889eaTHkaNpCxrakl9nZj 8ETDInaSR2axXASXPJBIdAtW0Gxciuoh4/djf1HNF8f+Jmp9huatcIY3l2shWbpsCSTi UpSZ6qYKmHrwmJu03jWmJW45Hc1shZZCP5PkdwtrbZVNWc2UkgDg+Jel6UofCvSSirYv 77FA== 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:in-reply-to:user-agent; bh=Kw+ICAVo1OEdLStniaKy08fxd+ciOVnDiI/o96EOXZg=; b=PssCJDszTP/E75SsFOLnDbkk8UrE+9bBVCXYqa/A+gSbqtziKHs8IYbFOeqlZR+97F NrtMaOlvsx6ojnOgKnA8I4slvVEz5DODKao+6iwBkGJADWBtQRJybmxJag8EZEAznBkf CMcaRwJLYbKCSzbD9aHOg/+2BBd7i41MmEUx+6DBY2RKS1FfBiib9jWF/lKSV9Zgtxqw czGF4iZMYKQlOF+vDKjCJjbNtMQ03yWqeWkXpGPKQANNkQQW+DbQL1HaQ1Ine3ePnGme VsZSPeXAsnFGYXt1Lg6YysUUYb7j15NYEM2twbUTUfj9NEnNTOhI8swKHic5jxsmzRvR 4ffQ== X-Gm-Message-State: APjAAAXy4Ld4C/SDJ0cBBnmNH/MWy1F4Sn9VJPCo6tk5M1v3amqGATbY ucZWnSG9UwPMnh/Ec30anMY3KQ== X-Google-Smtp-Source: APXvYqxw4Wtxl4oSS+R8k5FfhKWmdYG6HY9ritF6sqrXu7poV9s18uNdIO8DPFLhAQXzkdns9eFp0g== X-Received: by 2002:a81:8584:: with SMTP id v126mr36491892ywf.332.1577418720845; Thu, 26 Dec 2019 19:52:00 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y9sm13005088ywc.19.2019.12.26.19.51.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Dec 2019 19:51:59 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 0EAA4800AE5; Thu, 26 Dec 2019 21:51:58 -0600 (CST) Date: Thu, 26 Dec 2019 21:51:57 -0600 From: Justin Pryzby To: Alvaro Herrera Cc: pgsql-hackers@postgresql.org Subject: Re: ALTER INDEX fails on partitioned index Message-ID: <20191227035157.GD12890@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="GdbWtwDHkcXqP16f" Content-Disposition: inline In-Reply-To: <20190206173212.GA23770@alvherre.pgsql> <201901071923.7r2xflxvncly@alvherre.pgsql> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --GdbWtwDHkcXqP16f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 07, 2019 at 04:23:30PM -0300, Alvaro Herrera wrote: > On 2019-Jan-05, Justin Pryzby wrote: > > postgres=# CREATE TABLE t(i int)PARTITION BY RANGE(i); > > postgres=# CREATE INDEX ON t(i) WITH(fillfactor=11); > > postgres=# ALTER INDEX t_i_idx SET (fillfactor=12); > > ERROR: 42809: "t_i_idx" is not a table, view, materialized view, or index > > LOCATION: ATWrongRelkindError, tablecmds.c:5031 > > > > I can't see that's deliberate, > > Well, I deliberately ignored that aspect of the report at the time as it > seemed to me (per discussion in thread [1]) that this behavior was > intentional. However, if I think in terms of things like > pages_per_range in BRIN indexes, this decision seems to be a mistake, > because surely we should propagate that value to children. > > [1] https://www.postgresql.org/message-id/flat/CAH2-WzkOKptQiE51Bh4_xeEHhaBwHkZkGtKizrFMgEkfUuRRQg%40mail.gmail.com Possibly attached should be backpatched through v11 ? This allows SET on the parent index, which is used for newly created child indexes, but doesn't itself recurse to children. I noticed recursive "*" doesn't seem to be allowed for "alter INDEX": postgres=# ALTER INDEX p_i2* SET (fillfactor = 22); ERROR: syntax error at or near "*" LINE 1: ALTER INDEX p_i2* SET (fillfactor = 22); Also, I noticed this "doesn't fail", but setting is neither recursively applied nor used for new partitions. postgres=# ALTER INDEX p_i_idx ALTER COLUMN 1 SET STATISTICS 123; -- Justin Pryzby System Administrator Telsasoft +1-952-707-8581 --GdbWtwDHkcXqP16f Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Allow-ALTER-INDEX-SET-on-partitioned-indexes.patch" From fb05137c2c8a59dcab8fbd25fdee80e976588261 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Thu, 26 Dec 2019 21:40:06 -0600 Subject: [PATCH v1] Allow ALTER INDEX SET () on partitioned indexes --- src/backend/commands/tablecmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index d9f13da..aea84d5 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -4067,7 +4067,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, case AT_ResetRelOptions: /* RESET (...) */ case AT_ReplaceRelOptions: /* reset them all, then set just these */ - ATSimplePermissions(rel, ATT_TABLE | ATT_VIEW | ATT_MATVIEW | ATT_INDEX); + ATSimplePermissions(rel, ATT_TABLE | ATT_VIEW | ATT_MATVIEW | ATT_INDEX | ATT_PARTITIONED_INDEX); /* This command never recurses */ /* No command-specific prep needed */ pass = AT_PASS_MISC; -- 2.7.4 --GdbWtwDHkcXqP16f--