release-22.1: sql: fix assignment casts of arrays #102811
Merged
+29
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/6 commits from #102491.
/cc @cockroachdb/release
sql: fix assignment casts of arrays
This commit fixes a bug that caused incorrect results for assignment
casts of array types. Previously, the array's elements were casted as an
explicit cast, not an assignment cast. This allowed values to be
inserted into an array column that did not conform to the type.
Fixes #102412
Release note (bug fix): A bug has been fixed that allowed values to be
inserted into an
ARRAY
-type column that did not conform to theinner-type of the array. For example, it was possible to insert
ARRAY['foo']
into a column of typeCHAR(1)[]
. This could causeincorrect results when querying the table. The insert now errors, which
is expected. This bug was present since v21.1.
Release justification: Fix for a correctness bug related to assignment
casts.