Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jK6q5-00087J-Du for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Apr 2020 20:53:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jK6q4-0000ry-AD for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Apr 2020 20:53:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jK6q3-0000qU-BL for pgsql-bugs@lists.postgresql.org; Thu, 02 Apr 2020 20:53:24 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jK6q0-0003Z4-P0 for pgsql-bugs@lists.postgresql.org; Thu, 02 Apr 2020 20:53:22 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7EE895C01CC; Thu, 2 Apr 2020 16:53:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 02 Apr 2020 16:53:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=lQR2lW1jegnaMnl5mlL5CULjIeJ3MHzz1y9n5B6qK Oo=; b=Yqz7Kg3z4XiKQXz1JN4HR5PRDQOLTDE4xhcruHoEd0nKe2b5fyd0nYgFf MvVPahYsn8iWGRu/FtClD4zwseqLfHhuOgqnGzg/50HfRb9ikF1ECWHfiQhqRsF4 YlWRhFMYrHrZx2rDNHPGCpma42pCie0PE7GfxPJ0ckK4vnlM+GRLJtvo90fH5E7A nqWRiYfbQuJ6urHVvYVCRXctW4e/Pr4rvinAdqydVJn5jYUU0K4m4M7WHiCS3GHL H7ClTXjsVgJWspQ9ncjG4LAojhnvQy9CFm9sazVnVhdWAMeADcy0uNlvQnc58rsy jP9VCHOE8dj2A6sbCprDldrI8Xndw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdeggddugeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhfhokffffgggjggtgfesth ejredttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgv rhdrvghishgvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhmqeenucffohhmrg hinhepvdhnughquhgrughrrghnthdrtghomhenucfkphepleefrddvgedvrddvudefrddv gedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepph gvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm X-ME-Proxy: Received: from april.pezone.net (p5df2d5f1.dip0.t-ipconnect.de [93.242.213.241]) by mail.messagingengine.com (Postfix) with ESMTPA id 05325306CEB0; Thu, 2 Apr 2020 16:53:17 -0400 (EDT) Subject: Re: BUG #16333: position() function not equivalent to strpos() function when comparing citext To: Tom Lane , me@reynolds.tj References: <16333-dd25eea9d90e244d@postgresql.org> <12376.1585789484@sss.pgh.pa.us> Cc: pgsql-bugs@lists.postgresql.org From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <9817af55-fbe4-b342-b641-637f1308ef96@2ndquadrant.com> Date: Thu, 2 Apr 2020 22:53:17 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <12376.1585789484@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-04-02 03:04, Tom Lane wrote: > PG Bug reporting form writes: >> SELECT position('foo'::citext IN 'Foobar'::citext) = >> strpos('Foobar'::citext, 'foo'::citext) as "positionEqualsStrpos"; > >> Citext does not create an overload for position() supporting citext >> parameters, therefore position(a in b) always runs case-sensitive. > > Well, the citext documentation specifies which functions have > case-insensitive mappings. strpos() is listed, position() is not, > so I'd say it's acting precisely as documented. Arguably, there is a misdesign here, however. Any function that does some kind of text-in-text search where citext could plausbily offer case-insensitive behavior will automatically fall back to the case-sensitive version if citext doesn't offer its own variant. The fix would technically need to be that citext offers its own variant of every potential such function, which is clearly not possible, or that casts between text and citext are more restricted, which would make citext nearly unusable. Doesn't seem fixable. Collations are probably a better way of dealing with this. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services