Re: BYTEA

From: "Timur V(dot) Irmatov" <itvthor(at)sdf(dot)lonestar(dot)org>
To: Jeff Davis <list-pgsql-general(at)empires(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: BYTEA
Date: 2002-09-20 08:46:52
Message-ID: 4711474229.20020920134652@sdf.lonestar.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff!

Friday, September 20, 2002, 1:24:28 PM, You wrote:

JD> I don't really see a way postgres could do it any better, since the queries
JD> and results are both strings, so there have to be rules about what a string
JD> might include. Base64 works nicely because it's fairly compact, and all
JD> "safe" text.

Hm.. If i have a varchar field then if I want to insert a string
some'tex\t into it, I quote it like that: 'some\'tex\\t' .. but if I
want to insert the same into bytea field I must quote it more:
'some\\'tex\\\\' .. why ???

JD> On Friday 20 September 2002 12:57 am, Timur V. Irmatov wrote:
>> Hi, people!
>>
>> I've used PostgreSQL for few months and it fully satisfies my needs.
>>
>> Now I'm starting to explore BYTEA type (for storing small 1-5 Kb png
>> images) and found it very cumbersome.
>>
>> I'd like to hear background explanation of why strings used as bytea
>> literals pass two phases of parsing? it seems very odd to me to escape
>> backslash two times (like that: '\\\\' ) just to insert it into
>> string.. It adds more complexity to apps, forcing it encode/decode
>> those literals..
>>
>> I think it would be enough to quote it like any other string, just for
>> parser to understand it correctly, and insert into table. Bytea is
>> binary data by it's nature, why to quote it when I perform selects?
>> I'm not going to show it to humans, it is just data for my
>> application.
>>
>> And if bytea really is displayed to a human then translating value into
>> readable form (quote non-printable characters etc.) is a task of the
>> application (psql, my app ..) but not PostgreSQL backend's.
>>
>> Any comments?
>>
>> Timur.
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 6: Have you searched our list archives?
>>
>> http://archives.postgresql.org

JD> ---------------------------(end of broadcast)---------------------------
JD> TIP 6: Have you searched our list archives?

JD> http://archives.postgresql.org

Sincerely Yours,
Timur
mailto:itvthor(at)sdf(dot)lonestar(dot)org

In response to

  • Re: BYTEA at 2002-09-20 08:24:28 from Jeff Davis

Responses

  • Re: BYTEA at 2002-09-20 09:15:13 from Richard Huxton
  • Re: BYTEA at 2002-09-20 10:42:44 from Jeff Davis

Browse pgsql-general by date

  From Date Subject
Next Message Frank Joerdens 2002-09-20 08:53:24 Re: RES: PHP + PostgreSQL
Previous Message Jeff Davis 2002-09-20 08:24:28 Re: BYTEA