From: Justin Pryzby <pryzby@telsasoft.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: ALTER INDEX fails on partitioned index
Date: Thu, 26 Dec 2019 21:51:57 -0600
Message-ID: <20191227035157.GD12890@telsasoft.com> (raw)
In-Reply-To: <20190206173212.GA23770@alvherre.pgsql> <201901071923.7r2xflxvncly@alvherre.pgsql>
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%40mai...
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
Attachments:
[text/x-diff] v1-0001-Allow-ALTER-INDEX-SET-on-partitioned-indexes.patch (999B, ../20191227035157.GD12890@telsasoft.com/2-v1-0001-Allow-ALTER-INDEX-SET-on-partitioned-indexes.patch)
download | inline diff:
From fb05137c2c8a59dcab8fbd25fdee80e976588261 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
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.cindex 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, alvherre@2ndquadrant.com
Subject: Re: ALTER INDEX fails on partitioned index
In-Reply-To: <20191227035157.GD12890@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox