question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide source files and logical files from the Tables list in DB2 for i

See original GitHub issue

Database: 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:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
kseniiaguzeevacommented, Aug 14, 2020

Thank you for the suggestion.

0reactions
JMarkMurphycommented, Aug 12, 2020

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:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

[DB2 for i] Source physical files are included in the list of tables
So, it would be nice if these were hidden. You can determine if a table is a source file or a data file...
Read more >
RELATED_OBJECTS table function - IBM
The RELATED_OBJECTS table function returns a list of all objects that depend on the specified database file, either directly or indirectly.
Read more >
AS/400 DB2 Logical File vs Table Index - Stack Overflow
Logical Files combine the features of both Views (column selection and table joining) and Indexes (row ordering).
Read more >
ALTER TABLE - Snowflake Documentation
This option adds a pair of hidden columns to the source table and begins ... line” is logical such that \r\n will be...
Read more >
The Bookshop data set - Tableau Help
Bookshop.tdsx - a packaged .tdsx file with the related data source already ... We recommend renaming the logical table of Book joined with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found