Re: [PATCH] Simplify SortSupport implementation for macaddr

x4mmm@yandex-team.ru

From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Aleksander Alekseev <aleksander@tigerdata.com>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>, John Naylor <johncnaylorls@gmail.com>
Date: 2026-03-05T18:02:45Z
Lists: pgsql-hackers

> On 25 Feb 2026, at 18:05, Aleksander Alekseev <aleksander@tigerdata.com> wrote:
> 
> <v1-0001-Simplify-SortSupport-implementation-for-macaddr.patch>

The patch looks correct and useful to me.

Two small points:

1. The assignment ssup->ssup_extra = NULL can be removed. The
   SortSupport struct is zeroed before the callback is called (see
   sortsupport.h). There are about 22 similar assignments elsewhere;
   it does not seem to be established practice, many other places have
   no such assignment.

2. I checked whether the existing tests actually use the SortSupport
   path. If macaddr_abbrev_abort() is made to error out, the macaddr.sql
   tests fail in two places: once for the index and once for the SELECT.
   So the current test file does exercise the SortSupport code path. I
   also tried making macaddr_abbrev_abort() always return true (so
   abbreviation is always aborted); the test dataset is small, but
   sorting seem to produce correct results.

The patch looks good to me.


Best regards, Andrey Borodin.


Commits

  1. Simplify SortSupport for the macaddr data type