Re: PQescapeBytea is not multibyte aware

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org, Thomas Lockhart <lockhart(at)fourpalms(dot)org>
Subject: Re: PQescapeBytea is not multibyte aware
Date: 2002-04-05 22:58:41
Message-ID: 3CAE2C21.1030308@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
>> Yuck! At that point you're no better off than converting to hex
>> (and worse off than converting to base64) for storage.
>
>
> No; the *storage* is still compact, it's just the I/O representation
> that's not.

Yeah, I realized that after I pushed send ;)

But still, doesn't that mean roughly twice as much memory usage for each
copy of the string? And I seem to remember Jan saying that each datum
winds up having 4 copies in memory. It ends up impacting the practical
length limit for a bytea value.

>
>
>> SQL99 actually defines BLOB as a binary string literal comprised
>> of an even number of hexadecimal digits, in single quotes,
>> preceded by "X", e.g. X'1a43fe'. Should we be looking at
>> implementing the standard instead of, or in addition to,
>> octalizing?
>
>
> Perhaps we should cause the system to regard hex-strings as literals
> of type bytea. Right now I think they're taken to be integer
> constants, which is clearly not per spec.

Wow. I didn't realize this was possible:

test=# select X'ffff';
?column?
----------
65535
(1 row)

This does clearly conflict with the spec, but what about backward
compatibility? Do you think many people use this capability?

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-04-05 23:11:18 Re: Debugging symbols by default
Previous Message Hiroshi Inoue 2002-04-05 22:58:00 Re: What's the CURRENT schema ?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2002-04-05 23:18:19 Re: 16 parameter limit
Previous Message Josh Berkus 2002-04-05 22:29:14 Re: 16 parameter limit