I have a query in Postgres:
SELECT DISTINCT a.profn FROM tprof a, sap_tstc b, tgrc c
WHERE ((c.grcid ~~ a.grcid)
AND ((c.tcode) = (b.tcode)));
What is ~~
mean?
I have a query in Postgres:
SELECT DISTINCT a.profn FROM tprof a, sap_tstc b, tgrc c
WHERE ((c.grcid ~~ a.grcid)
AND ((c.tcode) = (b.tcode)));
What is ~~
mean?
From 9.7.1. LIKE of PostgreSQL documentation:
The operator
~~
is equivalent toLIKE
, and~~*
corresponds toILIKE
. There are also!~~
and!~~*
operators that representNOT LIKE
andNOT ILIKE
, respectively. All of these operators are PostgreSQL-specific.
It isn't listed in the index of the documentation which is frustrating.
So I had a look with psql
:
regress=> \do ~~
List of operators
Schema | Name | Left arg type | Right arg type | Result type | Description
------------+------+---------------+----------------+-------------+-------------------------
pg_catalog | ~~ | bytea | bytea | boolean | matches LIKE expression
pg_catalog | ~~ | character | text | boolean | matches LIKE expression
pg_catalog | ~~ | name | text | boolean | matches LIKE expression
pg_catalog | ~~ | text | text | boolean | matches LIKE expression
(4 rows)
It's an operator alias for LIKE
, that's all.