select * from table_name where column_name ~ '^\s+|\s+$';