Hi all I ran into an error in attachment and I don’t know which would be the correct solution.
When a user tries to attach a file with the same name two times it throws an error at attachment/www/file-add-2
Database operation "dml" failed (exception ERROR, "ERROR: insert or update on table "attachments" violates foreign key constraint "attachments_item_id_fk"
DETAIL: Key (item_id)=(11795) is not present in table "acs_objects".
")
ERROR: insert or update on table "attachments" violates foreign key constraint "attachments_item_id_fk"
DETAIL: Key (item_id)=(11795) is not present in table "acs_objects".
SQL:
insert
into attachments
(object_id, item_id, approved_p)
values
('11794', '11795', 't')
while executing
"ns_pg_bind dml nsdb0 {
insert
This occurs because attachment doesn’t check if a file exists and file storage does
My question is what is the correct solution:
1. Attachment check if a file exist and create a new revision of the file and attach the old file_id
2. Attachment check if a file exists and if it exists creates a new item with a different file name and attaches the new file_id.
Thanks for your comments