agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Separate out bytea sort support from varlena.c
3+ messages / 3 participants
[nested] [flat]

* pgsql: Separate out bytea sort support from varlena.c
@ 2025-12-16 08:26  John Naylor <john.naylor@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: John Naylor @ 2025-12-16 08:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Separate out bytea sort support from varlena.c

In the wake of commit b45242fd3, bytea_sortsupport() still called out
to varstr_sortsupport(). Treating bytea as a kind of text/varchar
required varstr_sortsupport() to allow for the possibility of
NUL bytes, but only for C collation. This was confusing. For
better separation of concerns, create an independent sortsupport
implementation in bytea.c.

The heuristics for bytea_abbrev_abort() remain the same as for
varstr_abbrev_abort(). It's possible that the bytea case warrants
different treatment, but that is left for future investigation.

In passing, adjust some strange looking comparisons in
varstr_abbrev_abort().

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAJ7c6TP1bAbEhUJa6+rgceN6QJWMSsxhg1=mqfSN=Nb-n6DAKg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9303d62c6db0207b8c2649205f7bc9350c1f62db

Modified Files
--------------
src/backend/utils/adt/bytea.c    | 238 ++++++++++++++++++++++++++++++++++++++-
src/backend/utils/adt/varlena.c  |  43 ++-----
src/tools/pgindent/typedefs.list |   1 +
3 files changed, 242 insertions(+), 40 deletions(-)



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

* Re: pgsql: Separate out bytea sort support from varlena.c
@ 2026-04-14 14:55  Aleksander Alekseev <aleksander@tigerdata.com>
  parent: John Naylor <john.naylor@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Aleksander Alekseev @ 2026-04-14 14:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org; +Cc: John Naylor <john.naylor@postgresql.org>

Hi John,

> Separate out bytea sort support from varlena.c
>
> [...]

I noticed that the ByteaSortSupport.abbreviate field is not used for
anything. Here is the fix.

-- 
Best regards,
Aleksander Alekseev

Attachments:

  [text/x-patch] v1-0001-Remove-unused-ByteaSortSupport.abbreviate-field.patch (1.3K, ../../CAJ7c6TOsKmmgyA6EwxKVsNeHFHrWXYdgZivgjo_ujf890BpeeA@mail.gmail.com/2-v1-0001-Remove-unused-ByteaSortSupport.abbreviate-field.patch)
  download | inline diff:
From 1479ca013ee7e4655105b112d0ec3cc2cf008890 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@tigerdata.com>
Date: Tue, 14 Apr 2026 17:44:21 +0300
Subject: [PATCH v1] Remove unused ByteaSortSupport.abbreviate field

Oversight of commit 9303d62c6db0.

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Discussion: https://postgr.es/m/CAJ7c6TP1bAbEhUJa6+rgceN6QJWMSsxhg1=mqfSN=Nb-n6DAKg@mail.gmail.com
---
 src/backend/utils/adt/bytea.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/backend/utils/adt/bytea.c b/src/backend/utils/adt/bytea.c
index f6e3266ac32..a1f5d4e572b 100644
--- a/src/backend/utils/adt/bytea.c
+++ b/src/backend/utils/adt/bytea.c
@@ -41,7 +41,6 @@ static bytea *bytea_overlay(bytea *t1, bytea *t2, int sp, int sl);
 
 typedef struct
 {
-	bool		abbreviate;		/* Should we abbreviate keys? */
 	hyperLogLogState abbr_card; /* Abbreviated key cardinality state */
 	hyperLogLogState full_card; /* Full key cardinality state */
 	double		prop_card;		/* Required cardinality proportion */
@@ -1229,7 +1228,6 @@ bytea_sortsupport(PG_FUNCTION_ARGS)
 		ByteaSortSupport *bss;
 
 		bss = palloc_object(ByteaSortSupport);
-		bss->abbreviate = true;
 		bss->prop_card = 0.20;
 		initHyperLogLog(&bss->abbr_card, 10);
 		initHyperLogLog(&bss->full_card, 10);
-- 
2.43.0



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

* Re: pgsql: Separate out bytea sort support from varlena.c
@ 2026-04-29 07:11  John Naylor <johncnaylorls@gmail.com>
  parent: Aleksander Alekseev <aleksander@tigerdata.com>
  0 siblings, 0 replies; 3+ messages in thread

From: John Naylor @ 2026-04-29 07:11 UTC (permalink / raw)
  To: Aleksander Alekseev <aleksander@tigerdata.com>; +Cc: pgsql-committers@lists.postgresql.org, John Naylor <john.naylor@postgresql.org>

On Tue, Apr 14, 2026 at 9:56 PM Aleksander Alekseev
<aleksander@tigerdata.com> wrote:
> I noticed that the ByteaSortSupport.abbreviate field is not used for
> anything. Here is the fix.

Pushed, thanks.

-- 
John Naylor
Amazon Web Services





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


end of thread, other threads:[~2026-04-29 07:11 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-16 08:26 pgsql: Separate out bytea sort support from varlena.c John Naylor <john.naylor@postgresql.org>
2026-04-14 14:55 ` Aleksander Alekseev <aleksander@tigerdata.com>
2026-04-29 07:11   ` John Naylor <johncnaylorls@gmail.com>

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