fix: Fix Column Type Name for PostgreSQL ARRAY types#2409
fix: Fix Column Type Name for PostgreSQL ARRAY types#2409sakthivelmanii wants to merge 1 commit intomainfrom
Conversation
| } | ||
|
|
||
| @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.
465f42d to
1ee4d0b
Compare
1ee4d0b to
9affb40
Compare
PostgreSQL usually returns _ as column name for ARRAY types