New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataBaseMetada.getIndexInfo() does not return computed indexes [JDBC228] #277
Comments
Modified by: @mrotteveelassignee: Roman Rokytskyy [ rrokytskyy ] => Mark Rotteveel [ avalanche1979 ] Fix Version: Jaybird 2.2 [ 10053 ] |
Commented by: @mrotteveel Posted by Thomas to Firebird-Java: I added a workaround for this to my SQL tool and this is the statement I came up with: SELECT NULL as TABLE_CAT At the heart it's a copy of the statement from the driver. Returning NULL for the "ASC_OR_DESC" follows the Javadocs for getIndexInfo() which states that that column should be NULL if the index does not support a direction (which is true for an expression in Firebird as far as I can tell) This returns a similar result as e.g. the PostgreSQL driver does for a function based index. |
Modified by: @mrotteveel |
Commented by: @mrotteveel As far as I know function indexes are ascending or descending (at least: if I look at the definition in http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-ddl-index.html ); AFAIK all indexes in Firebird have an order. |
Modified by: @mrotteveelstatus: Open [ 1 ] => In Progress [ 3 ] |
Commented by: @mrotteveel * Changed getIndexInfo() to include expression indexes, the COLUMN_NAME column will contain the expression used for the index (if available) |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @mrotteveel
Is related to JDBC193
consider the following table:
CREATE TABLE T (caption varchar(50));
CREATE INDEX idx_capt_upper ON t computed by (upper(caption));
Reported by Thomas in Firebird-Java:
When calling conection.getMetaData().getIndexInfo(null, null, "T", true, false); the result set will be empty.
I had a look at the driver source and the statement that is being used to return all indizes does an inner join on rdb$indices and rdb$index_segments. An index with "computed by" does not seem to have a row in rdb$index_segments and the join fails. When changing the statement to use an outer join, the above index will be returned.
Of course the NULL values for rdb$field_position and rdb$field_name from rdb$index_segments needs to be taken into account.
Commits: 452fdf0 e6e4cc6
The text was updated successfully, but these errors were encountered: