Duplicate key error on block edit page in Postgres

Bug #1733938 reported by Robert Lyon on 2017-11-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

It is possible to get this error:

Failed to get a recordset: postgres8 error: [-5: ERROR: duplicate key value violates unique constraint "blocinst_vierowcolord_uk" DETAIL: Key (view, "row", "column", "order")=(16, 1, 1, 1) already exists.] in EXECUTE("INSERT INTO "block_instance" ("id", "blocktype", "title", "configdata", "view", "column", "order", "row") VALUES (?, ?, ?, ?, ?, ?, ?, ?)")Command was: INSERT INTO "block_instance" ("id", "blocktype", "title", "configdata", "view", "column", "order", "row") VALUES (?, ?, ?, ?, ?, ?, ?, ?) and values was (id:8261,blocktype:textbox,title:Note,configdata:a:0:{},view:16,column:1,order:1,row:1)

To reproduce:
1. Create a new page
2. Click on the Note block
3. Do not click on Add nor on Cancel, but press ESC key (because you just realised that you have selected the wrong text block)
4. Click on the Text block
5. Click on the Add button

The problem here is the using of 'ESC' key is not cleaning up info about old block, so is trying to save the old and new block with same block position

Robert Lyon (robertl-9) wrote :

In MySQL it behaves slightly differently and tries to display both blocks causing the config form to be confused

Changed in mahara:
milestone: none → 18.04.0

Reviewed: https://reviews.mahara.org/8299
Committed: https://git.mahara.org/mahara/mahara/commit/8e48d4c84f4358396bafa0cbe65283c997582879
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 8e48d4c84f4358396bafa0cbe65283c997582879
Author: Robert Lyon <email address hidden>
Date: Thu Nov 23 09:01:28 2017 +1300

Bug 1733938: Allow 'ESC' key to cancel adding of a block

When on the 'add block' popup


Change-Id: I8bb59e9bedd5a64e6b59330aa5e2fc2aba3ef639
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9) on 2017-12-07
Changed in mahara:
status: In Progress → Fix Committed

The last review from 13 December was abandonded.

Robert Lyon (robertl-9) on 2018-04-05
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers