public inbox for [email protected]  
help / color / mirror / Atom feed
From: =?ISO-8859-1?B?emVuZ21hbg==?= <[email protected]>
To: =?ISO-8859-1?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>
Subject: [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
Date: Tue, 24 Feb 2026 23:09:07 +0800
Message-ID: <[email protected]> (raw)

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



view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [PATCH] Simplify ExecWithoutOverlapsNotEmpty by removing unused parameter
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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