pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Partitioned tables and [un]loggedness
Date: Thu, 19 Sep 2024 10:03:09 +0200
Message-ID: <202409190803.tnis52adt2n5@alvherre.pgsql> (raw )
In-Reply-To: <Zt-V90bS4diq4e0Q@paquier.xyz >
On 2024-Sep-10, Michael Paquier wrote:
> @@ -5060,17 +5061,17 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
> pass = AT_PASS_MISC;
> break;
> case AT_AttachPartition:
> - ATSimplePermissions(cmd->subtype, rel, ATT_TABLE | ATT_PARTITIONED_INDEX);
> + ATSimplePermissions(cmd->subtype, rel, ATT_TABLE | ATT_PARTITIONED_TABLE | ATT_PARTITIONED_INDEX);
> /* No command-specific prep needed */
> pass = AT_PASS_MISC;
> break;
> case AT_DetachPartition:
> - ATSimplePermissions(cmd->subtype, rel, ATT_TABLE);
> + ATSimplePermissions(cmd->subtype, rel, ATT_TABLE | ATT_PARTITIONED_TABLE);
> /* No command-specific prep needed */
> pass = AT_PASS_MISC;
> break;
> case AT_DetachPartitionFinalize:
> - ATSimplePermissions(cmd->subtype, rel, ATT_TABLE);
> + ATSimplePermissions(cmd->subtype, rel, ATT_TABLE | ATT_PARTITIONED_TABLE);
> /* No command-specific prep needed */
> pass = AT_PASS_MISC;
> break;
It looks to me like these cases could be modified to accept only
ATT_PARTITIONED_TABLE, not ATT_TABLE anymore. The ATT_TABLE cases are
useless anyway, because they're rejected by transformPartitionCmd.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
Attachments:
0001-Don-t-take-ATT_TABLE-for-ALTER-TABLE-.-ATTACH-DETACH.patch (text/x-diff, 1.4K) download
From eab048c9c7e01df46b0d98d68507c98d9fa187c1 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Thu, 19 Sep 2024 09:51:07 +0200
Subject: [PATCH] Don't take ATT_TABLE for ALTER TABLE ... ATTACH/DETACH
---
src/backend/commands/tablecmds.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 2d703aa22e..d27e6cf345 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -5107,19 +5107,17 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
break;
case AT_AttachPartition:
ATSimplePermissions(cmd->subtype, rel,
- ATT_TABLE | ATT_PARTITIONED_TABLE | ATT_PARTITIONED_INDEX);
+ ATT_PARTITIONED_TABLE | ATT_PARTITIONED_INDEX);
/* No command-specific prep needed */
pass = AT_PASS_MISC;
break;
case AT_DetachPartition:
- ATSimplePermissions(cmd->subtype, rel,
- ATT_TABLE | ATT_PARTITIONED_TABLE);
+ ATSimplePermissions(cmd->subtype, rel, ATT_PARTITIONED_TABLE);
/* No command-specific prep needed */
pass = AT_PASS_MISC;
break;
case AT_DetachPartitionFinalize:
- ATSimplePermissions(cmd->subtype, rel,
- ATT_TABLE | ATT_PARTITIONED_TABLE);
+ ATSimplePermissions(cmd->subtype, rel, ATT_PARTITIONED_TABLE);
/* No command-specific prep needed */
pass = AT_PASS_MISC;
break;
--
2.39.2
view thread (37+ messages) latest in thread
Message-ID: <202409190803.tnis52adt2n5@alvherre.pgsql>
Permalink: ../202409190803.tnis52adt2n5@alvherre.pgsql/
Also on: postgresql.org/message-id/202409190803.tnis52adt2n5@alvherre.pgsql
copy link · copy postgr.es · copy git am
reply 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: alvherre@alvh.no-ip.org, michael@paquier.xyz, nathandbossart@gmail.com, david.g.johnston@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Partitioned tables and [un]loggedness
In-Reply-To: <202409190803.tnis52adt2n5@alvherre.pgsql>
* 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