public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
2+ messages / 2 participants
[nested] [flat]

* [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
@ 2026-02-24 15:09 =?ISO-8859-1?B?emVuZ21hbg==?= <[email protected]>
  2026-02-24 17:13 ` Re: [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter Zsolt Parragi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: =?ISO-8859-1?B?emVuZ21hbg==?= @ 2026-02-24 15:09 UTC (permalink / raw)
  To: =?ISO-8859-1?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>

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

Attachments:

  [application/octet-stream] 0001-refactor-Simplify-ExecWithoutOverlapsNotEmpty-functi.patch (2.1K, 2-0001-refactor-Simplify-ExecWithoutOverlapsNotEmpty-functi.patch)
  download | inline diff:
From d6f2f91d5618c8fa645dc067426b76eb5f21faeb Mon Sep 17 00:00:00 2001
From: Man Zeng <[email protected]>
Date: Tue, 24 Feb 2026 16:52:34 +0800
Subject: [PATCH] refactor: Simplify ExecWithoutOverlapsNotEmpty function
 signature and update related calls

---
 src/backend/executor/execIndexing.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/executor/execIndexing.c b/src/backend/executor/execIndexing.c
index 9d071e495c6..5474061c7b7 100644
--- a/src/backend/executor/execIndexing.c
+++ b/src/backend/executor/execIndexing.c
@@ -115,6 +115,7 @@
 #include "nodes/nodeFuncs.h"
 #include "storage/lmgr.h"
 #include "utils/injection_point.h"
+#include "utils/lsyscache.h"
 #include "utils/multirangetypes.h"
 #include "utils/rangetypes.h"
 #include "utils/snapmgr.h"
@@ -145,7 +146,7 @@ static bool index_unchanged_by_update(ResultRelInfo *resultRelInfo,
 static bool index_expression_changed_walker(Node *node,
 											Bitmapset *allUpdatedCols);
 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;
-- 
2.45.2



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
  2026-02-24 15:09 [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter =?ISO-8859-1?B?emVuZ21hbg==?= <[email protected]>
@ 2026-02-24 17:13 ` Zsolt Parragi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Zsolt Parragi @ 2026-02-24 17:13 UTC (permalink / raw)
  To: zengman <[email protected]>; +Cc: pgsql-hackers <[email protected]>

Hello!

Looks good to me!

My only comment is that it could use a proper commit message
explaining the changes.






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-02-24 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-24 15:09 [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter =?ISO-8859-1?B?emVuZ21hbg==?= <[email protected]>
2026-02-24 17:13 ` Zsolt Parragi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox