June 28th, 2012, 10:23 AM
LIKE operator doesn't work in TEXT columns
I don't know if I'm missing something because I'm relatively new to PostgreSQL, but here it is:
I have a TEXT column in a table. One of the rows has the value 'texto' in this column. So I'm trying to show this row with queries like these:
and no rows are returned.
SELECT * FROM TABELA WHERE TEXT_COLUMN LIKE '%texto%'
SELECT * FROM TABELA WHERE TEXT_COLUMN LIKE 'texto%'
SELECT * FROM TABELA WHERE TEXT_COLUMN LIKE '%texto'
What am I doing wrong? Doesn't we use the LIKE operator to search in TEXT columns in PostgreSQL?
June 28th, 2012, 01:32 PM
It was related to Hibernate, not Postgre. I just removed the @Lob annotation in the property and Hibernate saved the correct value in the column. Now the LIKE operator works as expected.