Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Tue, 04 Feb 2025 15:58:49 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #3504: Wrong schemas fetched for a given catalog as input In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 2634399631 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3504 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3504#issuecomment-2634399631 Content-Type: text/plain; charset=utf-8 I just tried this with the latest 42.7.5 and was unable to replicate these results: ``` public static void getSchemas(String catalog) throws SQLException { try (Connection conn = DriverManager.getConnection(DB_URL, USER,PASS)) { ResultSet rs = null; if (catalog != null && catalog.length() > 0){ System.out.println(String.format("Connected to %s, setting catalog: %s",DB_URL, catalog)); conn.setCatalog(catalog); } rs = conn.getMetaData().getSchemas(); while (rs.next()) { String schema = rs.getString("TABLE_SCHEM"); System.out.println("schema:"+schema); } } catch (SQLException e) { e.printStackTrace(); } } ``` Produces when connected to database `foo` ``` Connected to jdbc:postgresql://localhost:5432/foo, setting catalog: foo schema:blah schema:information_schema schema:pg_catalog schema:public ``` and when connected to database `test` ``` Connected to jdbc:postgresql://localhost:5432/test, setting catalog: foo schema:information_schema schema:pg_catalog schema:public ```