[PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter

From: zengman <zengman(at)halodbtech(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
Date: 2026-02-24 15:09:07
Message-ID: tencent_6AF712884E8D163F7F46073C@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I noticed that ExecWithoutOverlapsNotEmpty() accepts an atttypid parameter that isn't actually used. The function only needs typtype to distinguish between range and multirange types.
Currently lookup_type_cache() is called just to extract typtype, but I think using get_typtype() directly seems more appropriate.

```
static void ExecWithoutOverlapsNotEmpty(Relation rel, NameData attname, Datum attval,
- char typtype, Oid atttypid);
+ char typtype);

/* ----------------------------------------------------------------
* ExecOpenIndices
@@ -753,11 +754,10 @@ check_exclusion_or_unique_constraint(Relation heap, Relation index,
{
TupleDesc tupdesc = RelationGetDescr(heap);
Form_pg_attribute att = TupleDescAttr(tupdesc, attno - 1);
- TypeCacheEntry *typcache = lookup_type_cache(att->atttypid, 0);

ExecWithoutOverlapsNotEmpty(heap, att->attname,
values[indnkeyatts - 1],
- typcache->typtype, att->atttypid);
+ get_typtype(att->atttypid));
}
}

@@ -1149,7 +1149,7 @@ index_expression_changed_walker(Node *node, Bitmapset *allUpdatedCols)
* range or multirange in the given attribute.
*/
static void
-ExecWithoutOverlapsNotEmpty(Relation rel, NameData attname, Datum attval, char typtype, Oid atttypid)
+ExecWithoutOverlapsNotEmpty(Relation rel, NameData attname, Datum attval, char typtype)
{
bool isempty;
RangeType *r;
```

--
regards,
Man Zeng

Attachment Content-Type Size
0001-refactor-Simplify-ExecWithoutOverlapsNotEmpty-functi.patch application/octet-stream 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 陈宗志 2026-02-24 15:27:35 Re: [PROPOSAL] Doublewrite Buffer as an alternative torn page protection to Full Page Write
Previous Message KAZAR Ayoub 2026-02-24 15:07:38 Re: Speed up COPY FROM text/CSV parsing using SIMD