mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Add reverse(bytea).
This commit introduces a function for reversing the order of the bytes in binary strings. Bumps catversion. Author: Aleksander Alekseev <aleksander@timescale.com> Discussion: https://postgr.es/m/CAJ7c6TMe0QVRuNssUArbMi0bJJK32%2BzNA3at5m3osrBQ25MHuw%40mail.gmail.com
This commit is contained in:
@@ -236,6 +236,24 @@ SELECT E'De\\678dBeEf'::bytea;
|
||||
ERROR: invalid input syntax for type bytea
|
||||
LINE 1: SELECT E'De\\678dBeEf'::bytea;
|
||||
^
|
||||
SELECT reverse(''::bytea);
|
||||
reverse
|
||||
---------
|
||||
\x
|
||||
(1 row)
|
||||
|
||||
SELECT reverse('\xaa'::bytea);
|
||||
reverse
|
||||
---------
|
||||
\xaa
|
||||
(1 row)
|
||||
|
||||
SELECT reverse('\xabcd'::bytea);
|
||||
reverse
|
||||
---------
|
||||
\xcdab
|
||||
(1 row)
|
||||
|
||||
SET bytea_output TO escape;
|
||||
SELECT E'\\xDeAdBeEf'::bytea;
|
||||
bytea
|
||||
|
||||
@@ -77,6 +77,10 @@ SELECT E'De\123dBeEf'::bytea;
|
||||
SELECT E'De\\123dBeEf'::bytea;
|
||||
SELECT E'De\\678dBeEf'::bytea;
|
||||
|
||||
SELECT reverse(''::bytea);
|
||||
SELECT reverse('\xaa'::bytea);
|
||||
SELECT reverse('\xabcd'::bytea);
|
||||
|
||||
SET bytea_output TO escape;
|
||||
SELECT E'\\xDeAdBeEf'::bytea;
|
||||
SELECT E'\\x De Ad Be Ef '::bytea;
|
||||
|
||||
Reference in New Issue
Block a user