Re: Using TEXT columns for binary content

From: Joe Conway <mail(at)joeconway(dot)com>
To: Mircea Sarbu <msarbu(at)agora(dot)ro>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using TEXT columns for binary content
Date: 2003-04-21 16:01:24
Message-ID: 3EA415D4.5090807@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mircea Sarbu wrote:
> There are some hidden drawbacks for this approach? (I don't need any further
> processing on the binary content)
>

There are people who have reported using this method successfully on the
Postgres lists. Only downsides I can think of are:

1) You have to encode to base64 on the way in (bytea has to be escaped
on INSERT/UPDATE too)
2) You have to decode to binary on the way out (depending on your
middleware, you can use a binary cursor for bytea and avoid the
decode on SELECT)
3) The on disk representation is about 33% bigger compared to bytea
4) TEXT datatype is subject to being multibyte encoded -- I don't think
this affects the characters in the base64 set, but I'm not sure there
won't be any undesireable interactions. If you are using other than
'C' locale, test carefully.

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Murthy Kambhampaty 2003-04-21 16:05:12 Re: stddev returns 0 when there is one row
Previous Message Steve Wampler 2003-04-21 15:45:12 Re: Are we losing momentum?