public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrien Nayrat <[email protected]>
To: [email protected]
Subject: Text operators "~<=~ ~<~ ~>=~ ~>~" not documented
Date: Thu, 8 Feb 2018 14:26:49 +0100
Message-ID: <[email protected]> (raw)

Hello,

While reading [1] I notice $subject operators lacks of explanation in
documentation.


They where introduced in this commit :

commit 2c0556068fc308ed9cce06c85de7e42305d34b86
Author: Peter Eisentraut <[email protected]>
Date:   Thu May 15 15:50:21 2003 +0000

    Indexing support for pattern matching operations via separate operator
    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
~<=~ 	less than or equal to
~>=~ 	greater than or equal to

For all, it is a character-by-character comparison regardless of collation. 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=0.43..2.46 rows=54 width=201)
   Index Cond: ((location ~>=~ '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-opclasses.html


-- 
Adrien NAYRAT

http://dalibo.com - http://dalibo.org



Attachments:

  [application/pgp-signature] signature.asc (488B, 2-signature.asc)
  download

view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Text operators "~<=~ ~<~ ~>=~ ~>~" not documented
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox