public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Adrien Nayrat <[email protected]>
Cc: [email protected]
Subject: Re: Text operators "~<=~ ~<~ ~>=~ ~>~" not documented
Date: Thu, 8 Feb 2018 08:32:50 -0700
Message-ID: <CAKFQuwZiuWg5QEk-tN+=Y8JS1cY-xFxe0xZKbMLBh1TM-fSh7w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Thu, Feb 8, 2018 at 6:26 AM, Adrien Nayrat <[email protected]>
wrote:

> Hello,
>
> While reading [1] I notice $subject operators lacks of explanation in
> documentation.
> ​[..]​
>
>
> ~<~     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
>
> ​
I'd be inclined to remove those four operators from the spgist page's table
and replace them with "LIKE".  Then in the text below the table explain
that LIKE is implemented using a combination of those four operators.

If we do add them to the functions and operators chapter it should be in
the pattern matching section:

https://www.postgresql.org/docs/devel/static/functions-matching.html


9.7.1 LIKE needs a table containing [!]~~ and [!]~~* added anyway; tacking
these on as well and noting them as implementation functions (i.e., not
something a user would want to invoke directly typically) would be
appropriate.

David J.


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], [email protected]
  Subject: Re: Text operators "~<=~ ~<~ ~>=~ ~>~" not documented
  In-Reply-To: <CAKFQuwZiuWg5QEk-tN+=Y8JS1cY-xFxe0xZKbMLBh1TM-fSh7w@mail.gmail.com>

* 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