Re: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger
Date: 2022-07-22 08:56:02
Message-ID: CAA4eK1+VZyUkiJZgVCa_tjNdmVPzf4cBLkS5PxyNv1qiaV+EPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 21, 2022 at 11:53 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Wed, Jul 20, 2022 at 04:36:13PM +0530, Amit Kapila wrote:
> > Right. But, I noticed that get_altertable_subcmdtypes() doesn't handle
> > AT_AttachPartition or AT_DetachPartition. We can handle those and at
> > least have a test for those in test_ddl_deparse\sql\slter_table.sql. I
> > know it is not directly related to your patch but that way we will at
> > least have some tests for Attach/Detach partition and in the future
> > when we extend it to test ObjectAddresses of subcommands that would be
> > handy. Feel free to write a separate patch for the same.
>
> Yeah, that could be a separate patch. On top of that, what about
> reworking get_altertable_subcmdtypes() so as it returns one row for
> each CollectedCommand, as of (type text, address text)? We have
> already getObjectDescription() to transform the ObjectAddress from the
> collected command to a proper string.
>

Yeah, that would be a good idea but I think instead of changing
get_altertable_subcmdtypes(), can we have a new function say
get_altertable_subcmdinfo() that returns additional information from
address. The other alternative could be that instead of returning the
address as a string, we can return some fields as a set of records
(one row for each subcommand) as we do in
pg_event_trigger_ddl_commands().

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2022-07-22 08:58:25 Re: Schema variables - new implementation for Postgres 15
Previous Message Thomas Munro 2022-07-22 08:53:12 Re: standby recovery fails (tablespace related) (tentative patch and discussion)