Fix out-of-date comment on makeRangeConstructors

Started by Paul A Jungwirthabout 1 month ago3 messages
#1Paul A Jungwirth
pj@illuminatedcomputing.com
1 attachment(s)

Hi Hackers,

I noticed that makeRangeConstructors (in commands/typecmds.c) says:

We actually define 4 functions, with 0 through 3 arguments.

But that hasn't been true since 2011 (df73584431). We only have 2-arg
and 3-arg functions. Here is a quick patch to update the comment.

Yours,

--
Paul ~{:-)
pj@illuminatedcomputing.com

Attachments:

v1-0001-Fix-out-of-date-comment-on-makeRangeConstructors.patchtext/x-patch; charset=US-ASCII; name=v1-0001-Fix-out-of-date-comment-on-makeRangeConstructors.patchDownload
From 8705883adedd73ae5818bf2e8011be775d28a1d8 Mon Sep 17 00:00:00 2001
From: "Paul A. Jungwirth" <pj@illuminatedcomputing.com>
Date: Tue, 2 Dec 2025 20:35:00 -0800
Subject: [PATCH v1] Fix out-of-date comment on makeRangeConstructors

We did define 4 functions in 4429f6a9e3, but in df73584431e7 we got rid of the
0- and 1-arg versions.

Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
---
 src/backend/commands/typecmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 47d5047fe8b..d48b93ee99e 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -1767,7 +1767,7 @@ DefineRange(ParseState *pstate, CreateRangeStmt *stmt)
  * impossible to define a polymorphic constructor; we have to generate new
  * constructor functions explicitly for each range type.
  *
- * We actually define 4 functions, with 0 through 3 arguments.  This is just
+ * We actually define 2 functions, with 2 through 3 arguments.  This is just
  * to offer more convenience for the user.
  */
 static void
-- 
2.47.3

#2Chao Li
li.evan.chao@gmail.com
In reply to: Paul A Jungwirth (#1)
Re: Fix out-of-date comment on makeRangeConstructors

On Dec 5, 2025, at 06:34, Paul A Jungwirth <pj@illuminatedcomputing.com> wrote:

Hi Hackers,

I noticed that makeRangeConstructors (in commands/typecmds.c) says:

We actually define 4 functions, with 0 through 3 arguments.

But that hasn't been true since 2011 (df73584431). We only have 2-arg
and 3-arg functions. Here is a quick patch to update the comment.

Yours,

--
Paul ~{:-)
pj@illuminatedcomputing.com
<v1-0001-Fix-out-of-date-comment-on-makeRangeConstructors.patch>

I think the fix is reasonable, which reflects to the current code:

```
static const char *const prosrc[2] = {"range_constructor2",
"range_constructor3"};
static const int pronargs[2] = {2, 3};
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

#3Peter Eisentraut
peter@eisentraut.org
In reply to: Chao Li (#2)
Re: Fix out-of-date comment on makeRangeConstructors

On 05.12.25 03:26, Chao Li wrote:

On Dec 5, 2025, at 06:34, Paul A Jungwirth <pj@illuminatedcomputing.com> wrote:
I noticed that makeRangeConstructors (in commands/typecmds.c) says:

We actually define 4 functions, with 0 through 3 arguments.

But that hasn't been true since 2011 (df73584431). We only have 2-arg
and 3-arg functions. Here is a quick patch to update the comment.

I think the fix is reasonable, which reflects to the current code:

```
static const char *const prosrc[2] = {"range_constructor2",
"range_constructor3"};
static const int pronargs[2] = {2, 3};
```

committed