git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 61ecea4) | patch
Handle empty-string edge cases correctly in strpos().
2019年10月28日 16:21:13 +0000 (12:21 -0400)
2019年10月28日 16:21:13 +0000 (12:21 -0400)
commit bd1ef5799b04168d8a869197dd9b85935d5d5da9
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
src/backend/utils/adt/varlena.c diff | blob | blame | history
src/test/regress/expected/strings.out diff | blob | blame | history
src/test/regress/sql/strings.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /