BUG #5092: to_ascii(); ascii() don't work with bytea
BUG #5092: to_ascii(); ascii() don't work with bytea
От:
"Dan French" <Bomarc_com@yahoo.com>
Дата:
The following bug has been logged online:
Bug reference: 5092
Logged by: Dan French
Email address: Bomarc_com@yahoo.com
PostgreSQL version: 8.4
Operating system: Windows 2003
Description: to_ascii(); ascii() don't work with bytea
Details:
Version 8.4
#1: bytea_string = '"0"' (table; bytea)
Function:
trim('"' both from bytea_string)
fails and returns: '"0'
#2: Come on folks: Bytea is a series of bytes. Conversion to ASCII is not
this difficult; and should (does) not require explicit type casts (esp since
they are already in ASCII)
SELECT ID, details_map,
--date_part('hour', interval
-- cast (
trim(both '"' from
to_ascii (
encode(convert_to(
{bytea starts here}
substring(...))...
Result (variations) include:
ERROR: function ascii(bytea) does not exist
ERROR: function convert_to(bytea) does not existRe: BUG #5092: to_ascii(); ascii() don't work with bytea
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
On Fri, 2009-10-02 at 02:17 +0000, Dan French wrote:
> #1: bytea_string = '"0"' (table; bytea)
> Function:
> trim('"' both from bytea_string)
> fails and returns: '"0'
Works for me. Please submit a complete test case.
> #2: Come on folks: Bytea is a series of bytes. Conversion to ASCII is not
> this difficult; and should (does) not require explicit type casts (esp since
> they are already in ASCII)
Converting between data types that have different semantics should
always requires an explicit cast. This is to protect against accidental
misinterpretation. There is ample discussion about that in the
archives.