Bug 45257 - EDITING Relation designer does not pick up all existing relationships in PostgreSQL and native connection
Summary: EDITING Relation designer does not pick up all existing relationships in Post...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.5.0 RC2
Hardware: x86-64 (AMD64) All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Tables
  Show dependency treegraph
 
Reported: 2012-01-25 23:54 UTC by Drew Jensen
Modified: 2024-10-10 15:22 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Example database of PostgreSQLTutorial (537.99 KB, application/zip)
2024-10-10 15:17 UTC, Robert Großkopf
Details
Relationship od the example database dvdrental (467.38 KB, application/pdf)
2024-10-10 15:21 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Drew Jensen 2012-01-25 23:54:30 UTC
Tested w/ Ubuntu 11.04, Lbo 3.5 RC2, Postgresql 8.4

Open an ODB connected to a postgresql database with muliple relationship constraints.

Open the relation design window.

Not all relationships will be displayed - in testing this was true 100% of the time the first time that window is opened. But if you do anything to that makes LibO think the window contents should be saved (even if you just trick it) and do so, then close the window and reopen it, most of the time (sorry it is not all the time) it then picks up the other relationships.

This seems to be limited to the relation design window as the Query designer and/or wizard and form wizard pick up all of the relationships right fro the start.
Comment 1 sasha.libreoffice 2012-05-11 03:02:01 UTC
Thanks for bugreport
Please, attach small database with which this bug reproducible. Or add link where it can be downloaded. May be test databases for Postgresql exists, tell if so.

Also attach odb file that demonstrates this problem.
Comment 2 Alex Thurgood 2012-07-23 08:05:15 UTC
Drew,

I can confirm similar behaviour with regard to the native mysql connector extension and a mysql server.

The problem appears to indeed lie with the Relationship designer tool/dialog.

In my own case :

- dragging and dropping to create a relationship between two tables appears to work, but only once between any two tables - in reality, the relationship is not created, the graphical UI representation always default to the first entry in the first table's field list, and if you click on the link to edit the relationship displays only one half, as it turns out the second table to which the link was made without referencing any field from the first table !!!

- trying to manually create a relationship by clicking on the Define button allows one to choose the fields from the tables to be linked, but when validated, fails to do this correctly, i.e. we get a repeat of the scenario above, whereby only the first field of one table appears, and this link only includes one field from one table, and not even the one that was defined by the user !!!

The whole relationship design tool/dialog seems broken, at least for external db's, I haven't tried with hsqldb internal.



Alex
Comment 3 Alex Thurgood 2012-07-23 10:48:10 UTC
Confirming as reproducible on LibreOffice 3.5.5.3 Mac OSX 10.7.4.

Test database : XTuple (http://www.xtuple.com/free-demo-of-xtuple-erp)

Using the built-in connector, when I call Tools > Relationships, the window opens but does not bring up any of the predefined relationships in the database. I get a Table list window, asking me to add the tables to define the relationships I want.


Compare the above behaviour to the same database, using a postgres JDBC connector:
- the relationships are displayed, in fact, so many of them that they overlap each other within the window (but that is not a new problem as such, it has always been that way, independent of the underlying database).

Conclusion : it works in with JDBC and not with sdbc-postgres.


Alex
Comment 4 Toni Ballesta 2013-08-18 09:06:07 UTC
Confirmed on NEWER 4.1.0.4. The problem is the same. Sometimes the relationships are correctly, sometimes not. I've over 30 tables with Postgresql. Opening, closing, reopening... and some relationships appear and disappear. No changes from the psql console: the CONSTRAINT values is not altered.
Comment 5 Alex Thurgood 2015-01-03 17:39:04 UTC Comment hidden (no-value)
Comment 6 Alex Thurgood 2015-02-04 17:15:24 UTC
Changing title because the problem is independent of db engine
Comment 7 Alex Thurgood 2015-02-04 17:16:17 UTC
*** Bug 88033 has been marked as a duplicate of this bug. ***
Comment 8 Julien Nabet 2015-02-08 22:22:01 UTC
Alex/Drew: I put it at NEEDINFO, waiting for your feedback about this tracker.
Comment 9 Alex Thurgood 2015-02-09 06:04:51 UTC
(In reply to Julien Nabet from comment #8)
> Alex/Drew: I put it at NEEDINFO, waiting for your feedback about this
> tracker.

What information do you need ?

The duplicate report bug 88033 contains a sample document and screenshots explaining and showing the problem.
Comment 10 Alex Thurgood 2015-02-09 06:07:14 UTC
(In reply to Alex Thurgood from comment #9)
> (In reply to Julien Nabet from comment #8)
> > Alex/Drew: I put it at NEEDINFO, waiting for your feedback about this
> > tracker.
> 
> What information do you need ?
> 
> The duplicate report bug 88033 contains a sample document and screenshots
> explaining and showing the problem.

In bug 88033, the bug was reported against LO 4352, I confirmed on master Version: 4.5.0.0.alpha0+
Build ID: 6143a7eeabea394133c54e97e3690bdf40b98247
Locale: fr_

on OSX 10.10.2
Comment 11 Julien Nabet 2015-02-09 06:34:08 UTC
Alex: Sorry, had missed information from tdf#88033, I'll take a look, thank you! :-)
Comment 12 Julien Nabet 2015-02-09 22:20:32 UTC
Ok, I reproduced the bug.

In fact, it seems that only 1 relation is possible between 2 tables.
Indeed, if I remove link between "tbl_product" and "tbl_bug" then add another one, it's ok.

I noticed too that when trying to create second relation, cardinality doesn't appear. Perhaps both behaviors are linked.
Comment 13 Julien Nabet 2015-02-10 21:25:44 UTC
I'm lost by the number of parts involved:
dbaccess/source/ui/control/RelationControl.cxx
svtools/source/brwbox/editbrowsebox.cxx
svtools/source/brwbox/brwbox1.cxx
...
example of bt:

#0  dbaui::ORelationControl::getColumnIdent (this=0x2fb5c90, _nColId=65535) at /home/julien/compile-libreoffice/libreoffice/dbaccess/source/ui/control/RelationControl.cxx:274
#1  0x00002aaad025c15d in dbaui::ORelationControl::InitController (this=0x2fb5c90, nRow=0, nColumnId=65535)
    at /home/julien/compile-libreoffice/libreoffice/dbaccess/source/ui/control/RelationControl.cxx:305
#2  0x00002aaaafbd8b73 in svt::EditBrowseBox::ActivateCell (this=0x2fb5c90, nRow=0, nCol=65535, bCellFocus=true)
    at /home/julien/compile-libreoffice/libreoffice/svtools/source/brwbox/editbrowsebox.cxx:1027
#3  0x00002aaaafbda5c1 in svt::EditBrowseBox::ActivateCell (this=0x2fb5c90) at /home/julien/compile-libreoffice/libreoffice/include/svtools/editbrowsebox.hxx:571
#4  0x00002aaaafbd888d in svt::EditBrowseBox::CursorMoved (this=0x2fb5c90) at /home/julien/compile-libreoffice/libreoffice/svtools/source/brwbox/editbrowsebox.cxx:987
#5  0x00002aaaafbac049 in BrowseBox::GoToRow (this=0x2fb5c90, nRow=0, bRowColMove=false, bKeepSelection=false)
    at /home/julien/compile-libreoffice/libreoffice/svtools/source/brwbox/brwbox1.cxx:1544
#6  0x00002aaaafbaaa01 in BrowseBox::RowInserted (this=0x2fb5c90, nRow=0, nNumRows=2, bDoPaint=true, bKeepSelection=false)
    at /home/julien/compile-libreoffice/libreoffice/svtools/source/brwbox/brwbox1.cxx:1243
#7  0x00002aaad025b694 in dbaui::ORelationControl::lateInit (this=0x2fb5c90) at /home/julien/compile-libreoffice/libreoffice/dbaccess/source/ui/control/RelationControl.cxx:187
#8  0x00002aaad025e3cc in dbaui::OTableListBoxControl::lateInit (this=0x2fadd40)
    at /home/julien/compile-libreoffice/libreoffice/dbaccess/source/ui/control/RelationControl.cxx:673

Value of nCol seems strange but I can't succeed in understanding the whole mechanism, too messy!
Comment 14 Lionel Elie Mamane 2015-02-11 05:52:21 UTC
(In reply to Julien Nabet from comment #13)
> Value of nCol seems strange

This looks like the special value "unknown/invalid column":

include/svx/gridctrl.hxx:#define GRID_COLUMN_NOT_FOUND   SAL_MAX_UINT16
Comment 15 QA Administrators 2016-02-21 08:36:45 UTC Comment hidden (obsolete)
Comment 16 James B. Byrne 2016-03-01 13:58:25 UTC
LO-5.0.3.2
CentOS-6.7

Bug remains in this version.  When attempting to add relationships from multiple fields in one table to the primary key of another relationships added subsequent to the first generate an error and cause a relationship editing window to appear.  If the multiple relationships (T2.field1 -> T1.id, T2,field2 -> T1.id, T2.field3 -> T1.id) are entered manually in the relationship editing window then LO crashes and the recovery shows no trace of the previously attempted work.
Comment 17 QA Administrators 2017-03-06 15:37:00 UTC Comment hidden (obsolete)
Comment 18 Terrence Enger 2017-04-15 22:36:50 UTC
I still see the bug with debian stretch running daily Linux dbgutil
bibisect repository version 2017-04-15 with an embedded Firebird
database.

I have the example .odb and STR, but I think they do not add much to
what is already here.
Comment 19 Terrence Enger 2017-04-15 22:42:48 UTC
*** Bug 101230 has been marked as a duplicate of this bug. ***
Comment 20 Julien Nabet 2017-07-29 22:18:30 UTC
(In reply to Terrence Enger from comment #18)
> I still see the bug with debian stretch running daily Linux dbgutil
> bibisect repository version 2017-04-15 with an embedded Firebird
> database.
> 
> I have the example .odb and STR, but I think they do not add much to
> what is already here.

About Firebird, it's been fixed with https://cgit.freedesktop.org/libreoffice/core/commit/?id=d499cb3bd585e9fcc21bc586cad3d2ad2487a451 for tdf#107196

For other databases any better with recent LO version? (last stable one is 5.3.4)
Comment 21 QA Administrators 2018-07-30 02:36:38 UTC Comment hidden (obsolete)
Comment 22 QA Administrators 2020-10-06 03:44:39 UTC Comment hidden (obsolete)
Comment 23 QA Administrators 2022-10-07 03:38:17 UTC Comment hidden (obsolete)
Comment 24 QA Administrators 2024-10-07 03:17:16 UTC Comment hidden (obsolete)
Comment 25 James B. Byrne 2024-10-10 13:33:40 UTC
Bug appears to be solved in LO 24.2.4.2 on FreeBSD-14.1
Comment 26 Robert Großkopf 2024-10-10 13:50:23 UTC
Problem for this bug: We need an example.
The bug has been reported first for PostgreSQL. There is a link to an example on comment3, which doesn't work any more.

Best would be: 
SQL-code for creating an example.
Shown relationship in a tool, which will show all the relationships.
Screenshot of relationship in LibreOffice.
Connection to the database (direct connection, JDBC, ODBC)
Comment 27 James B. Byrne 2024-10-10 14:08:48 UTC
You can use the example odb from bug #88033.  That is what I tested LO Base on.
Comment 28 Robert Großkopf 2024-10-10 15:17:37 UTC
Created attachment 197000 [details]
Example database of PostgreSQLTutorial

Have tested now with example database from PostgreSQL Tutorial. See description:
https://www.postgresqltutorial.com/postgresql-getting-started/load-postgresql-sample-database/

Opened the database with LO 24.8.2.1 on OpenSUSE with direct connection to PostgreSQL.
First opening: 13 of 15 tables will be shown in relationship
Closing Base file, closing LO
Second opening: 15 of 15 tables will be shown, one table without any connection
Closing Base file, closing LO
Third opening: 15 of 15 tables will be shown, three tables without any connection

Opened the database with LO 24.8.2.1 on OpenSUSE with JDBC connection to PostgreSQL.
All tables will be shown in relationship, all tables connected the right way.
Comment 29 Robert Großkopf 2024-10-10 15:21:46 UTC
Created attachment 197001 [details]
Relationship od the example database dvdrental

Relationship downloaded from https://www.postgresqltutorial.com/postgresql-getting-started/postgresql-sample-database/ will show the relations, which should also been shown in relationship of LO.

Direct connection to PostgreSQL will miss some connections, so it seems tables aren't connected.
JDBC-connection to PostgreSQL will work well.

This is the bug reported here. Has nothing to do with internal databases, because it depends on the used driver.

Version: 24.8.2.1 (X86_64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded