summaryrefslogtreecommitdiff
path: root/src/test/regress/expected/strings.out
diff options
context:
space:
mode:
authorTom Lane2019-10-28 16:21:13 +0000
committerTom Lane2019-10-28 16:21:13 +0000
commitbd1ef5799b04168d8a869197dd9b85935d5d5da9 (patch)
tree857390a02ae564c83a9f951b9a70f656900803fe /src/test/regress/expected/strings.out
parent61ecea45e50bcd3b87d4e905719e63e41d6321ce (diff)
Handle empty-string edge cases correctly in strpos().
Commit 9556aa01c rearranged the innards of text_position() in a way that would make it not work for empty search strings. Which is fine, because all callers of that code special-case an empty pattern in some way. However, the primary use-case (text_position itself) got special-cased incorrectly: historically it's returned 1 not 0 for an empty search string. Restore the historical behavior. Per complaint from Austin Drenski (via Shay Rojansky). Back-patch to v12 where it got broken. Discussion: https://postgr.es/m/CADT4RqAz7oN4vkPir86Kg1_mQBmBxCp-L_=9vRpgSNPJf0KRkw@mail.gmail.com
Diffstat (limited to 'src/test/regress/expected/strings.out')
-rw-r--r--src/test/regress/expected/strings.out18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out
index 24839665765..6d96843e5b5 100644
--- a/src/test/regress/expected/strings.out
+++ b/src/test/regress/expected/strings.out
@@ -1420,6 +1420,24 @@ SELECT strpos('abcdef', 'xy') AS "pos_0";
0
(1 row)
+SELECT strpos('abcdef', '') AS "pos_1";
+ pos_1
+-------
+ 1
+(1 row)
+
+SELECT strpos('', 'xy') AS "pos_0";
+ pos_0
+-------
+ 0
+(1 row)
+
+SELECT strpos('', '') AS "pos_1";
+ pos_1
+-------
+ 1
+(1 row)
+
--
-- test replace
--