Thread: BLOBS and PostgreSQL

BLOBS and PostgreSQL

From
"Paulo Parola"
Date:
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