I need to search in my column strings which contains ‘
select * from app_user au where au.last_name like '%'%'
but something like that gives me
SQL Error [42601]: Unterminated string literal started at position 55
I tried also ‘%’%’, but it’s not working too, how to escape ‘ in postgres?
2
Answers
You need to double the single quote to get the result
fiddle
As you see in the sample the INSERT needs also a double single quote, but prepare statements with parameters will take the need to double single quote away when inserting or selecting
To escape
'
, you need to add it twice. Use''
to resolve it.