Ben Everard
Ben Everard

Reputation: 13804

Where does pg_lo_write store its contents?

There is a function in our system that writes a file to a postgres BLOB, the function is pg_lo_write, our system uses PHP, ADODB and PostgreSQL.

What I would like to know is where is this data stored, is it a file in a postgres directory, in a table?

Many thanks!

Answer Information

Thanks to Ben Fransen for the answer, the BLOB is in fact stored in the pg_largeobject table. I'm using pgAdmin and the table is hidden from view, however it can be accessed using a query.

SELECT * FROM pg_largeobject WHERE LOID = 123456

Upvotes: 1

Views: 333

Answers (2)

Milen A. Radev
Milen A. Radev

Reputation: 62563

For future reference the relevant sections in the PostgreSQL manual:

Chapter 31. Large Objects, 31.2. Implementation Features.

Chapter 44. System Catalogs, 44.23. pg_largeobject.

Upvotes: 2

Ben
Ben

Reputation: 11188

Correct me if I'm wrong but as far as i know when you are storing files in a database they are stored as binary data. The binary value of your file is stored in your BLOB field. When you are trying to get that file the binary value is then reconstructed to the original file.

Upvotes: 1

Related Questions