sql: auto array type cast from '{}' in column default definition for better pg compatibility #33341
Labels
A-sql-pgcompat
Semantic compatibility with PostgreSQL
A-sql-typing
SQLtype inference, typing rules, type compatibility.
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
O-community
Originated from the community
Is your feature request related to a problem? Please describe.
I'm using scala backend and https://github.com/slick/slick and https://github.com/tminglei/slick-pg, and I'm trying to use cockroach with them.
slick-pg generates sql like below with array column defaults.
In postgres, that SQL works.
But in cockroach,
Error: pq: expected DEFAULT expression to have type string[], but ''{}'' has type string
occurs and sql should be fixed as below.Describe the solution you'd like
Automatically cast
'{}'
to its own column type.Describe alternatives you've considered
Modify https://github.com/tminglei/slick-pg to generate sql with type cast like
::text[]
, but I think fixing in cockroach would be better in pg-compatibility.Additional context
The text was updated successfully, but these errors were encountered: