Can LINK_SCHEMA always output the list of linked tables

29 views
Skip to first unread message

George Ivanov

unread,
Jul 31, 2020, 4:22:56 AM7/31/20
to H2 Database
Hi all,
can LINK_SCHEMA be called in a way that it does NOT output the resultset with the list of the tables?
Thank you,
George

Evgenij Ryazanov

unread,
Jul 31, 2020, 4:34:39 AM7/31/20
to H2 Database
No, it can't. But you can filter out all rows from its result.

SELECT * FROM LINK_SCHEMA('PUBLIC', '', 'jdbc:h2:mem:2', 'sa', '', 'PUBLIC') WHERE FALSE;

George Ivanov

unread,
Jul 31, 2020, 4:37:25 AM7/31/20
to H2 Database
thank you, Evgenij,
however, this will still output an empty resultset. I'd like the command to be executed absolutely silent.

George Ivanov

unread,
Jul 31, 2020, 7:59:02 AM7/31/20
to H2 Database
can it be modified to have that option?

Evgenij Ryazanov

unread,
Jul 31, 2020, 9:16:22 AM7/31/20
to H2 Database
I don't see any good reasons for such modifications in H2. Result of this function can be ignored by application. JDBC doesn't require you to read result of a query.

George Ivanov

unread,
Jul 31, 2020, 9:25:02 AM7/31/20
to H2 Database
yes, application can ignore and JDBC allows not to read the result. However, I have a generic mechanism in my application that always reads the result. So, in my case I'll have to do some workaround for this specific case. And the worst thing is that, it looks I cannot distinct when to read it and when not, since i need both options available and it is basically should be the user's choice, who controls the SQL. So, an option in the H2 function would be preferable in my case.

Evgenij Ryazanov

unread,
Jul 31, 2020, 9:47:31 AM7/31/20
to H2 Database
This function is not intended to be called by regular users. Even more, you should never give ADMIN privileges to users, especially in H2 where users with such privileges have access to the server and may interact with operating system. H2 is not a secure container.

DBAs should see what they're doing.

Anyway, decision to use or not to use result of any function is under responsibility of its caller. Your suggestion looks like some dirty workaround over your own problem, such workarounds will not be included into H2.

George Ivanov

unread,
Jul 31, 2020, 10:22:08 AM7/31/20
to H2 Database
when I said app users, I meant DBAs too.
Anyway, I think I see a workaround. Thank you!

Reply all
Reply to author
Forward
0 new messages