Hi Evgenij,

All databases use a different type in order to be able to filter system 
tables, well all those that I manage in Base (HsqlDB, SQLite xerial, Derby, 
PostgreSQL pgJDBC, Firebird Jaybird).
MariaDB connector/J gives system tables only for those located in the 
information_schema.

It seems to me that if this is used by so many databases it is because it 
is the simplest solution to provide such functionality.

I already have specific code for H2 which returns TABLE BASE instead of 
TABLE and I had to set up mock ResultSet on the 
DatabaseMetaData.getTypeInfos() and DatabaseMetaData.getTablePrivileges() 
methods for databases returning non-compliant resultsets.

Unfortunately for this specific problem I can't do much since we are unable 
to filter the tables due to lack of differentiation of types... For this 
specific functionality I only depend on the underlying implementation.

Le mardi 9 avril 2024 à 16:57:51 UTC+2, Evgenij Ryazanov a écrit :

> Hi!
>
> > Why H2 does not use SYSTEM TABLE in the table types returned by the 
> DatabaseMetaData.getTableTypes() method
>
> Because there is no such thing as system table in the SQL Standard. JDBC 
> metadata is an entirely unreliable thing, you can't construct anything 
> serious on top of it.
>
> There is a difference between type of a table (base table, view, local 
> temporary table, global temporary table and so on) and its actual 
> implementation.
>
> In modern versions of H2 you can use a query like that to distinguish 
> user-defined tables and views from system tables and views:
>
> SELECT *, DB_OBJECT_ID('TABLE', TABLE_SCHEMA, TABLE_NAME) < 0 IS_SYSTEM 
> FROM INFORMATION_SCHEMA.TABLES;
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/ba2b72d8-afdd-4515-bee8-b7f050bfd0b0n%40googlegroups.com.

Reply via email to