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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(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-30 07:14:33
Message-ID: YuTaWS+cjknNw6EN@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 26, 2022 at 01:00:41PM +0000, houzj(dot)fnst(at)fujitsu(dot)com wrote:
> Thanks for the suggestion. I have removed the default and found some missed
> subcommands in 0003 patch. Attach the new version patch here
> (The 0001 and 0002 is unchanged).

I have reviewed what you have here, and I found that the change is too
timid, with a coverage of 32% for test_ddl_deparse. Attached is an
updated patch, that provides coverage for the most obvious cases I
could see in tablecmds.c, bringing the coverage to 64% here.

Some cases are straight-forward, like the four cases for RLS or the
three subcases for RelOptions (where we'd better return an address
even if doing doing for the replace case). Some cases that I have not
included here would need more thoughts, like constraint validation and
drop or even SET ACCESS METHOD, so I have discarded for now all the
cases where we don't (or cannot) report properly an ObjectAddress
yet.

There is also a fancy case with DROP COLUMN, where we get an
ObjectAddress referring to the column already dropped, aka roughly a
".....pg_dropped.N.....", and it is not like we should switch to only
a reference of the table here because we want to know the name of the
column dropped. I have discarded this last one as well, for now.

All that could be expanded in more patches (triggers are an easy one),
but what I have here is already a good cut.
--
Michael

Attachment Content-Type Size
v4-0001-Improve-coverage-for-test_ddl_deparse.patch text/x-diff 26.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-07-30 07:21:07 Re: Support for grabbing multiple consecutive values with nextval()
Previous Message Amit Kapila 2022-07-30 06:55:01 Re: Introduce wait_for_subscription_sync for TAP tests