Re: Toast,bytea, Text -blob all confusing

From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: Alex Pilosov <alex(at)pilosoft(dot)com>, jason(dot)ory(at)ndchealth(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Toast,bytea, Text -blob all confusing
Date: 2001-08-28 06:28:24
Message-ID: 3.0.5.32.20010828142824.010865b0@192.228.128.13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 03:05 PM 27-08-2001 -0400, Alex Pilosov wrote:
>On Thu, 23 Aug 2001 jason(dot)ory(at)ndchealth(dot)com wrote:
>
>> THIS IS WHAT I CANT SEEM TO FIGURE OUT IN POSTGRESQL
>> 1. I cant get a clear answer on what kind of data type to use for my large
>> text string? TEXT, ???, ??? or something about TOAST
>> I have seen in the e-mail archive but cant find any documentaion?
>I would suggest bytea or blob. Blobs are well-documented in normal
>documentation and in documentation of your favorite interface, so I'll
>just talk about bytea.
>
>> 2. I've written my own escape method ,("cant find one for Pgsql") , BUT i
>> don't know what
>> to escape and not to escape. So it keeps failing. I cand find any docs. on
>> what to escape either?
>For bytea, follow this rule: to escape a null character, use this:
>'\\0'. To escape a backslash, use this: '\\\\'.
>
>Same idea to unescape data.

Are there other characters that need to be escaped? I suspect there are
more characters that need to be escaped - ctrl chars? single quotes?. Why
four backslashes for one? Is there a definitive documentation anywhere for
what bytea is _supposed_ (not what it might actually be) to be and how it
is to be handled?

Also why wouldn't escaping stuff like this work with TEXT then? If a null
is going to be backslash backslash zero, and come out the same way, it sure
looks like TEXT to me :). OK so there's this thing about storage. So maybe
I could save a byte by just converting nulls to backslash zero and real
backslashes to backslash backslash. Tada.

OK it's probably not the same, but having to put four backslashes when two
should be enough to quote one makes me rather puzzled and uneasy.

Cheerio,
Link.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Mattarollo 2001-08-28 08:58:32 7.1.3, IRIX 6.5 and gcc
Previous Message Tom Lane 2001-08-28 04:06:27 Re: Re: Link to bug webpage