[PATCH] Add reverse(bytea)

Started by Aleksander Alekseevabout 1 year ago6 messageshackers
Jump to latest
#1Aleksander Alekseev
aleksander@timescale.com

Hi,

The proposed patch adds reverse(bytea) function.

This allows converting between big-endian and little-endian binary
strings, which works nicely with previous commits [1]https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=760162fedb4f and [2]https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=6da469badaff.

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=760162fedb4f
[2]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=6da469badaff

--
Best regards,
Aleksander Alekseev

Attachments:

v1-0001-Add-reverse-bytea-function.patchapplication/octet-stream; name=v1-0001-Add-reverse-bytea-function.patchDownload+73-1
#2Nathan Bossart
nathandbossart@gmail.com
In reply to: Aleksander Alekseev (#1)
Re: [PATCH] Add reverse(bytea)

On Mon, Mar 10, 2025 at 10:40:01AM +0300, Aleksander Alekseev wrote:

The proposed patch adds reverse(bytea) function.

We already have array_reverse() and text_reverse(), so I see no strong
reason against also having a bytea_reverse().

--
nathan

#3Daniel Gustafsson
daniel@yesql.se
In reply to: Nathan Bossart (#2)
Re: [PATCH] Add reverse(bytea)

On 10 Mar 2025, at 22:06, Nathan Bossart <nathandbossart@gmail.com> wrote:

On Mon, Mar 10, 2025 at 10:40:01AM +0300, Aleksander Alekseev wrote:

The proposed patch adds reverse(bytea) function.

We already have array_reverse() and text_reverse(), so I see no strong
reason against also having a bytea_reverse().

+1

--
Daniel Gustafsson

#4Aleksander Alekseev
aleksander@timescale.com
In reply to: Daniel Gustafsson (#3)
Re: [PATCH] Add reverse(bytea)

Nathan, Daniel,

We already have array_reverse() and text_reverse(), so I see no strong
reason against also having a bytea_reverse().

+1

I also considered adding reverse(bit) however to my knowledge there is
no practical usage for it.

--
Best regards,
Aleksander Alekseev

#5Nathan Bossart
nathandbossart@gmail.com
In reply to: Aleksander Alekseev (#4)
Re: [PATCH] Add reverse(bytea)

Here is what I have staged for commit. The only differences from v1 are
some very light edits.

--
nathan

Attachments:

v2-0001-Add-reverse-for-bytea.patchtext/plain; charset=us-asciiDownload+63-1
#6Nathan Bossart
nathandbossart@gmail.com
In reply to: Nathan Bossart (#5)
Re: [PATCH] Add reverse(bytea)

Committed.

--
nathan