On Fri, Sep 5, 2014 at 11:34 AM, Alanoly Andrews [via PostgreSQL] <[hidden email]> wrote:
Hi Adrian,
1. We are storing our large objects in a table column whose datatype is "lo" (which, I understand, ultimately is in fact "bytea").
The "lo" data type is effectively a domain over the "oid"
data type which is effectively a lookup key onto the large objects table. While you can ultimately retrieve bytea data if you have an "lo" value the "lo" data is not itself your binary content.
I'm confused because you seem confused here but the code actually works...
You still haven't provided a self-contained scenario which demonstrates the problem - during which you should enable logging of all statements in order to definitively see what it is that PostgreSQL is doing during the test run.
One theory I have is that you've added:
CREATE TRIGGER t_raster BEFORE UPDATE OR DELETE ON image
FOR EACH ROW EXECUTE PROCEDURE lo_manage(raster);
to the relevant table and, arguably incorrectly, when the table rewrite occurs the original row pointing to the large object goes away and so the trigger removes the large object as it is designed to do. This really doesn't make sense but the general mechanics of what this function does and what you describe are too similar to ignore.