Hi Ernest,
Thanks for your message and for your suggestion.
Currently, jOOQ doesn't really distinguish between tables, views, materialised views, temporary tables, table-valued functions, and many other object types that behave like tables. There's a pending feature request for adding such distinctions in the runtime API:
... but it's not a priority, because it will not be easy to correctly model this distinction across the entirety of the jOOQ API, including: generated tables (those are easy), plain SQL tables, named tables, meta tables (from information schema: easy, from JDBC DatabaseMetaData: tricky), parsed tables, and much more.
Nevertheless, it would definitely be useful to be able to distinguish between the types, both in the runtime API as well as in the code generator.
Note: Even if JDBC's DatabaseMetaData claims that it can handle the distinction between tables and views, it's generally not a good idea to trust this claim, or any claim made by DatabaseMetaData, as many JDBC drivers implement the API poorly.
However, there are options for workaround!
If you're using only one database (e.g. PostgreSQL), you can use the programmatic code generation configuration:
That way, you can easily produce a dynamically generated "excludes" regular expression from a query against the dictionary views. E.g. in PostgreSQL:
SELECT string_agg(table_schema || '.' || table_name, '|')
FROM information_schema.tables
WHERE table_type = 'VIEW';