handling multiple matching constraints in DetachPartitionFinalize()

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: handling multiple matching constraints in DetachPartitionFinalize()
Date: 2022-08-23 17:10:51
Message-ID: CALNJ-vT-RfQeScWi3iQWPzwHgGnH=9X9kADPK5yQEFfeGn+AKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I was looking at the following code in DetachPartitionFinalize():

/* If there's a constraint associated with the index, detach it too
*/
constrOid =
get_relation_idx_constraint_oid(RelationGetRelid(partRel),
idxid);

As mentioned in email thread `parenting a PK constraint to a self-FK one`,
there may be multiple matching constraints, I think we should
call ConstraintSetParentConstraint() for each of them.

This means adding a helper method similar to
get_relation_idx_constraint_oid() which finds constraint and calls
ConstraintSetParentConstraint().

I am preparing a patch.
Please let me know if my proposal makes sense.

Thanks

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-08-23 17:15:46 Re: [PATCH] Optimize json_lex_string by batching character copying
Previous Message Jacob Champion 2022-08-23 17:04:30 Re: [PATCH] Expose port->authn_id to extensions and triggers