sqlpostgresqltriggersbytea

Can't update or delete row from table (Postgres)


I have table with bytea field. When I try to delete a row from this table, I get such error:

[42704] ERROR: large object 0 does not exist

Can you help me in this situation?

Edit. Information from command \d photo:

    Table "public.photo"
   Column   |          Type          | Modifiers 
------------+------------------------+-----------
 id         | character varying(255) | not null
 ldap_name  | character varying(255) | not null
 file_name  | character varying(255) | not null
 image_data | bytea                  | 
Indexes:
    "pk_photo" PRIMARY KEY, btree (id)
    "photo_file_name_key" UNIQUE CONSTRAINT, btree (file_name)
    "photo_ldap_name" btree (ldap_name)
Triggers:
    remove_unused_large_objects BEFORE DELETE OR UPDATE ON photo FOR EACH ROW EXECUTE PROCEDURE lo_manage('image_data')

Solution

  • Drop the trigger:

    drop trigger remove_unused_large_objects on photo;