colwidth="2*"/>
<thead>
<row>
<entry>Operator/Element</entry>
<entry>Associativity</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><token>.</token></entry>
<entry>left</entry>
<entry>table/column name separator</entry>
</row>
<row>
<entry><token>::</token></entry>
<entry>left</entry>
<entry><productname>PostgreSQL</productname>-style typecast</entry>
</row>
<row>
<entry><token>[</token> <token>]</token></entry>
<entry>left</entry>
<entry>array element selection</entry>
</row>
<row>
<entry><token>+</token> <token>-</token></entry>
<entry>right</entry>
<entry>unary plus, unary minus</entry>
</row>
<row>
<entry><token>COLLATE</token></entry>
<entry>left</entry>
<entry>collation selection</entry>
</row>
<row>
<entry><token>AT</token></entry>
<entry>left</entry>
<entry><literal>AT TIME ZONE</literal>, <literal>AT LOCAL</literal></entry>
</row>
<row>
<entry><token>^</token></entry>
<entry>left</entry>
<entry>exponentiation</entry>
</row>
<row>
<entry><token>*</token> <token>/</token> <token>%</token></entry>
<entry>left</entry>
<entry>multiplication, division, modulo</entry>
</row>
<row>
<entry><token>+</token> <token>-</token></entry>
<entry>left</entry>
<entry>addition, subtraction</entry>
</row>
<row>
<entry>(any other operator)</entry>
<entry>left</entry>
<entry>all other native and user-defined operators</entry>
</row>
<row>
<entry><token>BETWEEN</token> <token>IN</token> <token>LIKE</token> <token>ILIKE</token> <token>SIMILAR</token></entry>
<entry></entry>
<entry>range containment, set membership, string matching</entry>
</row>
<row>
<entry><token><</token> <token>></token> <token>=</token> <token><=</token> <token>>=</token> <token><></token>
</entry>
<entry></entry>
<entry>comparison operators</entry>
</row>
<row>
<entry><token>IS</token> <token>ISNULL</token> <token>NOTNULL</token></entry>
<entry></entry>
<entry><literal>IS TRUE</literal>, <literal>IS FALSE</literal>, <literal>IS
NULL</literal>, <literal>IS DISTINCT FROM</literal>, etc.</entry>
</row>
<row>
<entry><token>NOT</token></entry>
<entry>right</entry>
<entry>logical negation</entry>
</row>
<row>
<entry><token>AND</token></entry>
<entry>left</entry>
<entry>logical conjunction</entry>
</row>
<row>
<entry><token>OR</token></entry>
<entry>left</entry>
<entry>logical disjunction</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Note that the operator precedence rules also apply to user-defined
operators that have the same names as the built-in operators
mentioned above. For example, if you define a
<quote>+</quote> operator for some custom data type it will have
the same precedence as the built-in <quote>+</quote> operator, no
matter what yours does.
</para>
<para>
When a schema-qualified operator name is used in the
<literal>OPERATOR</literal> syntax, as for example in:
<programlisting>
SELECT 3 OPERATOR(pg_catalog.+) 4;
</programlisting>
the <literal>OPERATOR</literal> construct is taken to have the default precedence
shown in <xref linkend="sql-precedence-table"/> for
<quote>any other operator</quote>. This is true no matter
which specific operator appears inside <literal>OPERATOR()</literal>.
</para>
<note>
<para>
<productname>PostgreSQL</productname> versions before 9.5 used slightly different
operator precedence rules. In particular, <token><=</token>