diff options
author | David Rowley <drowley@postgresql.org> | 2025-03-24 19:32:02 +1300 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2025-03-24 19:32:02 +1300 |
commit | 35a92b7c2520cca3df9ecddab1dcad14ff71ec0b (patch) | |
tree | 9545e1cc99d17a892ac1789e439a0389cfcc6893 /src | |
parent | 2a0cd38da5ccf70461c51a489ee7d25fcd3f26be (diff) | |
download | postgresql-35a92b7c2520cca3df9ecddab1dcad14ff71ec0b.tar.gz postgresql-35a92b7c2520cca3df9ecddab1dcad14ff71ec0b.zip |
Add tests for POSITION(bytea, bytea)
Previously there was no coverage for this function.
Author: Aleksander Alekseev <aleksander@timescale.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Rustam ALLAKOV <rustamallakov@gmail.com>
Discussion: https://postgr.es/m/CAJ7c6TMT6XCooMVKnCd_tR2oBdGcnjefSeCDCv8jzKy9VkWA5w@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/strings.out | 30 | ||||
-rw-r--r-- | src/test/regress/sql/strings.sql | 6 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out index fbe7d7be71f..dc485735aa4 100644 --- a/src/test/regress/expected/strings.out +++ b/src/test/regress/expected/strings.out @@ -1353,6 +1353,36 @@ SELECT POSITION('5' IN '1234567890') = '5' AS "5"; t (1 row) +SELECT POSITION('\x11'::bytea IN ''::bytea) = 0 AS "0"; + 0 +--- + t +(1 row) + +SELECT POSITION('\x33'::bytea IN '\x1122'::bytea) = 0 AS "0"; + 0 +--- + t +(1 row) + +SELECT POSITION(''::bytea IN '\x1122'::bytea) = 1 AS "1"; + 1 +--- + t +(1 row) + +SELECT POSITION('\x22'::bytea IN '\x1122'::bytea) = 2 AS "2"; + 2 +--- + t +(1 row) + +SELECT POSITION('\x5678'::bytea IN '\x1234567890'::bytea) = 3 AS "3"; + 3 +--- + t +(1 row) + -- T312 character overlay function SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f"; abc45f diff --git a/src/test/regress/sql/strings.sql b/src/test/regress/sql/strings.sql index ed054e6e99c..aeba798dac1 100644 --- a/src/test/regress/sql/strings.sql +++ b/src/test/regress/sql/strings.sql @@ -367,6 +367,12 @@ SELECT POSITION('4' IN '1234567890') = '4' AS "4"; SELECT POSITION('5' IN '1234567890') = '5' AS "5"; +SELECT POSITION('\x11'::bytea IN ''::bytea) = 0 AS "0"; +SELECT POSITION('\x33'::bytea IN '\x1122'::bytea) = 0 AS "0"; +SELECT POSITION(''::bytea IN '\x1122'::bytea) = 1 AS "1"; +SELECT POSITION('\x22'::bytea IN '\x1122'::bytea) = 2 AS "2"; +SELECT POSITION('\x5678'::bytea IN '\x1234567890'::bytea) = 3 AS "3"; + -- T312 character overlay function SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f"; |