sql: Inconsistent UPSERT behavior when DEFAULT columns are present #33327
Labels
A-sql-mutations
Mutation statements: UPDATE/INSERT/UPSERT/DELETE.
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
S-3-erroneous-edge-case
Database produces or stores erroneous data without visible error/warning, in rare edge cases.
Example #1: Column 'b' has no default value
Example #2: Column 'b' has default value
Example #3: Column 'b' has NULL default value
EXPECTED: All three results should be the same, namely
(1, 1, 2)
. If a column is not explicitly listed in the upsert, it should not be updated. Our docs (https://www.cockroachlabs.com/docs/stable/upsert.html) imply that only explicitly listed insert columns are translated into update columns. In addition, we should always treat nullable columns as if they wereDEFAULT(NULL)
- there should never be a semantic difference that depends on whetherDEFAULT(NULL)
is present or not. As another piece of data, VoltDB always returns(1, 1, 2)
.ACTUAL: Each of the three results is different, depending on the DEFAULT value for column 'b'.
The text was updated successfully, but these errors were encountered: