Finding an unqualified object on the search path

19 views
Skip to first unread message

Mark Rotteveel

unread,
Jul 22, 2025, 11:23:56 AMJul 22
to firebir...@googlegroups.com
I'm working on the schema support in Jaybird, and I have a case where I
need to find an unqualified object (a table, specifically) on the search
path.

The case I have right now is for the generated keys support,
specifically to generate the RETURNING clause for
`Connection.prepareStatement(String sql, int[] columnIndex)`[1].

To be able to generate that clause (contrary to `prepareStatement(String
sql, String[] columnNames)` and `prepareStatement(String sql, int
autoGeneratedKeys)`, I need to query the system tables to get the column
names to find out which column name corresponds to which index.

If the table in the DML statement is unqualified, I need to find it
based on the current search path.

The only solution, I can come up with right now is to query
RDB$RELATIONS (or RDB$RELATION_FIELDS) by name only, and also query
RDB$GET_CONTEXT('SYSTEM', 'SEARCH_PATH') and resolve it client-side.

Is there a trick, or helper function I might be missing that could help
me identify the schema in this case?

[1]:
https://docs.oracle.com/en/java/javase/21/docs/api/java.sql/java/sql/Connection.html#prepareStatement(java.lang.String,int[])

--
Mark Rotteveel

Adriano dos Santos Fernandes

unread,
Jul 22, 2025, 7:54:59 PMJul 22
to firebir...@googlegroups.com

Mark Rotteveel

unread,
Jul 23, 2025, 4:41:23 AMJul 23
to firebir...@googlegroups.com
Thanks!

Mark
--
Mark Rotteveel
Reply all
Reply to author
Forward
0 new messages