Re: Bytea question with \208 - Mailing list pgsql-general

From Lew
Subject Re: Bytea question with \208
Date
Msg-id icqdnUlN4v2BMCDbnZ2dnUVZ_ruqnZ2d@comcast.com
Whole thread Raw
In response to Re: Bytea question with \208  (Decibel! <decibel@decibel.org>)
List pgsql-general
Decibel! wrote:
> On Thu, Aug 09, 2007 at 04:16:15PM -0400, Woody Woodring wrote:
>> My bad,  the table I was looking (8.7) at had the first column as the
>> decimal representation and I did notice that the numbers changed as they
>> moved right.
>>
>> Is there a way for bytea to take a hex number, or do I need to convert the
>> bit stream to octal numbers?
>
> to_hex()?

to_hex() produces the text representation of the hex digits, not the actual
bytes with those values.

What the OP wants is to conveniently represent the bytestream to send to the
bytea column.  They're looking for an escape sequence to embed into a text
representation that will map to the exact byte contents to insert, not a text
representation of that representation.

Say,
> Also supported are \digits, where digits represents an octal byte value, and \xhexdigits, where hexdigits represents
ahexadecimal byte value. (It is your responsibility that the byte sequences you create are valid characters in the
servercharacter set encoding.) 
<http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS>

Amazing how useful the docs are.

--
Lew

pgsql-general by date:

Previous
From: Torsten Zühlsdorff
Date:
Subject: Re: Persistent connections in PHP
Next
From: Lew
Date:
Subject: Re: Trigger Procedure Error: NEW used in query that is not in a rule