Skip to content

BIT type not nullable but BOOLEAN is #919

@Clamatius

Description

@Clamatius

Seems like a straightforward bug. BIT seems otherwise supported. Types.BOOLEAN works fine.

According to the spanner docs:

For nullable data types, NULL is a valid value. Currently, all existing data types are nullable.

so I'd expect BIT to be nullable too.

Steps to reproduce

  1. Set a null parameter in SQL which ends up evaluating to BIT type. The corresponding database column will be nullable BOOL.
  2. IllegalArgumentException at runtime

Stack trace

java.lang.IllegalArgumentException: Unsupported sql type for setting to null: -7
com.google.cloud.spanner.jdbc.JdbcParameterStore.setNullValue(JdbcParameterStore.java:912)
at com.google.cloud.spanner.jdbc.JdbcParameterStore.setSingleValue(JdbcParameterStore.java:415)
at com.google.cloud.spanner.jdbc.JdbcParameterStore.setValue(JdbcParameterStore.java:402)
at com.google.cloud.spanner.jdbc.JdbcParameterStore.bindParameterValue(JdbcParameterStore.java:384)
at com.google.cloud.spanner.jdbc.JdbcPreparedStatement.createStatement(JdbcPreparedStatement.java:61)
at com.google.cloud.spanner.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:80) 

External references such as API reference guides

https://cloud.google.com/spanner/docs/reference/standard-sql/data-types for the "all existing data types are nullable"

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/java-spanner-jdbc API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions