getting aroung chr(0) - Mailing list pgsql-sql

From James Cloos
Subject getting aroung chr(0)
Date
Msg-id m3zh4vxj6w.fsf@carbon.jhcloos.org
Whole thread Raw
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: send query in background
Next
From: Iuri Sampaio
Date:
Subject: total and partial sums in the same query??