public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH] Miscellaneous little fixes
7+ messages / 4 participants
[nested] [flat]

* [PATCH] Miscellaneous little fixes
@ 2026-04-14 15:20 Aleksander Alekseev <[email protected]>
  2026-04-14 21:28 ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Aleksander Alekseev @ 2026-04-14 15:20 UTC (permalink / raw)
  To: pgsql-hackers

Hi,

I noticed several little defects in the code:

1. There are several typos in the comments: "fist" instead of "first"
2. The comment in network.c claims that IPv6 has 64 bits (in fact 128)
3. oid_hash macro is not used for a long time and can be removed.

Here is the patch.

-- 
Best regards,
Aleksander Alekseev


Attachments:

  [text/x-patch] v1-0001-Miscellaneous-little-fixes.patch (3.9K, 2-v1-0001-Miscellaneous-little-fixes.patch)
  download | inline diff:
From 0c1c8e1228b6487a4ecee21d2d00799603625445 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <[email protected]>
Date: Tue, 14 Apr 2026 17:59:58 +0300
Subject: [PATCH v1] Miscellaneous little fixes

- Fix two "fist" typos in comments in hyperloglog.c and indxpath.c.
- Fix incorrect IPv6 address width in a comment in network.c: IPv6  addresses
  are 128 bits, not 64.
- Remove the oid_hash macro from hashfn.h. The last real caller was removed
  in commit 4a14f13a0ab in December 2014, which also added the "Remove me
  eventually" notice.

Author: Aleksander Alekseev <[email protected]>
Reviewed-by: TODO FIXME
Discussion: TODO FIXME
---
 src/backend/lib/hyperloglog.c         | 2 +-
 src/backend/optimizer/path/indxpath.c | 2 +-
 src/backend/utils/adt/network.c       | 2 +-
 src/backend/utils/hash/dynahash.c     | 2 +-
 src/include/common/hashfn.h           | 2 --
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/backend/lib/hyperloglog.c b/src/backend/lib/hyperloglog.c
index c74f11217ef..3bc6aa0548f 100644
--- a/src/backend/lib/hyperloglog.c
+++ b/src/backend/lib/hyperloglog.c
@@ -228,7 +228,7 @@ estimateHyperLogLog(hyperLogLogState *cState)
  * starting from the first, reading from most significant to least significant
  * bits.
  *
- * Example (when considering fist 10 bits of x):
+ * Example (when considering first 10 bits of x):
  *
  * rho(x = 0b1000000000)   returns 1
  * rho(x = 0b0010000000)   returns 3
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 430e06dcaaa..f76a5373c4b 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -1187,7 +1187,7 @@ typedef struct
 	Oid			inputcollid;	/* OID of the OpClause input collation */
 	int			argindex;		/* index of the clause in the list of
 								 * arguments */
-	int			groupindex;		/* value of argindex for the fist clause in
+	int			groupindex;		/* value of argindex for the first clause in
 								 * the group of similar clauses */
 } OrArgIndexMatch;
 
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
index c7e0828764e..f4bf9c3b532 100644
--- a/src/backend/utils/adt/network.c
+++ b/src/backend/utils/adt/network.c
@@ -551,7 +551,7 @@ network_abbrev_abort(int memtupcount, SortSupport ssup)
  * all their subnet bits *must* be zero (1.2.3.0/24).
  *
  * IPv4 and IPv6 are identical in this makeup, with the difference being that
- * IPv4 addresses have a maximum of 32 bits compared to IPv6's 64 bits, so in
+ * IPv4 addresses have a maximum of 32 bits compared to IPv6's 128 bits, so in
  * IPv6 each part may be larger.
  *
  * inet/cidr types compare using these sorting rules. If inequality is detected
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 20610f96e7b..dd3e50d6654 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -346,7 +346,7 @@ string_compare(const char *key1, const char *key2, Size keysize)
  * Neither tabname nor *info need persist after the hash_create() call.
  *
  * Note: It is deprecated for callers of hash_create() to explicitly specify
- * string_hash, tag_hash, uint32_hash, or oid_hash.  Just set HASH_STRINGS or
+ * string_hash, tag_hash, or uint32_hash.  Just set HASH_STRINGS or
  * HASH_BLOBS.  Use HASH_FUNCTION only when you want something other than
  * one of these.
  *
diff --git a/src/include/common/hashfn.h b/src/include/common/hashfn.h
index a40434f798f..222f1d0d249 100644
--- a/src/include/common/hashfn.h
+++ b/src/include/common/hashfn.h
@@ -56,8 +56,6 @@ extern uint32 string_hash(const void *key, Size keysize);
 extern uint32 tag_hash(const void *key, Size keysize);
 extern uint32 uint32_hash(const void *key, Size keysize);
 
-#define oid_hash uint32_hash	/* Remove me eventually */
-
 /*
  * Combine two 32-bit hash values, resulting in another hash value, with
  * decent bit mixing.
-- 
2.43.0



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

* Re: [PATCH] Miscellaneous little fixes
  2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
@ 2026-04-14 21:28 ` Michael Paquier <[email protected]>
  2026-04-14 22:41   ` Re: [PATCH] Miscellaneous little fixes David Rowley <[email protected]>
  2026-04-15 08:18   ` Re: [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
  0 siblings, 2 replies; 7+ messages in thread

From: Michael Paquier @ 2026-04-14 21:28 UTC (permalink / raw)
  To: Aleksander Alekseev <[email protected]>; +Cc: pgsql-hackers

On Tue, Apr 14, 2026 at 06:20:41PM +0300, Aleksander Alekseev wrote:
> 3. oid_hash macro is not used for a long time and can be removed.

There is no cost in keeping it, and removing it could break some
extension code out there..

Picked up the rest in a staging branch.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

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

* Re: [PATCH] Miscellaneous little fixes
  2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
  2026-04-14 21:28 ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
@ 2026-04-14 22:41   ` David Rowley <[email protected]>
  2026-04-15 00:47     ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  1 sibling, 1 reply; 7+ messages in thread

From: David Rowley @ 2026-04-14 22:41 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: Aleksander Alekseev <[email protected]>; pgsql-hackers

On Wed, 15 Apr 2026 at 09:29, Michael Paquier <[email protected]> wrote:
> Picked up the rest in a staging branch.

One more in [1] and one I noticed a while ago attached, if you feel
like including those too.

David

[1] https://postgr.es/m/CA+3i_M8QOnjeG1GN+rqncnF52-Uo5fr+b=FxzqWAH41BP3oFpg@mail.gmail.com


Attachments:

  [application/octet-stream] typo_fix.patch (939B, 2-typo_fix.patch)
  download | inline diff:
diff --git a/src/test/regress/expected/fast_default.out b/src/test/regress/expected/fast_default.out
index ffbc47089b1..bd142ed481c 100644
--- a/src/test/regress/expected/fast_default.out
+++ b/src/test/regress/expected/fast_default.out
@@ -429,7 +429,7 @@ SELECT attname, atthasmissing, attmissingval FROM pg_attribute
 
 DROP TABLE T;
 DROP FUNCTION foolme(timestamptz);
--- Simple querie
+-- Simple queries
 CREATE TABLE T (pk INT NOT NULL PRIMARY KEY);
 SELECT set('t');
  set 
diff --git a/src/test/regress/sql/fast_default.sql b/src/test/regress/sql/fast_default.sql
index 8ff29cf2697..8b31d317d73 100644
--- a/src/test/regress/sql/fast_default.sql
+++ b/src/test/regress/sql/fast_default.sql
@@ -375,7 +375,7 @@ SELECT attname, atthasmissing, attmissingval FROM pg_attribute
 DROP TABLE T;
 DROP FUNCTION foolme(timestamptz);
 
--- Simple querie
+-- Simple queries
 CREATE TABLE T (pk INT NOT NULL PRIMARY KEY);
 
 SELECT set('t');


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

* Re: [PATCH] Miscellaneous little fixes
  2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
  2026-04-14 21:28 ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  2026-04-14 22:41   ` Re: [PATCH] Miscellaneous little fixes David Rowley <[email protected]>
@ 2026-04-15 00:47     ` Michael Paquier <[email protected]>
  2026-04-15 00:56       ` Re: [PATCH] Miscellaneous little fixes Chao Li <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Michael Paquier @ 2026-04-15 00:47 UTC (permalink / raw)
  To: David Rowley <[email protected]>; +Cc: Aleksander Alekseev <[email protected]>; pgsql-hackers

On Wed, Apr 15, 2026 at 10:41:28AM +1200, David Rowley wrote:
> One more in [1] and one I noticed a while ago attached, if you feel
> like including those too.

Thanks.  I have grabbed these two.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

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

* Re: [PATCH] Miscellaneous little fixes
  2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
  2026-04-14 21:28 ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  2026-04-14 22:41   ` Re: [PATCH] Miscellaneous little fixes David Rowley <[email protected]>
  2026-04-15 00:47     ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
@ 2026-04-15 00:56       ` Chao Li <[email protected]>
  2026-04-15 04:55         ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  0 siblings, 1 reply; 7+ messages in thread

From: Chao Li @ 2026-04-15 00:56 UTC (permalink / raw)
  To: Michael Paquier <[email protected]>; +Cc: David Rowley <[email protected]>; Aleksander Alekseev <[email protected]>; pgsql-hackers



> On Apr 15, 2026, at 08:47, Michael Paquier <[email protected]> wrote:
> 
> On Wed, Apr 15, 2026 at 10:41:28AM +1200, David Rowley wrote:
>> One more in [1] and one I noticed a while ago attached, if you feel
>> like including those too.
> 
> Thanks.  I have grabbed these two.
> --
> Michael

Maybe add this one, see the attached diff file. This is an oversight of 82467f627bd478569de04f4a3f1993098e80c812. I ever notified the author about this typo, but I guess he missed my message.

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






Attachments:

  [application/octet-stream] fix_typo_heapam_visibility_c.diff (508B, 2-fix_typo_heapam_visibility_c.diff)
  download | inline diff:
diff --git a/src/backend/access/heap/heapam_visibility.c b/src/backend/access/heap/heapam_visibility.c
index 3a6a1e5a084..22c88578cf3 100644
--- a/src/backend/access/heap/heapam_visibility.c
+++ b/src/backend/access/heap/heapam_visibility.c
@@ -192,7 +192,7 @@ SetHintBitsExt(HeapTupleHeader tuple, Buffer buffer,
 }
 
 /*
- * Simple wrapper around SetHintBitExt(), use when operating on a single
+ * Simple wrapper around SetHintBitsExt(), use when operating on a single
  * tuple.
  */
 static inline void


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

* Re: [PATCH] Miscellaneous little fixes
  2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
  2026-04-14 21:28 ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  2026-04-14 22:41   ` Re: [PATCH] Miscellaneous little fixes David Rowley <[email protected]>
  2026-04-15 00:47     ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
  2026-04-15 00:56       ` Re: [PATCH] Miscellaneous little fixes Chao Li <[email protected]>
@ 2026-04-15 04:55         ` Michael Paquier <[email protected]>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2026-04-15 04:55 UTC (permalink / raw)
  To: Chao Li <[email protected]>; +Cc: David Rowley <[email protected]>; Aleksander Alekseev <[email protected]>; pgsql-hackers

On Wed, Apr 15, 2026 at 08:56:02AM +0800, Chao Li wrote:
> Maybe add this one, see the attached diff file. This is an oversight
> of 82467f627bd478569de04f4a3f1993098e80c812. I ever notified the
> author about this typo, but I guess he missed my message. 

That sounds about right.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

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

* Re: [PATCH] Miscellaneous little fixes
  2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
  2026-04-14 21:28 ` Re: [PATCH] Miscellaneous little fixes Michael Paquier <[email protected]>
@ 2026-04-15 08:18   ` Aleksander Alekseev <[email protected]>
  1 sibling, 0 replies; 7+ messages in thread

From: Aleksander Alekseev @ 2026-04-15 08:18 UTC (permalink / raw)
  To: pgsql-hackers; +Cc: Michael Paquier <[email protected]>

Hi Michael,

Thanks for picking this up.

> There is no cost in keeping it, and removing it could break some
> extension code out there..

Of course it's up to you to decide, but I wanted to point out the
comment written in 2014 says:

/* Remove me eventually */

... soooooo. IMO 12 years is quite enough for eventually and for a
line of code that is not covered by any tests :)

-- 
Best regards,
Aleksander Alekseev





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


end of thread, other threads:[~2026-04-15 08:18 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-14 15:20 [PATCH] Miscellaneous little fixes Aleksander Alekseev <[email protected]>
2026-04-14 21:28 ` Michael Paquier <[email protected]>
2026-04-14 22:41   ` David Rowley <[email protected]>
2026-04-15 00:47     ` Michael Paquier <[email protected]>
2026-04-15 00:56       ` Chao Li <[email protected]>
2026-04-15 04:55         ` Michael Paquier <[email protected]>
2026-04-15 08:18   ` Aleksander Alekseev <[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