Re: Can you check in SQL if a fields can be encoded using specified charset

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: Can you check in SQL if a fields can be encoded using specified charset
Дата
Msg-id m2vd3vpt4a.fsf@2ndQuadrant.fr
обсуждение исходный текст
Ответ на Can you check in SQL if a fields can be encoded using specified charset  (Paul Taylor <paul_t100@fastmail.fm>)
Список pgsql-general
Paul Taylor <paul_t100@fastmail.fm> writes:

> Is there a function that can say whether a textvalue can be encoded in a
> particular charset

See convert() and friends here:

  http://www.postgresql.org/docs/9.0/interactive/functions-string.html#FUNCTIONS-STRING-OTHER

That will issue an error when the text can't be converted, but you could
have a plpgsql function catching the exception for you and returning
false. Won't be very fast, but will do the job.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

В списке pgsql-general по дате отправления:

Предыдущее
От: "Marc Mamin"
Дата:
Сообщение: Re: Counting boolean values (how many true, how many false)
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: Adding data from mysql to postgresql periodically