Hide source files and logical files from the Tables list in DB2 for i
See original GitHub issueDatabase: DB2 for IBM i
Is your feature request related to a problem? Please describe. On IBM i, there are several types of files associated with the database, some because SQL is not the only interface to DB2 for i, some because DB2 is integrated into the OS and certain OS features are built over database files. So Logical files are database objects, but not SQL objects. They are kind of like Views in that they can perform joins, and select columns and rows, but they are also like indexes as they are used to provide sequencing. They show up in the table list, and clutter it because legacy applications that do not use SQL for data access use tons of logical files, most with the same set of columns. Most of the time I just don’t even want to see them. But If you keep them visible, they should be alongside the views. Another kind of file is a source physical file. These are database objects, but SQL cannot easily access them because they have multiple members. They are used to store program source code not data. These should definitely be hidden. There are also catalog views that should be hidden as they are more meta objects than data objects.
Describe the solution you’d like I would like source physical files to be omitted from the table list, and logical files should not show up there either.
Source Physical files should not show up anywhere because they are not data objects. Logical files should show up with Views, and I can show you how to segregate them with a simple SQL statement. Or even better, they should have their own grouping because unlike Views, they can and usually do have key fields, frequently unique. Unfortunately I do not have an easy way using SQL to determine the key fields for Logical Files. There is a certain amount of logic in just not showing logical files at all because they are not SQL objects, but some folks will want to see them.
Catalog views, currently show up under Views. These should be hidden, I can give you SQL to do that.
Describe alternatives you’ve considered The only alternative is to ignore these things. They are numerous though, and could easily be hidden or moved elsewhere.
Additional context The following SQL retrieves all Tables, Views, and Aliases from the database and returns the values in the ODBC/JDBC TABLES view:
SELECT a.TABLE_CATALOG , a.TABLE_SCHEMA , a.TABLE_NAME , a.TABLE_TYPE , a.SELF_REFERENCING_COLUMN_NAME ,
a.REFERENCE_GENERATION , a.USER_DEFINED_TYPE_CATALOG , a.USER_DEFINED_TYPE_SCHEMA ,
a.USER_DEFINED_TYPE_NAME , a.IS_INSERTABLE_INTO
FROM qsys2.tables a
JOIN qsys2.systables b ON a.table_schema = b.table_schema AND a.table_name = b.table_name
WHERE b.table_type <> 'L' AND b.file_type = 'D' AND system_table = 'N';
b.table_type = ‘L’ is logical files. b.file_type = ‘D’ is data files, the other value ‘S’ is source physical files b.system_table = ‘N’ omits system catalog views.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top GitHub Comments
Thank you for the suggestion.
It would be nice if you could add a “Show logicals” option to the connection view menu, just below “Show system objects”. That could default to deselected: