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

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger
Дата
Msg-id CAA4eK1KEZ86w-k+yZFyZTMrWUW6BfF21V8tiOBpSiA4pz4A0hw@mail.gmail.com
обсуждение исходный текст
Ответ на RE: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Ответы Re: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Fri, Jul 15, 2022 at 11:39 AM houzj.fnst@fujitsu.com
<houzj.fnst@fujitsu.com> wrote:
>
> On Friday, July 15, 2022 11:41 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> Hi,
> >
> > On Fri, Jul 15, 2022 at 03:21:30AM +0000, kuroda.hayato@fujitsu.com wrote:
> > > Sounds good. I grepped ATExecXXX() functions called in ATExecCmd(),
> > > and I confirmed that all returned values have been collected except them.
> > >
> > > While checking test code test about EVENT TRIGGER, I found there were
> > > no tests related with partitions in that.
> > > How about adding them?
> >
> > Agreed.  It would be good to track down what changes once those
> > ObjectAddresses are collected.
>
> Thanks for having a look. It was a bit difficult to add a test for this.
> Because we currently don't have a user function which can return these
> collected ObjectAddresses for ALTER TABLE. And It seems we don't have tests for
> already collected ObjectAddresses as well :(
>
> The collected ObjectAddresses is in
> "currentEventTriggerState->currentCommand->d.alterTable.subcmds.address" while
> the public function pg_event_trigger_ddl_commands doesn't return these
> information. It can only be used in user defined event trigger function (C
> code).
>
> If we want to add some tests for both already existed and newly added
> ObjectAddresses, we might need to add some test codes in test_ddl_deparse.c.
> What do you think ?
>

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.

-- 
With Regards,
Amit Kapila.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Matthias van de Meent
Дата:
Сообщение: Re: Make name optional in CREATE STATISTICS
Следующее
От: Amul Sul
Дата:
Сообщение: GetStandbyFlushRecPtr() : OUT param is not optional like elsewhere.