Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ejmDi-0007FW-Sx for pgsql-docs@arkaria.postgresql.org; Thu, 08 Feb 2018 13:26:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejmDg-00029k-En for pgsql-docs@arkaria.postgresql.org; Thu, 08 Feb 2018 13:26:32 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ejmDg-00029a-4K for pgsql-docs@lists.postgresql.org; Thu, 08 Feb 2018 13:26:32 +0000 Received: from mimolette.dalibo.net ([212.85.157.144] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ejmDY-0007bc-R9 for pgsql-docs@postgreSQL.org; Thu, 08 Feb 2018 13:26:30 +0000 Received: from [192.168.1.14] (LFbn-LYO-1-593-46.w90-119.abo.wanadoo.fr [90.119.170.46]) by mail.dalibo.com (Postfix) with ESMTPSA id 8538C2C0236 for ; Thu, 8 Feb 2018 14:26:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1518096381; bh=vqP6KI5yJG7LLQ0bQ5AVjvFRTbu3kp8X5X+Rv7XQkeQ=; h=From:Subject:To:Date:From; b=PiWv7oo8yQlVRM03mMjaTud2P3bJHavnkYReUGpSX9+sXX5hjSrK7+8RPeJJ2R5/S 5dddTF9tIxS9zIJLHSjG8LETNeGkSpwinQldfHXhxXLbqQfQSi6/CnrKuv1qMTQUjI zcPjCNMURG98pshYL2XsQgP7sPKvGR6ZAx4YZxts= From: Adrien Nayrat Subject: Text operators "~<=~ ~<~ ~>=~ ~>~" not documented To: pgsql-docs@postgreSQL.org Message-ID: <92d30118-9933-3674-a95b-f84c97abde6c@dalibo.com> Date: Thu, 8 Feb 2018 14:26:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wagiRdHMhCk4jMSHwRtLBUDfKZImzlkTn" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wagiRdHMhCk4jMSHwRtLBUDfKZImzlkTn Content-Type: multipart/mixed; boundary="RgE0fOaQYZjZO0rb7XpaZwsrjTUvvVCpd"; protected-headers="v1" From: Adrien Nayrat To: pgsql-docs@postgreSQL.org Message-ID: <92d30118-9933-3674-a95b-f84c97abde6c@dalibo.com> Subject: Text operators "~<=~ ~<~ ~>=~ ~>~" not documented --RgE0fOaQYZjZO0rb7XpaZwsrjTUvvVCpd Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hello, While reading [1] I notice $subject operators lacks of explanation in documentation. They where introduced in this commit : commit 2c0556068fc308ed9cce06c85de7e42305d34b86 Author: Peter Eisentraut Date: Thu May 15 15:50:21 2003 +0000 Indexing support for pattern matching operations via separate operato= r class when lc_collate is not C Comment from this commit : /* * The following operators support character-by-character comparison * of text data types, to allow building indexes suitable for LIKE * clauses. */ So if I understand correctly : ~<~ less than ~>~ greater than ~<=3D~ less than or equal to ~>=3D~ greater than or equal to For all, it is a character-by-character comparison regardless of collatio= n. We encounter them when we use text_pattern_ops for example : create index ON users ( location text_pattern_ops); explain select * from users where location like 'test%'; QUERY PLAN -------------------------------------------------------------------------= ----------- Index Scan using users_location_idx1 on users (cost=3D0.43..2.46 rows=3D= 54 width=3D201) Index Cond: ((location ~>=3D~ 'test'::text) AND (location ~<~ 'tesu'::= text)) Filter: (location ~~ 'test%'::text) (3 lignes) Should we add them on this page? https://www.postgresql.org/docs/devel/static/functions-string.html Thanks! 1: https://www.postgresql.org/docs/current/static/spgist-builtin-opclasse= s.html --=20 Adrien NAYRAT http://dalibo.com - http://dalibo.org --RgE0fOaQYZjZO0rb7XpaZwsrjTUvvVCpd-- --wagiRdHMhCk4jMSHwRtLBUDfKZImzlkTn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEm0vCLGPoatLA5LoUsupItzJ4s38FAlp8UBkACgkQsupItzJ4 s3+WyAf/UCwRg1pxKZdkji1l4vQORTm7xxPqFrcbFZz5ajdjjVQSo6DcIEhFL5+M WSNFBOjbo/NmC1q+wbKIPgg8sgnq9GSdZjSETX+5my5uDkCzQpyLeBiNoLpEDUur sTi616AdXQZX8FmyspWNPe+iPA7bWXJuybPSLqC/GsvmAu0CIrrgteIcrfB4vyoO JheaeF8z7qSZAuM08FIwne28HN0haAgdS/qKLOzptPwtRwVVm2YaQe1zSkeqk8ee aRTVMx2euup8wQUBg/0U2zMCTkiTk0Yggf0eZpJcOLgTM3Md4cXTmR5eAJdZ03/V fqJOLqYekmOx6il1LgxyAM0ivuXkhg== =vcfq -----END PGP SIGNATURE----- --wagiRdHMhCk4jMSHwRtLBUDfKZImzlkTn--