Evgeniy Strepetov Evgeniy Strepetov - 1 year ago 157
SQL Question

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

I have table with

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 |
"pk_photo" PRIMARY KEY, btree (id)
"photo_file_name_key" UNIQUE CONSTRAINT, btree (file_name)
"photo_ldap_name" btree (ldap_name)
remove_unused_large_objects BEFORE DELETE OR UPDATE ON photo FOR EACH ROW EXECUTE PROCEDURE lo_manage('image_data')

Answer Source

Drop the trigger:

drop trigger remove_unused_large_objects on photo;