1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

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
This commit is contained in:
David Rowley
2025-03-24 19:32:02 +13:00
parent 2a0cd38da5
commit 35a92b7c25
2 changed files with 36 additions and 0 deletions

View File

@ -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

View File

@ -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";