pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: kneth (@kneth) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3527: Improve compatibility with non-Postgres databases
Date: Tue, 18 Feb 2025 16:10:11 +0000
Message-ID: <[email protected]> (raw)
Postgres compatible databases like https://github.com/crate/crate can use PG JDBC as driver. Often the PG JDBC driver is used by a tool or integration (JetBrains DataGrip to name one). As CrateDB isn't fully PG compatible, and hopefully the PG JDBC can offer a more robust support. The issue has also been reported as https://github.com/crate/crate/issues/17393.
A patch to work around the differences between the two databases can be found in https://github.com/pgjdbc/pgjdbc/pull/3526.
**Describe the issue**
As far as I can see, a query as `SELECT current_database()` will return a different column name. For Postgres, the column name will be `current_database` while for CrateDB, the column name will be the name of the current database. The PG JDBC driver will try to access the column `current_database` - which does not exist in the CrateDB case (leading to an error or exception).
It means that https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMeta... will fail as the column name is not specified in https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMeta... .
**Driver Version?**
42.7.5
**Java Version?**
**OS Version?**
**PostgreSQL Version?**
**To Reproduce**
Any query with `current_database()` with the minimal case `SELECT current_database()`.
**Expected behaviour**
The driver should not throw an exception.
**Logs**
The following two screenshots show the difference between Postgres and CrateDB.


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 #3527: Improve compatibility with non-Postgres databases
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