Обсуждение: getting aroung chr(0)

Поиск
Список
Период
Сортировка

getting aroung chr(0)

От
James Cloos
Дата:
Is there a better way to do this:

 select (case
         when octet_length(n) > 0
         then chr(octet_length(n))::bytea
         else '\x00'
         end) || n from some_table;

some_table.n may contain values like ''::text,
but some_table.n is not null.

Obviously, a function like chr() which returns bytea
rather than text would be ideal, but lacking one....

Thanks,

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6