cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql: prepared statement doesn't work with CHAR type

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

Describe the problem

When using Spring Batch with the default job repository using cockroach as the backend, SQL error happens.

In my understanding, when cockroach receives a prepared statement, it will decode the arguments by encoding.go#DecodeOidDatum.

In #28951, the handling of string types is improved. However, in the switch case statement inside DecodeOidDatum, oid.T_bpchar is not processed, leading to the error unsupported OID %v with format code %s.

To Reproduce

When Spring Batch is configured with the default options, the error will happen.

Expected behavior

oid.T_bpchar should be handled in DecodeOidDatum.

Additional data / screenshots

Environment:

  • CockroachDB version : 2.1.0
  • Server OS: Docker on macOS
  • Client app: JDBC / Spring Batch

Additional context

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

Thanks for your analysis!

knz avatar Nov 27 '18 10:11 knz

@mjibson could you have a look?

knz avatar Nov 27 '18 10:11 knz

Yes, I think we can easily support this.

madelynnblue avatar Nov 27 '18 19:11 madelynnblue