Re: BUG #18239: select position ('' in 'A') returns 1

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "lucvanlind(dot)en(at)gmail(dot)com" <lucvanlind(dot)en(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18239: select position ('' in 'A') returns 1
Date: 2023-12-10 15:20:03
Message-ID: CAKFQuwY3+nE9QjU0vmyDHw1VAH8SWTJX_noX4QZnXDMjpNVMEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sunday, December 10, 2023, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18239
> Logged by: Luc Van Linden
> Email address: lucvanlind(dot)en(at)gmail(dot)com
> PostgreSQL version: 15.3
> Operating system: windows 10 64 bit
> Description:
>
> We simplified the bug, or maybe undocumented behavior to its simplest
> testcase.
>
> select position ('' in 'A') returns 1
>
> Thus, case a field has an empty string while, checking positions in another
> string, it seems to always fit the position 1.
>
> Not sure if this is intended or not, at least we experience this as a bug.
>
>
Just as an empty set is a subset of all sets the empty string is a
substring within all strings.

I do not believe we document or refer to this external rule anywhere though.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-12-10 16:13:00 Re: BUG #18239: select position ('' in 'A') returns 1
Previous Message jian he 2023-12-10 12:19:57 Re: BUG #18238: Cross-partitition MERGE/UPDATE with delete-preventing trigger leads to incorrect memory access