mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #65885
[Bug 1969693] Re: Error appears when deleting Institution collections that have been auto-copied to members accounts
I created a wishlist item for the special deletion warning, which is a
good idea, at bug #1969701.
I confirmed the test instructions and got the problem as well on main.
The warning and stacktrace:
[WAR] 4d (lib/errors.php:853) Failed to get a recordset: postgres9 error: [-1: ERROR: update or delete on table "collection" violates foreign key constraint "colltemp_ori_fk" on table "collection_template"
DETAIL: Key (id)=(1) is still referenced from table "collection_template".] in EXECUTE("DELETE FROM "collection" WHERE "id" = ? ")Command was: DELETE FROM "collection" WHERE "id" = ? and values was (0:1)
Call stack (most recent first):
log_message("Failed to get a recordset: postgres9 error: [-1: E...", 8, true, true) at /home/kristina/code/mahara/htdocs/lib/errors.php:89
log_warn("Failed to get a recordset: postgres9 error: [-1: E...") at /home/kristina/code/mahara/htdocs/lib/errors.php:853
SQLException->__construct("Failed to get a recordset: postgres9 error: [-1: E...") at /home/kristina/code/mahara/htdocs/lib/dml.php:1045
delete_records("collection", "id", "1") at /home/kristina/code/mahara/htdocs/lib/collection.php:326
Collection->delete(true) at /home/kristina/code/mahara/htdocs/collection/delete.php:97
deletecollection_submit(object(Pieform), array(size 2)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:577
Pieform->__construct(array(size 3)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:173
Pieform::process(array(size 3)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:5754
pieform(array(size 3)) at /home/kristina/code/mahara/htdocs/collection/delete.php:77
** Also affects: mahara/22.04
Importance: Undecided
Status: New
** Changed in: mahara/22.04
Milestone: None => 22.04rc2
** Changed in: mahara/22.04
Importance: Undecided => Medium
** Changed in: mahara/22.04
Status: New => Confirmed
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1969693
Title:
Error appears when deleting Institution collections that have been
auto-copied to members accounts
Status in Mahara:
Confirmed
Status in Mahara 22.04 series:
Confirmed
Bug description:
This happens in both MySQL and Postgres
To replicate:
1. Create an institution template collection (set to 'Current auto-copied template') with portfolio completion.
2. Create a new account and run the cron so that the portfolio is created in the new member's account.
3. As admin, try to delete the institution template collection.
Result
- SQL error messages on screen. There is a foreign key constraint with collection_template.originaltemplate = collection.id, so it won't allow you to delete from collection table until collection_template table entries are cleared.
Expected:
- Perhaps there should be a warning to institution admins that the collection has been auto-copied before deleting it.
- I think we need to delete from the collection_template table where
originaltemplate = $this->id, rather than where collection = $this->id
(htdocs/lib/collection.php:324). Then we'll be able to delete from
collection table.
Kristina mentioned that a Behat test for this would be good, since we
don't regularly come across this scenario.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1969693/+subscriptions
References