getting aroung chr(0)

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

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....


James Cloos <[hidden email]>         OpenPGP: 0x997A9F17ED7DAEA6