I had a table with large object. When I want to delete a row. I have an error: SQL Error [42704]:
ERROR: large object 123456 does not exist.
I checked in pg_largeobject and I didn't find a row with id = '123456'.
How can I delete an row which has a nonexistent object?
The trigger on the table is
CREATE TRIGGER t_filledreport BEFORE UPDATE OR DELETE ON rep_reportjob
FOR EACH ROW EXECUTE PROCEDURE lo_manage(filledreport);
There are two options:
temporarily disable the trigger:
ALTER TABLE rep_reportjob DISABLE TRIGGER t_filledreport;
DELETE ...;
ALTER TABLE rep_reportjob ENABLE TRIGGER t_filledreport;
As superuser, tempoarily set session_replication_role
to replica
:
BEGIN;
SET LOCAL session_replication_role = replica;
DELETE ...;
COMMIT;
Caution! With triggers disabled, you can easily introduce inconsistencies!