[MDEV-5318] ConnectSE: assisted discovery fails if the same table name presents in more than one schemas Created: 2013-11-20 Updated: 2014-04-09 Resolved: 2014-04-09 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.10 |
| Fix Version/s: | 10.0.11 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Alexander Barkov | Assignee: | Olivier Bertrand |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | connect-engine | ||
| Issue Links: |
|
||||||||
| Description |
|
If two tables having the same name present in more than one For example, Cache in its default installation has the following
So this query:
returns an error:
because the ODBC call for SQLColumns() returns columns for all tables The same problem happens with Oracle DSN:
if table "COUNTRIES" present in two schemas. Notice REGION_ID specified twice in the above error message. The above error message is confusing. We need to solve this somehow. Possible ways: 1. Detect the default schema name. If schema name is not specified by the user, Unfortunately, it seems there are no ways to fetch current schema in the ODBC API. Neither are portable SQL ways to get current schema.
We can try to check the database type and run one 2. Or just print a better error message. The discovery code could make sure that schema
|
| Comments |
| Comment by Olivier Bertrand [ 2014-04-08 ] |
|
I don't know whether you have access to the proper CONNECT documentation I update regularly in DOC, PDF, and HTML format or just use the on-line version of the MariaDB site. The problem is that this version is often outdated or incomplete. In the file version, this issue is addressed page 49 in the section called "ODBC Catalog Information" and says in particular: <<<<<<<<<<<<< CATALOG is apparently rarely used by most data sources, but SCHEMA (formerly OWNER) is and corresponds to the DATABASE information of MySQL. The issue is that if no schema name is specified, some data sources return information for all schemas while some others only return the information of the “default” schema. In addition, the used “schema” or “database” is sometimes implied by the connection string and sometimes is not. Sometimes, it also can be included in a data source definition. CONNECT offers two ways to specify this information: 1. When specified, the DBNAME create table option is regarded by ODBC tables as the SCHEMA name. When both are used, the qualified table name has precedence over DBNAME. When creating a standard ODBC table, you should make sure only one source table is specified. Specifying more than one source table must be done only for CONNECT catalog tables (with CATFUNC=tables or columns) If this does not seem explicit enough for you, I am open to any suggestion concerning what should be said. About the inappropriate error message, it is difficult to address this for CONNECT because it is made by MariaDB when the constructed create statement is sent to the MariaDB "init_from_sql_statement_string" function. What can be done is simply to test for duplicate column names before sending it but there will be no mean to discover the cause of it. |
| Comment by Alexander Barkov [ 2014-04-09 ] |
|
Olivier, the bug was created in November 2013. We need to do something. |
| Comment by Olivier Bertrand [ 2014-04-09 ] |
|
I shall make the documentation more explicit about this issue. |