Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2025-02-03 16:40:18
Message-ID: 202502031640.zem6orjmmxoz@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> --- a/src/backend/catalog/heap.c
> +++ b/src/backend/catalog/heap.c
> @@ -101,9 +101,6 @@ static ObjectAddress AddNewRelationType(const char *typeName,
> Oid new_row_type,
> Oid new_array_type);
> static void RelationRemoveInheritance(Oid relid);
> -static Oid StoreRelCheck(Relation rel, const char *ccname, Node *expr,
> - bool is_enforced, bool is_validated, bool is_local,
> - int16 inhcount, bool is_no_inherit, bool is_internal);
> static void StoreConstraints(Relation rel, List *cooked_constraints,
> bool is_internal);
> static bool MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
> @@ -111,7 +108,6 @@ static bool MergeWithExistingConstraint(Relation rel, const char *ccname, Node *
> bool is_enforced,
> bool is_initially_valid,
> bool is_no_inherit);
> -static void SetRelationNumChecks(Relation rel, int numchecks);

I'm wary of taking some static functions and making them non-static
without further analysis, because we create a kind-of API that's
possible incoherent or at least incomplete and may cause trouble later.
Maybe we should make some effort to construct a real interface here.
For example, perhaps you don't need to expose both StoreRelCheck and
SetRelationNumChecks, but instead would be better served by exposing
StoreConstraints? (Though I think we need some explicit check that that
function requires that the table is new and has no constraint, otherwise
SetRelationNumChecks stores the wrong thing. No?) Or maybe use
AddRelationNewConstraints() instead, which is an already exposed function.

What I'm saying is just that we should be more watchful of what we put
in our .h files.

Note: I didn't actually review the patch.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-02-03 16:49:59 Re: sinvaladt.c: remove msgnumLock, use atomic operations on maxMsgNum
Previous Message Pavel Stehule 2025-02-03 16:32:00 Re: SQLFunctionCache and generic plans