pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: Chitrae92 (@Chitrae92) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3729: PgDatabaseMetaData.getColumns returns duplicate columnNames
Date: Fri, 18 Jul 2025 01:31:15 +0000
Message-ID: <[email protected]> (raw)
Postgres jdbc version - **42.6.1**
Java version - 17
When we execute code to retrieve column names for a table with schema name having _ in them and there exists similar table in another schema, we currently get duplicate columns due to the like clause used in getColumns
Example:
**Schema Name:** test_ **Table Name:** tableA *Column Names* c1, c2
**Schema Name:** test1 **Table Name:** tableA *Column Names* c1, c2
PgDatabaseMetaData.getColumns function ends up returning c1, c2, c1, c2 when getting the column Names for test_.tableA since the LIKE clause satisfies for both the schema names. Is this expected by design? Should we not escape _ in schema or table names instead of treating them as wild characters.
if (schemaPattern != null && !schemaPattern.isEmpty()) {
sql += " AND n.nspname LIKE " + escapeQuotes(schemaPattern);
}
if (tableNamePattern != null && !tableNamePattern.isEmpty()) {
sql += " AND c.relname LIKE " + escapeQuotes(tableNamePattern);
}
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3729: PgDatabaseMetaData.getColumns returns duplicate columnNames
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox