Skip to content

refactor empty resultset to use empty result set if the catalog is not correct#3588

Merged
davecramer merged 8 commits intopgjdbc:masterfrom
davecramer:refactor_empty_resultset
Apr 8, 2025
Merged

refactor empty resultset to use empty result set if the catalog is not correct#3588
davecramer merged 8 commits intopgjdbc:masterfrom
davecramer:refactor_empty_resultset

Conversation

@davecramer
Copy link
Member

Alternative to #3528

@davecramer
Copy link
Member Author

I did put in a check for isvalid() but looking at the rest of the code we return many functions without verifying the connection is valid.

Thoughts @vlsi @sehrope ?

@sehrope
Copy link
Member

sehrope commented Apr 8, 2025

If we're not doing it other places and have no intention of adding this check everywhere, we should not be including it here either.

@davecramer
Copy link
Member Author

works for me. I'll remove the checks

@davecramer davecramer merged commit d413ce3 into pgjdbc:master Apr 8, 2025
14 of 16 checks passed
String sql;
sql = "SELECT current_database(), n.nspname,p.proname,p.prorettype,p.proargtypes, t.typtype,t.typrelid, "
// if the catalog is specified and it does not equal the current catalog then just return an empty resultset
if (catalog != null && !catalog.isEmpty() && !catalog.equals(connection.getCatalog())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" retrieves those without a catalog
I assume PostgreSQL does not have "procedures without a catalog", so catalog.isEmpty() check looks redundant here. WDYT of replacing this with catalog != null && (catalog.isEmpty() || !catalog.equals(connection.getCatalog()))

!Objects.equals(catalog, connection.getCatalog()) could do as well (at a cost of one-time SQL in getCatalog())

vlsi added a commit to vlsi/pgjdbc that referenced this pull request Jun 14, 2025
…order

9th column should be KEY_SEQ, however it was 11 in case the resultset was empty

This is a fix for pgjdbc#3588
vlsi added a commit that referenced this pull request Jun 14, 2025
…order

9th column should be KEY_SEQ, however it was 11 in case the resultset was empty

This is a fix for #3588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments