Re: Using TEXT columns for binary content - Mailing list pgsql-general

From Joe Conway
Subject Re: Using TEXT columns for binary content
Date
Msg-id 3EA415D4.5090807@joeconway.com
Whole thread Raw
In response to Using TEXT columns for binary content  ("Mircea Sarbu" <msarbu@agora.ro>)
Responses Re: Using TEXT columns for binary content  (Lamar Owen <lamar.owen@wgcr.org>)
Re: Using TEXT columns for binary content  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-general by date:

Previous
From: Chris Gamache
Date:
Subject: Re: DBI & DBD::Pg processor load
Next
From: Murthy Kambhampaty
Date:
Subject: Re: stddev returns 0 when there is one row