mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Fix generated columns so that they play well with upsert.
See the [https://sqlite.org/forum/forumpost/73b9a8ccfb|forum post] by "iffycan" for details. FossilOrigin-Name: fa9d93cf32fac4b86044acf5d1b9ea2f36e964ed7142cf1d270986c9ef3fb766
This commit is contained in:
@ -560,4 +560,30 @@ do_catchsql_test gencol1-19.10 {
|
||||
INSERT INTO t0(c1) VALUES(0.16334143182538696), (0);
|
||||
} {1 {UNIQUE constraint failed: t0.c0}}
|
||||
|
||||
# 2020-06-29 forum bug report.
|
||||
# https://sqlite.org/forum/forumpost/73b9a8ccfb
|
||||
#
|
||||
do_execsql_test gencol1-20.1 {
|
||||
CREATE TEMPORARY TABLE tab (
|
||||
prim DATE PRIMARY KEY,
|
||||
a INTEGER,
|
||||
comp INTEGER AS (a),
|
||||
b INTEGER,
|
||||
x INTEGER
|
||||
);
|
||||
-- Add some data
|
||||
INSERT INTO tab (prim, a, b) VALUES ('2001-01-01', 0, 0);
|
||||
-- Check that each column is 0 like I expect
|
||||
SELECT * FROM tab;
|
||||
} {2001-01-01 0 0 0 {}}
|
||||
do_execsql_test gencol1-20.2 {
|
||||
-- Do an UPSERT on the b column
|
||||
INSERT INTO tab (prim, b)
|
||||
VALUES ('2001-01-01',5)
|
||||
ON CONFLICT(prim) DO UPDATE SET b=excluded.b;
|
||||
-- Now b is NULL rather than 5
|
||||
SELECT * FROM tab;
|
||||
} {2001-01-01 0 0 5 {}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user