Re: strpos behavior change around empty substring in PG12

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Shay Rojansky <roji(at)roji(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: strpos behavior change around empty substring in PG12
Date: 2019-10-28 15:48:49
Message-ID: CA+TgmoYioeMyZ61th2mUoRj00Eh1uwTQQMWqZVYKdLx+jbYQmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 28, 2019 at 11:02 AM Shay Rojansky <roji(at)roji(dot)org> wrote:
> Before PG12, select strpos('test', '') returns 1 (empty substring found at first position of the string), whereas starting with 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(dot)linnakangas(at)iki(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message postgresql_2016@163.com 2019-10-28 15:57:04 Re: TOAST corruption in standby database
Previous Message Stephen Frost 2019-10-28 15:47:54 Re: BUG #16079: Question Regarding the BUG #16064