cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql: bump the advertised pg compat version to 9.6 or later

Open jie-lyu opened this issue 8 years ago • 9 comments

The advertised pg compat version should be 9.6 or above.

Preferably 10 after enough client libraries / frameworks have been tested to confirm a high value does not disrupt compatibility.

Original issue description follows


Describe the problem

CockroachDB has a compatibility issue with JDBC driver.

CockroachDB claims to be Postgresql 9.5, however, in PgDatabaseMetaData.java#getIndexInfo, JDBC driver assumes column amcanorder to exist on table pg_am.

To Reproduce

  1. Set up CockroachDB cluster
  2. Set up a Spring Boot project and use JPA to manage the schema of the database.
  3. Set a non-unique index on a column
  4. Start the Java program, stop it, and start it again. JPA will try to validate the schema and leads to the exception.

Expected behavior Either CockroachDB should claim to be version 9.6+ or should have column amcanorder on table pg_am.

Additional data / screenshots

Java call stack https://pastebin.com/hqtkp5LD

Environment:

  • CockroachDB version: 2.1.1
  • Server OS: Docker on macOS
  • Client app: JDBC

Additional context

jie-lyu avatar Nov 27 '18 07:11 jie-lyu

Thank you for your analysis. Yes indeed this seems to be a shortcoming that needs to be corrected.

@awoods187 this will be needed for Spring compatibility and overall more compatibility with Java client.

knz avatar Nov 27 '18 11:11 knz

I'm also experiencing this using Spring Boot, JPA, and Hibernate.

aloucks avatar Dec 13 '18 22:12 aloucks

@knz what's the effort to address this?

awoods187 avatar Dec 14 '18 19:12 awoods187

The strategy would be split in 3 phases:

  • in the immediate term (with backport to 2.1) introduce an opt-in session parameter, customizable in the connection URL, to configure the pg version reported to the client.

  • in the short term (perhaps with backport to 2.1), add the missing column in pg_am. I think the work is minimal but I am not sure.

  • in the longer term (no backport, perhaps no earlier than 2.3) bump the pg version reported to clients to something more recent, at least 9.6 but perhaps 10 or 11

knz avatar Dec 14 '18 21:12 knz

As to your phases:

  • The customizable session parameter seems like unneeded work. Being able to customize the reported pg version means we would have to either support more than one version of pg or hope that setting the version to something we don't fully support will allow the client to proceed. I fear if they're hitting one introspection bug, changing the reported version may hit others.
  • Is now done in #33252
  • I'm in full agreement about having 2.2 or 2.3 report pg 10 or 11 and make sure all of the introspection tables match.

BramGruneir avatar Dec 18 '18 23:12 BramGruneir

Removing the severity label because pg_am now contains amcanorder.

knz avatar Jan 02 '19 13:01 knz

@rafiss @knz would it be possible to bump the postgres version to at least 10 to support EntGo?

kristiandrucker avatar Apr 29 '20 11:04 kristiandrucker

A version bump is overdue, I agree, but is not entirely trivial:

  • we must update a couple of the pg_catalog tables to adhere to the new post-v9.6 and v10 schemas
  • we must check for regression in our compatibility test suites

So I'd agree we want to do this but we can't do it casually either.

knz avatar Apr 29 '20 11:04 knz

Closing since #56248 was merged

rafiss avatar Jan 12 '21 19:01 rafiss