PostgreSQL 18 reference · String Functions

PostgreSQL ILIKE and LIKE Operators

Match a string against a LIKE pattern ignoring case: % matches any text and _ one character. ~~* is the operator form.

PostgreSQL 18

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

string ILIKE pattern  |  string LIKE pattern

Parameters

ParameterDescription
string The input text.
pattern % any characters, _ one character; ESCAPE sets an escape character.

Return value

boolean.

Examples

Case-insensitive search
SELECT name FROM products WHERE name ILIKE '%desk%';

Output

       name
-------------------
 Desk Lamp
 Standing Desk Mat
(2 rows)

Run this on your computer — see “Get Started” for setup.

LIKE is case-sensitive
SELECT 'Desk' LIKE 'd%' AS with_like, 'Desk' ILIKE 'd%' AS with_ilike;

Output

 with_like | with_ilike
-----------+------------
 f         | t
(1 row)

Run this on your computer — see “Get Started” for setup.

In other languages

Was this page helpful?