Bug 82905

Summary: EDITING: Foreign Key between two subforms do not work anymore
Product: LibreOffice Reporter: Knut Esztermann <knut>
Component: BaseAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: knut, robert
Priority: medium    
Version: 4.3.0.4 release   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=82720
Whiteboard:
Crash report or crash signature: Regression By:

Description Knut Esztermann 2014-08-21 11:35:44 UTC
Problem description: 
I have a form with two subforms (a table for 'file', only showing entries with 'file'.'movie_id" matching 'movie'.'id' and a table 'audiotrack' only showing entries with 'audiotrack'.'file_id' matching the currently selected 'file'.'id'). The backend is mysql.

This happened to work before. After the update to 4.3.0, the 'file'.'id' as a foreign key in the 'audiotrack' subform seems to not be updated on changing main records.

Two related problems:

1) The records of the second table ('audiotrack') are never updated, they only show records belongig to the first shown 'file' entry. When a record has no 'file' entry, they disappear; after selecting another record with existing 'file' entries, the same wrong records appear again.

2) It is not possible to add records, the insertion fails with:
SQL Status: 23000
Error code: 1452

Cannot add or update a child row: a foreign key constraint fails ("movies"."subtitletrack", CONSTRAINT "subtitletrack_ibfk_1" FOREIGN KEY ("file_id") REFERENCES "file" ("id") ON DELETE CASCADE ON UPDATE CASCADE)



Steps to reproduce:
1. Change to another record
2. Enter a new record in the 'subtitletrack' form

Current behavior:
1. The records in 'subtitletrack' do not change
2. It is not possible to save the newly created record

Expected behavior:
1. The records in 'subtitletrack' should change according to the selected 'file' record
2. New records should be saved with the correct foreign key
Comment 1 Robert Großkopf 2014-08-21 19:28:56 UTC
Could this be a duplicate from Bug82720 ? Refreshing from a subsubform doesn't work any more since 4.3.0.0 alpha.

Or are your subforms installed parallel, both connecting to the mainform?
Comment 2 Knut Esztermann 2014-08-21 21:22:35 UTC
Hi,

> --- Comment #1 from robert@familiegrosskopf.de ---
> Could this be a duplicate from Bug82720 ? Refreshing from a
> subsubform doesn't
> work any more since 4.3.0.0 alpha.

this could indeed be the same problem. I looked into the example
db and the behaviour is exactly the same, I just did not
understand the relationships completely, as it says
'SubTable'.'MainID' for both, 'Link master field' and 'Link slave
field' on the subsubform.

> Or are your subforms installed parallel, both connecting to the
> mainform?

No, not in parallel, the first sub form is connected to the main
from, the second one is connected to the first sub form.


/ Knut Esztermann
Comment 3 Robert Großkopf 2014-08-24 18:47:17 UTC
It's a duplicate of Bug82151, which has been fixed for LO 4.3.2.

*** This bug has been marked as a duplicate of bug 82151 ***