Skip to content

Column name for scalar function call should be the function name, not the evaluated literal (JDBC compat issue) #17393

@kneth

Description

@kneth

CrateDB version

5.9.6

CrateDB setup information

No response

Problem description

I have been working on Updating to pgjdbc 42.7.5 and I have a few test failing.

As far as I can see, a query as SELECT current_database() will return 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/PgDatabaseMetaData.java#L1273 will fail as the column name is not specified in https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java#L1253 .

The two screenshots show the difference between Postgres and CrateDB.

Image

Image

Steps to Reproduce

Calling any function - SELECT current_database() or SELECT sin(1) - in Postgres and CrateDB will show the difference.

Actual Result

For SELECT current_database() the column name is the name of the current database.

Expected Result

The column name should be the name of the function i.e., for SELECT current_database() the column name should be current_database.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions