BLOBS and PostgreSQL

Started by Paulo Parolaover 26 years ago1 messagesgeneral
Jump to latest
#1Paulo Parola
pparola@brazilinfo.com

Hi,

I need to create a table to store images (BLOBs - binary large objects) in
PostgreSQL as I would do in MySQL like below:

create table images (
id INT NOT NULL PRIMARY KEY,
image BLOB
);

MySQL has actually 4 different types for a BLOB, as below:

TINYBLOB, TINYTEXT L+1 bytes, where L < 2^8
BLOB, TEXT L+2 bytes, where L < 2^16
MEDIUMBLOB, MEDIUMTEXT L+3 bytes, where L < 2^24
LONGBLOB, LONGTEXT L+4 bytes, where L < 2^32

Which types in PostgreSQL should I use for this purpose (storing BLOBs)?
text? varchar(n)? Documentation for PostgreSQL is unfortunately really poor
if compared to MySQL...

TIA,
Paulo