Re: Bytea question with \208

From: Lew <lew(at)lewscanon(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Bytea question with \208
Date: 2007-08-11 12:35:40
Message-ID: icqdnUlN4v2BMCDbnZ2dnUVZ_ruqnZ2d@comcast.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 a hexadecimal byte value. (It is your responsibility that the byte sequences you create are valid characters in the server character set encoding.)
<http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS>

Amazing how useful the docs are.

--
Lew

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-08-11 12:47:05 Re: why it doesn't work? referential integrity
Previous Message Pavel Stehule 2007-08-11 10:28:45 why it doesn't work? referential integrity