Re: BUG #16333: position() function not equivalent to strpos()function when comparing citext - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #16333: position() function not equivalent to strpos()function when comparing citext
Date
Msg-id CAKFQuwYYnVw_DKFT5mw9AxYMPb0PhHH6HTrA4pN+NSZVFzK4yQ@mail.gmail.com
Whole thread Raw
In response to BUG #16333: position() function not equivalent to strpos() function when comparing citext  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Wednesday, April 1, 2020, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      16333
Logged by:          Tyler Reynolds
Email address:      me@reynolds.tj
PostgreSQL version: 9.6.17
Operating system:   Windows 10
Description:       

To reproduce:

CREATE DATABASE test;
CREATE EXTENSION citext;

SELECT position('foo'::citext IN 'Foobar'::citext) =
strpos('Foobar'::citext, 'foo'::citext) as "positionEqualsStrpos";

Expected: "positionEqualsStrpos" returns TRUE.
Actual: "positionEqualsStrpos" returns FALSE.

Citext does not create an overload for position() supporting citext
parameters, therefore position(a in b) always runs case-sensitive.

Nor does it claim to so this isn’t a bug.  The fact that citext doesn’t work with the SQL functions seems intentional.

David J.

pgsql-bugs by date:

Previous
From: Doug Johnson
Date:
Subject: Postgres Installer not Appearing When Exe Is Run
Next
From: Tom Lane
Date:
Subject: Re: BUG #16333: position() function not equivalent to strpos() function when comparing citext