Page 1 of 1

blob fields limit ? or record limit ?

Posted: Wed 05 Jan 2011 08:33
by carlonarcisi
I have a table where I memorize the files. There is clearly a blob field where I store the file.
I read that the limit of postgres is 2gig byte blob field. I get an error "out of memory " on the POST command after adding the command:
TBlobField (PgAdd.FieldByName ('FileStream')). LoadFromFile (AFilename);
a file size of 500 mega bytes.
that it limits your component?

best regards
carlo narcisi

Posted: Wed 05 Jan 2011 13:41
by AlexP
Hello,

Thank you for the information.
We have reproduced the problem.
We will notify you as soon as we have any results.

Posted: Thu 06 Jan 2011 08:44
by AlexP
Hello,

To resolve the problem you should use the 'OID' field type to store large amounts of data, because if you use the 'bytea' field type the data conversion to string with the special format (http://www.postgresql.org/docs/8.2/stat ... inary.html), and the size of data will increase.
So to store large amounts of data you can use the following code:

CREATE TABLE big_oid
(
id integer,
img oid
)

PgConnection.StartTransaction;
PgQuery.Open;
PgQuery.Append;
PgQuery.FieldByName('id').AsInteger:= 1;
TBlobField(PgQuery.FieldByName('img')).LoadFromFile('your_big_file');
PgQuery.Post;
PgConnection.Commit;

Posted: Thu 27 Jan 2011 06:40
by carlonarcisi
great
works !
thanks a lot

Posted: Thu 27 Jan 2011 07:41
by AlexP
Hello,

It is good to see that this problem was solved. If any other questions come up, please contact us.