[
https://issues.apache.org/jira/browse/DERBY-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490953
]
Jørgen Løland commented on DERBY-2222:
--------------------------------------
The reason why this works for the embedded driver but not the client one is
that the client calls org/apache/derby/client/am/DatabaseMetaData#getIndexInfo
which throws SQLException if table == null. The embedded client calls the
org/apache/derby/impl/jdbc/EmbedDatabaseMetaData#getIndexInfo which does not
perform this check.
According to the JDBC API, the getIndexInfo methods should not allow null
values for the table name. Hence, as part of issue 1484,
EmbedDatabaseMetaData#getIndexInfo will be changed to throw an SQLException as
well.
However, the ij reference says that
(http://db.apache.org/derby/docs/dev/tools/rtoolsijcomrefshow.html):
SHOW
{
CONNECTIONS |
INDEXES [ IN schemaName | FROM table-Name ] |
PROCEDURES [ IN schemaName ] |
SCHEMAS |
SYNONYMS [ IN schemaName ] |
TABLES [ IN schemaName ] |
VIEWS [ IN schemaName ] |
}
(...)
SHOW INDEXES displays all the indexes in the database.
If IN schemaName is specified, then only the indexes in the specified schema
are displayed.
This is the same behavior currently observed by the embedded client, but not
after issue 1484 is resolved. How should this best be solved? Two possible
solutions are:
1) Change the ij reference so that "show indexes in app;" is not allowed.
2) When "show indexes in app" is performed, first get all tables in schema app,
and then get all indexes for the tables one at a time. This would probably
require a means to merge multiple resultsets into one ijResult. Is this
possible with any existing Class?
> 'show indexes in SCHEMANAME' does not work with the client driver
> -----------------------------------------------------------------
>
> Key: DERBY-2222
> URL: https://issues.apache.org/jira/browse/DERBY-2222
> Project: Derby
> Issue Type: Bug
> Components: Network Client, Tools
> Affects Versions: 10.2.2.0, 10.3.0.0
> Reporter: Kristian Waagan
> Assigned To: Jørgen Løland
>
> The ij command 'show indexes in SCHEMANAME' does not work at all with the
> client driver.
> It does work with the embedded driver.
> Sample output from ij:
> ij> connect 'jdbc:derby://localhost/myDB;create=true';
> ij> create table test (id int primary key);
> 0 rows inserted/updated/deleted
> ij> show indexes in app;
> ERROR XJ103: Table name can not be null
> ij> show indexes from test;
> TABLE_NAME |COLUMN_NAME |NON_U&|TYPE|ASC&|CARDINA&|PAGES
> ----------------------------------------------------------------------------
> TEST |ID |0 |3 |A |NULL |NULL
> 1 row selected
> ij> show indexes from app.test;
> TABLE_NAME |COLUMN_NAME |NON_U&|TYPE|ASC&|CARDINA&|PAGES
> ----------------------------------------------------------------------------
> TEST |ID |0 |3 |A |NULL |NULL
> 1 row selected
> ij>
> Using delimited table and/or schema names does not work, but I think this is
> according to documentation.
> I.e.:
> ij> show indexes from "TEST";
> ERROR 42X01: Syntax error: Encountered "show" at line 1, column 1.
> ij> show indexes from "APP".test;
> ERROR 42X01: Syntax error: Encountered "show" at line 1, column 1.
> ij> show indexes from "APP"."TEST";
> ERROR 42X01: Syntax error: Encountered "show" at line 1, column 1.
> ij>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.