Re: strpos behavior change around empty substring in PG12 - Mailing list pgsql-hackers

From Robert Haas
Subject Re: strpos behavior change around empty substring in PG12
Date
Msg-id CA+TgmoYioeMyZ61th2mUoRj00Eh1uwTQQMWqZVYKdLx+jbYQmw@mail.gmail.com
Whole thread Raw
In response to strpos behavior change around empty substring in PG12  (Shay Rojansky <roji@roji.org>)
Responses Re: strpos behavior change around empty substring in PG12
List pgsql-hackers
On Mon, Oct 28, 2019 at 11:02 AM Shay Rojansky <roji@roji.org> wrote:
> Before PG12, select strpos('test', '') returns 1 (empty substring found at first position of the string), whereas
startingwith PG12 it returns 0 (empty substring not found).
 
>
> Is this behavior change intentional? If so, it doesn't seem to be documented in the release notes...
>
> First raised by Austin Drenski in https://github.com/npgsql/efcore.pg/pull/1068#issuecomment-546795826

It looks to me like this got broken here:

commit 9556aa01c69a26ca726d8dda8e395acc7c1e30fc
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:   Fri Jan 25 16:25:05 2019 +0200

    Use single-byte Boyer-Moore-Horspool search even with multibyte encodings.

Not sure what happened exactly.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'
Next
From: "postgresql_2016@163.com"
Date:
Subject: Re: TOAST corruption in standby database