When i'm trying to convert from unicode to utf8 in the code below "function convert_from(character varying, unknown) does not exist" error occurs.
select convert_from(artists, 'UTF8') from songs where
to_tsvector('simple',convert_from(artists, 'UTF8'))
@@ plainto_tsquery('simple','alizee')
limit 100
Column "artists" has "TEXT" type.
But when I'm running
select convert_from(E'\u0422\u0438\u043c\u0430\u0442\u0438', 'UTF8');
it works well.
How can I resolve this problem? I would appreciate any help. Thanks
From documentation: convert_from(string bytea, src_encoding name)
.
So cast artists to bytea:
select convert_from(artists::bytea, 'UTF8') from songs where
to_tsvector('simple',convert_from(artists, 'UTF8'))
@@ plainto_tsquery('simple','alizee')
limit 100
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With