Question

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
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top