Sample Header Ad - 728x90

Postgresql: ILIKE query with % as search term

0 votes
1 answer
3481 views
I have a JDBC query that performs an ILIKE operation.
select project_name from project_table where project_name ILIKE '%test%';
The above returns all the results matching (wildcarded) the term
. However, when the project_name is
%project_name
and the user searches for just
%
, the query returns all the rows instead of just the matching row. Essentially the query becomes
project_name from project_table where project_name ILIKE '%%%';
I understand the concept of wildcarding in postgresql, but is there a way to just limit the result matching the
%
?
Asked by underachiever (67 rep)
Jan 6, 2022, 02:32 PM
Last activity: Jan 7, 2022, 02:32 AM