Re: Store base64 in database. Use bytea or text?

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Andre Lopes <lopes80andre(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: Store base64 in database. Use bytea or text?
Date: 2011-01-25 22:31:33
Message-ID: 20110125173133.a28ad8ea.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Andre Lopes <lopes80andre(at)gmail(dot)com>:
>
> I need to put some images on Base64 in a PostgreSQL database. Wich
> type should I use and what is the difference between using bytea or
> text to store Base64?

bytea is overkill if you know for sure that the data will always be
base64. Aside from that, I don't know of any particular advantage
either way. Since the data isn't really text, your locale isn't
really going to come into play (i.e., it's not like you're going to
sort the data or anything). Since the data isn't binary, you won't
have to worry about escaping anything.

Personally, I'd use text.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2011-01-25 22:33:44 Re: Store base64 in database. Use bytea or text?
Previous Message Andre Lopes 2011-01-25 22:27:28 Store base64 in database. Use bytea or text?