pgsql: Clean up usage of hash_any() and hash_any_extended() - Mailing list pgsql-committers

From John Naylor
Subject pgsql: Clean up usage of hash_any() and hash_any_extended()
Date
Msg-id E1x9KKY-00000000tsj-2Ggb@gemulon.postgresql.org
Whole thread
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Dean Rasheed
Date:
Subject: pgsql: Fix concurrent delete handling in MERGE ... WHEN NOT MATCHED BY
Next
From: Michael Paquier
Date:
Subject: pgsql: doc: Mention oid8 TOAST values in the limits appendix