db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5577) Write a table function to expose the contents of SYSCONGLOMERATES.DESCRIPTOR
Date Fri, 20 Jan 2012 16:13:39 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Rick Hillegas updated DERBY-5577:

    Attachment: IndexColumnVTI.java

Attaching IndexColumnVTI.java. This table function cracks open SYSCONGLOMERATES.DESCRIPTOR.

Before using the table function, you must register it:

create function indexColumns()
returns table
    conglomerateid                  char( 36 ),
    isUnique                            boolean,
    isUniqueWithDuplicateNulls  boolean,
    positionInIndex                 int,
    baseColumnPosition          int,
    isColumnAscending           boolean
language java parameter style derby_jdbc_result_set reads sql data
external name 'IndexColumnVTI.indexColumns';

Then you can join it with the Derby metadata. Here is a query which lists all of the columns
in all of the indexes in the database:

select t.tableName, cong.conglomerateName indexName, col.columnName, ic.positionInIndex
from sys.systables t, sys.sysconglomerates cong, sys.syscolumns col, table( indexColumns()
) ic
where t.tableID = cong.tableID
and t.tableID = col.referenceID
and cong.conglomerateID = ic.conglomerateID
and ic.baseColumnPosition = col.columnNumber
order by t.tableName, cong.conglomerateName, ic.positionInIndex;

> Write a table function to expose the contents of SYSCONGLOMERATES.DESCRIPTOR
> ----------------------------------------------------------------------------
>                 Key: DERBY-5577
>                 URL: https://issues.apache.org/jira/browse/DERBY-5577
>             Project: Derby
>          Issue Type: Improvement
>          Components: Tools
>            Reporter: Rick Hillegas
>            Priority: Minor
>         Attachments: IndexColumnVTI.java
> The Derby metadata does not make it easy to list out the columns in an index. We should
write a table function which cracks open the IndexDescriptor stored in the SYSCONGLOMERATES

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message