fix: Fix Column Type Name for PostgreSQL ARRAY types#2409
fix: Fix Column Type Name for PostgreSQL ARRAY types#2409sakthivelmanii merged 1 commit intomainfrom
Conversation
src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSetMetaData.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Test | ||
| public void getColumnTypeNameForPostgreSQL() throws SQLException { |
There was a problem hiding this comment.
Can we add a test that verifies a type name in 'plain text'. That is: I suspect that the current implementation will return something like _varchar[] as the type name for a PostgreSQL array of varchar. That would be incorrect, as the correct name would be either _varchar or varchar[].
There was a problem hiding this comment.
now it will return _varchar. Maybe I will update the test to not to use TEST_COLUMNS but have two examples, only for ARRAY, REGULAR TYPE..
| return "_" + columnType.getArrayElementType().getSpannerTypeName(dialect); | ||
| } | ||
| } | ||
| return columnType.getCode().name(); |
There was a problem hiding this comment.
Should we fix this for more than only PostgreSQL arrays? The current implementation will (I think)
- Return
ARRAYfor all GoogleSQL arrays STRINGfor PostgreSQLvarcharcolumns (and so forth for each non-array type)
There was a problem hiding this comment.
The current implementation will (I think)
Return ARRAY for all GoogleSQL arrays
STRING for PostgreSQL varchar columns (and so forth for each non-array type)
Yes
Should we fix this for more than only PostgreSQL arrays?
Sorry? What do you mean by this?
There was a problem hiding this comment.
What I mean is that it is a bit weird that:
- GoogleSQL
ARRAY<STRING>returnsARRAY, while PostgreSQLARRAY<STRING>returns_varchar - PostgreSQL
STRINGreturnsSTRING(instead ofvarchar), while PostgreSQLARRAY<STRING>returns_varchar
There was a problem hiding this comment.
I see. we can change it. I don't think there will be a problem if we change it. So far ARRAY is the only thing which was concerning for me so I changed it.. Right now, there's a complex handling of types in PG. text == varchar == charater varying. We need to maintain one type which will be easy.
If you feel, we should do it, I can incorporate the change.
068f686 to
ce93987
Compare
ce93987 to
a53a171
Compare
🤖 I have created a release *beep* *boop* --- ## [2.35.4](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.35.3...v2.35.4) (2026-03-04) ### Bug Fixes * Fix Column Type Name for PostgreSQL ARRAY types ([#2409](https://togithub.com/googleapis/java-spanner-jdbc/issues/2409)) ([c171388](https://togithub.com/googleapis/java-spanner-jdbc/commit/c1713882f7d945b60aa9e305234535e0b5a37e6c)) * Fix UTC<->Timezone conversion issue for DST start and end timestamp ([#2260](https://togithub.com/googleapis/java-spanner-jdbc/issues/2260)) ([14837f8](https://togithub.com/googleapis/java-spanner-jdbc/commit/14837f8d195a338089eca1b2bfe316f030012967)) ### Dependencies * Update dependency com.fasterxml.jackson.core:jackson-databind to v2.21.1 ([#2406](https://togithub.com/googleapis/java-spanner-jdbc/issues/2406)) ([96f106e](https://togithub.com/googleapis/java-spanner-jdbc/commit/96f106e551d3c47a557fac2ec95aadb4d9cc1990)) * Update dependency com.google.api.grpc:proto-google-cloud-trace-v1 to v2.85.0 ([#2395](https://togithub.com/googleapis/java-spanner-jdbc/issues/2395)) ([8a214f8](https://togithub.com/googleapis/java-spanner-jdbc/commit/8a214f8b3ddb2c823dacc82ad1559cdf0db67004)) * Update dependency com.google.api.grpc:proto-google-cloud-trace-v1 to v2.86.0 ([#2407](https://togithub.com/googleapis/java-spanner-jdbc/issues/2407)) ([b542d69](https://togithub.com/googleapis/java-spanner-jdbc/commit/b542d696e171b894483b8a4bff5d0c7befaddd96)) * Update dependency com.google.cloud:google-cloud-spanner to v6.111.1 ([#2410](https://togithub.com/googleapis/java-spanner-jdbc/issues/2410)) ([39dd81b](https://togithub.com/googleapis/java-spanner-jdbc/commit/39dd81b9b456bea03a1018125c3f5db7e4ff047a)) * Update dependency com.google.cloud:google-cloud-spanner-bom to v6.111.1 ([#2411](https://togithub.com/googleapis/java-spanner-jdbc/issues/2411)) ([5e636ed](https://togithub.com/googleapis/java-spanner-jdbc/commit/5e636edb5712b90815c14f72d0d6e8d559642550)) * Update dependency com.google.cloud:google-cloud-trace to v2.85.0 ([#2396](https://togithub.com/googleapis/java-spanner-jdbc/issues/2396)) ([122545c](https://togithub.com/googleapis/java-spanner-jdbc/commit/122545c3b0b3c660defd9aeae37a9442a16ebd8f)) * Update dependency com.google.cloud:google-cloud-trace to v2.86.0 ([#2408](https://togithub.com/googleapis/java-spanner-jdbc/issues/2408)) ([6af6e48](https://togithub.com/googleapis/java-spanner-jdbc/commit/6af6e48cad6c6229058d68b599d96f4cdd64df40)) * Update dependency com.google.cloud:sdk-platform-java-config to v3.57.0 ([#2405](https://togithub.com/googleapis/java-spanner-jdbc/issues/2405)) ([8e54669](https://togithub.com/googleapis/java-spanner-jdbc/commit/8e54669eae29522a15da84f4aec819ca3305a25c)) * Update dependency net.bytebuddy:byte-buddy to v1.18.5 ([#2397](https://togithub.com/googleapis/java-spanner-jdbc/issues/2397)) ([6736c63](https://togithub.com/googleapis/java-spanner-jdbc/commit/6736c63fda79bfc1c2071b4de64e2e6bdd70594e)) * Update dependency net.bytebuddy:byte-buddy-agent to v1.18.5 ([#2398](https://togithub.com/googleapis/java-spanner-jdbc/issues/2398)) ([deaef26](https://togithub.com/googleapis/java-spanner-jdbc/commit/deaef26f58d865a995dc99562fa058091455bcb4)) * Update dependency org.springframework.boot:spring-boot to v4.0.3 ([#2403](https://togithub.com/googleapis/java-spanner-jdbc/issues/2403)) ([37aed98](https://togithub.com/googleapis/java-spanner-jdbc/commit/37aed98531e986827d8e5169ae434493d81059c2)) * Update dependency org.springframework.boot:spring-boot-starter-data-jdbc to v4.0.3 ([#2404](https://togithub.com/googleapis/java-spanner-jdbc/issues/2404)) ([385e930](https://togithub.com/googleapis/java-spanner-jdbc/commit/385e930f1d102fb3a35d300f8c838fdaf6a6617c)) * Update dependency org.springframework.boot:spring-boot-starter-parent to v3.5.11 ([#2402](https://togithub.com/googleapis/java-spanner-jdbc/issues/2402)) ([f451bca](https://togithub.com/googleapis/java-spanner-jdbc/commit/f451bca0f6aa24a3ea0e47361797186eafac34b1)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
PostgreSQL usually returns _ as column name for ARRAY types