Bug 92847 - Append table alias name Database Advanced Settings overriden by database metadata from JDBC data source
Summary: Append table alias name Database Advanced Settings overriden by database meta...
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
 
Reported: 2015-07-20 21:50 UTC by ianbstuart
Modified: 2017-07-27 12:02 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ianbstuart 2015-07-20 21:50:10 UTC
Platform:  Windows and Linux Libreoffice 
Versions from 4.0.x to 4.4.4.3 (and OpenOffice 4.1)
Database connection - JDBC
JDBC driver -  Rocket Software U2 JDBC driver - previously IBM U2 JDBC driver
Database server - UniVerse 11.2.4 (Windows, Linux and AIX)
 
In BASE, the database advanced settings has an option to deselect the automatic aliasing of a table to itself as well as suppress the use of schema and catalog names in the formed SQL;

EG SELECT * FROM CM AS CM   is formed as SELECT * FROM CM (i.e without the alias) if the advanced settings option is unchecked.

However it seems that metadata from the database server is able to override this setting or, alternatively, BASE detects something in the metadata sent by the database manager that results in the Alias option being enabled.

The point at which the alias is added is when editing a query in the Designer View  (not Edit in SQL View).  Once the query is saved and then viewed in the "Edit in SQL View" editor, the alias is present.  If the query is manually edited to remove the alias and the changes saved, then the SQL is correctly executed and the results returned as expected.  However, as soon as the query is edited again in the Query Designer, the alias is added.

The circumstances around this are that this has occurred since an upgrade of the Rocket Software UniVerse database manager where the database manager responds with a "derived" schema name of UVACCT for each table that is present. 

Prior to this, since OpenOffice 2, the same JDBC driver has worked with OpenOffice and LibreOffice.

The logfiles that were generated from the JDBC driver whilst trying to debug the problem seem to highlight that the schema name is sent from the latest version of the database manager whereas previous versions do not have the schema name:

EG: Part of log file from Version 11.2.4 of UniVerse with "Schema" of UVACCT which was logged when clicking on Tables to query available tables shows:

015-07-20 21:45:44.128 getString(1) returns ''
2015-07-20 21:45:44.129 getString(2) returns 'UVACCT'
2015-07-20 21:45:44.129 getString(3) returns 'CUSTOMER'
2015-07-20 21:45:44.133 getString(4) returns 'TABLE'
2015-07-20 21:45:44.133 UniJDBCProtocolU2Impl#nextRow:enter
2015-07-20 21:45:44.133 UniJDBCProtocolU2Impl#nextRow:leave-1
2015-07-20 21:45:44.134 mHasNextRow=true,mRowCount=2
2015-07-20 21:45:44.134 getString(1) returns ''
2015-07-20 21:45:44.134 getString(2) returns 'UVACCT'
2015-07-20 21:45:44.135 getString(3) returns 'CUSTOMER_ORDERS'
2015-07-20 21:45:44.135 getString(4) returns 'TABLE'
2015-07-20 21:45:44.135 UniJDBCProtocolU2Impl#nextRow:enter
2015-07-20 21:45:44.135 UniJDBCProtocolU2Impl#nextRow:leave-1
2015-07-20 21:45:44.135 mHasNextRow=true,mRowCount=3
2015-07-20 21:45:44.136 getString(1) returns ''
2015-07-20 21:45:44.136 getString(2) returns 'UVACCT'
2015-07-20 21:45:44.136 getString(3) returns 'PRODUCTS'
2015-07-20 21:45:44.137 getString(4) returns 'TABLE'
2015-07-20 21:45:44.137 UniJDBCProtocolU2Impl#nextRow:enter
2015-07-20 21:45:44.137 UniJDBCProtocolU2Impl#nextRow:leave-1
2015-07-20 21:45:44.137 mHasNextRow=true,mRowCount=4
2015-07-20 21:45:44.137 getString(1) returns ''
2015-07-20 21:45:44.137 getString(2) returns 'UVACCT'
2015-07-20 21:45:44.138 getString(3) returns 'STATES'
2015-07-20 21:45:44.138 getString(4) returns 'TABLE'

Whereas a previous version of UniVerse 11.1.9 does not include the schema name:

2015-07-20 21:42:26.645 getString(1) returns ''
2015-07-20 21:42:26.645 getString(2) returns 'null'
2015-07-20 21:42:26.645 getString(3) returns 'CUSTOMER'
2015-07-20 21:42:26.645 getString(4) returns 'TABLE'
2015-07-20 21:42:26.645 UniJDBCProtocolU2Impl#nextRow:enter
2015-07-20 21:42:26.646 UniJDBCProtocolU2Impl#nextRow:leave-1
2015-07-20 21:42:26.646 mHasNextRow=true,mRowCount=2
2015-07-20 21:42:26.646 getString(1) returns ''
2015-07-20 21:42:26.646 getString(2) returns 'null'
2015-07-20 21:42:26.646 getString(3) returns 'PRODUCTS'
2015-07-20 21:42:26.646 getString(4) returns 'TABLE'
2015-07-20 21:42:26.647 UniJDBCProtocolU2Impl#nextRow:enter
2015-07-20 21:42:26.647 UniJDBCProtocolU2Impl#nextRow:leave-1
2015-07-20 21:42:26.647 mHasNextRow=true,mRowCount=3
2015-07-20 21:42:26.647 getString(1) returns ''
2015-07-20 21:42:26.647 getString(2) returns 'null'
2015-07-20 21:42:26.647 getString(3) returns 'STATES'
2015-07-20 21:42:26.647 getString(4) returns 'TABLE'
2015-07-20 21:42:26.647 UniJDBCProtocolU2Impl#nextRow:enter

I.e 'null' schema
This occurs on both Linux and Windows clients.

It would seem that certain circumstances cause LibreOffice (and OpenOffice 4.1) to ignore the user setting to turn off aliasing, whereas the option is essentially there to allow the user to force aliasing off.

Perhaps there should be a further option to "override" any decision that LibreOffice may prefer with respect to turning on aliasing.

Unfortunately UniVerse does not support aliasing a table name to itself (CM AS CM) nor to aliasing a table defined as SCHEMA.TABLE TO TABLE (Eg UVACCTS.CM AS CM) for a number of reasons related to its internal design.  If the alias supplied was unique to the query and the alias did not by any chance reference an existing entry in the database master dictionary then aliasing works.

EG UVACCTS.CM AS X_CM_Y or  CM AS X_CM_Y (as long as X_CM_Y is not present in the MASTER DICTIONARY)

The reason for this is that UniVerse supports both SQL and Non-SQL tables/files
For performance non-SQL files are faster and can be treated as SQL tables; however they are not part of a "genuine" schema, do not impose SQL rules, whereas true SQL tables are part of a schema.
Comment 1 Alex Thurgood 2016-06-14 08:08:25 UTC
In the Advanced Settings tab, do you see an entry called "Ignore Driver Privileges" ?

If you do, does altering that setting change the behaviour you are reporting here ?

It seems to me from your description that the problem is more one of what the driver is telling LO it can do. LO has no way of telling whether the driver is reporting its actual capabilities or whether it is saying one thing and actually only capable of another. There's not much that LO can do about such a situation as it relies on the driver to do this heavy lifting.
Comment 2 QA Administrators 2017-06-28 12:36:43 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2017-07-27 12:02:13 UTC Comment hidden (obsolete)