Skip to content

Commit 51ba697

Browse files
author
Commitfest Bot
committed
[CF 5603] v2 - Cover POSITION(bytea,bytea) with tests
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5603 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/CAJ7c6TMHjxMaTq3o7tJH2SXXRkiakqXqWZMxwXyaHWpTAnQSrg@mail.gmail.com Author(s): Aleksander Alekseev
2 parents ca3067c + ea626d9 commit 51ba697

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/test/regress/expected/strings.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,36 @@ SELECT POSITION('5' IN '1234567890') = '5' AS "5";
13531353
t
13541354
(1 row)
13551355

1356+
SELECT POSITION('\x11'::bytea IN ''::bytea) = 0 AS "0";
1357+
0
1358+
---
1359+
t
1360+
(1 row)
1361+
1362+
SELECT POSITION('\x33'::bytea IN '\x1122'::bytea) = 0 AS "0";
1363+
0
1364+
---
1365+
t
1366+
(1 row)
1367+
1368+
SELECT POSITION(''::bytea IN '\x1122'::bytea) = 1 AS "1";
1369+
1
1370+
---
1371+
t
1372+
(1 row)
1373+
1374+
SELECT POSITION('\x22'::bytea IN '\x1122'::bytea) = 2 AS "2";
1375+
2
1376+
---
1377+
t
1378+
(1 row)
1379+
1380+
SELECT POSITION('\x5678'::bytea IN '\x1234567890'::bytea) = 3 AS "3";
1381+
3
1382+
---
1383+
t
1384+
(1 row)
1385+
13561386
-- T312 character overlay function
13571387
SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
13581388
abc45f

src/test/regress/sql/strings.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ SELECT POSITION('4' IN '1234567890') = '4' AS "4";
367367

368368
SELECT POSITION('5' IN '1234567890') = '5' AS "5";
369369

370+
SELECT POSITION('\x11'::bytea IN ''::bytea) = 0 AS "0";
371+
SELECT POSITION('\x33'::bytea IN '\x1122'::bytea) = 0 AS "0";
372+
SELECT POSITION(''::bytea IN '\x1122'::bytea) = 1 AS "1";
373+
SELECT POSITION('\x22'::bytea IN '\x1122'::bytea) = 2 AS "2";
374+
SELECT POSITION('\x5678'::bytea IN '\x1234567890'::bytea) = 3 AS "3";
375+
370376
-- T312 character overlay function
371377
SELECT OVERLAY('abcdef' PLACING '45' FROM 4) AS "abc45f";
372378

0 commit comments

Comments
 (0)