agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up usage of hash_any() and hash_any_extended()
Date: Wed, 23 Sep 2026 10:36:02 +0000
Message-ID: <E1x9KKY-00000000tsj-2Ggb@gemulon.postgresql.org> (raw)

Clean up usage of hash_any() and hash_any_extended()

Back in the days before a91e2fa94, hash_any() was the primary hash
function and it returned a Datum. That commit changed hash_any() to a
wrapper over hash_bytes(). Some places actually wanted the underlying
uint32 from hash_bytes(), but that now presents as useless round-trip
casting, so update the call sites where we don't immediately need a
Datum.

hash_numeric() didn't have round-trip casting, but it was internally
inconsistent: Paths returning a constant used PG_RETURN_UINT32(), but
the path using the result of hash_any() used PG_RETURN_DATUM. Change
it to use uint32 throughout.

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Suggested-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://postgr.es/m/CAJ7c6TMPhDRQMmkUHPv8oOK97B1mR8NRS61DgjpdaZUPAwaeZQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a1c37421a8707b365f5dd27d328648c7fe0503a0

Modified Files
--------------
contrib/ltree/ltree_op.c                   |  4 ++--
src/backend/access/tablesample/bernoulli.c |  4 ++--
src/backend/access/tablesample/system.c    |  4 ++--
src/backend/commands/async.c               |  8 ++++----
src/backend/lib/bloomfilter.c              |  2 +-
src/backend/lib/hyperloglog.c              |  2 +-
src/backend/nodes/bitmapset.c              |  4 ++--
src/backend/nodes/queryjumblefuncs.c       | 10 +++++-----
src/backend/tsearch/ts_typanalyze.c        |  3 +--
src/backend/utils/adt/bytea.c              |  4 ++--
src/backend/utils/adt/jsonb_gin.c          |  2 +-
src/backend/utils/adt/jsonb_util.c         | 10 +++++-----
src/backend/utils/adt/numeric.c            | 27 ++++++++++++++-------------
src/backend/utils/adt/varlena.c            |  4 ++--
src/backend/utils/cache/funccache.c        |  8 ++++----
15 files changed, 48 insertions(+), 48 deletions(-)



Message-ID: <E1x9KKY-00000000tsj-2Ggb@gemulon.postgresql.org>
Permalink:  ../E1x9KKY-00000000tsj-2Ggb@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1x9KKY-00000000tsj-2Ggb@gemulon.postgresql.org

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: pgsql-committers@postgresql.org
  Cc: john.naylor@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Clean up usage of hash_any() and hash_any_extended()
  In-Reply-To: <E1x9KKY-00000000tsj-2Ggb@gemulon.postgresql.org>

* 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