Re: Partitioned tables and [un]loggedness

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Partitioned tables and [un]loggedness
Date: 2024-09-19 08:03:09
Message-ID: 202409190803.tnis52adt2n5@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

Attachment Content-Type Size
0001-Don-t-take-ATT_TABLE-for-ALTER-TABLE-.-ATTACH-DETACH.patch text/x-diff 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-09-19 08:26:00 Re: not null constraints, again
Previous Message Andrei Lepikhov 2024-09-19 07:55:19 Improve statistics estimation considering GROUP-BY as a 'uniqueiser'