Correction: DatabaseMetaData.getTables() method more intelligent...
Le mardi 9 avril 2024 à 18:23:06 UTC+2, prrvchr a écrit :
> To be more precise, it is not a change in the type of tables that I am
> asking for, but the possibility of making the
> DatabaseMetaData.getTablesTypes() method more intelligent in order to be
> able to filter or not the system tables.
> That this method recognizes the types TABLE, SYSTEM TABLE and BASE TABLE
> in the type parameter in order to only return respectively all non-system
> tables, all system tables and all tables.
>
>
>
> Le mardi 9 avril 2024 à 18:04:20 UTC+2, prrvchr a écrit :
>
>> 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/f9f73d56-7ce1-48d2-ae1c-0332742bc792n%40googlegroups.com.