https://bugs.documentfoundation.org/show_bug.cgi?id=92847

            Bug ID: 92847
           Summary: Append table alias name Database Advanced Settings
                    overriden by database metadata from JDBC data source
           Product: LibreOffice
           Version: Inherited From OOo
          Hardware: Other
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to