0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-12-01 17:23:42 +01:00

Fix a problem in VIEW creation that was introduced by the generated columns

feature.

FossilOrigin-Name: 9c795c4d2b042d2932774bd1274fa0167ca2dc9838e127e0cf31eb9273a32f2c
This commit is contained in:
drh 2019-11-02 17:59:10 +00:00
parent 089c4bc2e2
commit 0383661414
5 changed files with 27 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C "STORED"\sis\snot\sactually\sa\skeyword.\s\sThe\sparser\slooks\sfor\sSTORED\sas\san\nordinary\sidentifier.
D 2019-11-02T13:45:03.983
C Fix\sa\sproblem\sin\sVIEW\screation\sthat\swas\sintroduced\sby\sthe\sgenerated\scolumns\nfeature.
D 2019-11-02T17:59:10.372
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -470,7 +470,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c 12e251f8c3eaad05e6d0db94772bf779b3a644e18d884025da6bcbc98cad1d22
F src/btree.h f27a33c49280209a93385e218306c4ee5f46ba8d7649d2f81a7166b282232484
F src/btreeInt.h 91806f01fd1145a9a86ba3042f25c38d8faf6002701bf5e780742cf88bcff437
F src/build.c 7afa8336eb6e154a9d687a57d6784d8f0ddcdb38ff5c266f7b595f8e737edd89
F src/build.c 572d85d338189e48904b059d28cfc2f9099abfdc4f746142286fa1c0f1778a71
F src/callback.c 88615dfc0a82167b65b452b4b305dbf86be77200b3343c6ffc6d03e92a01d181
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 1b0724e66f95f33b160b1af85caaf9cceb325d22abf39bd24df4f54a73982251
@ -825,7 +825,7 @@ F test/e_createtable.test 1c602347e73ab80b11b9fa083f47155861aaafcff8054aac9e0b76
F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e
F test/e_droptrigger.test 3cd080807622c13e5bbb61fc9a57bd7754da2412
F test/e_dropview.test 21ce09c361227ddbc9819a5608ee2700c276bdd5
F test/e_expr.test e6048fe3901241799c4315bdd625f39dae790ff089c454979ca85f03b644dc6f
F test/e_expr.test 3513cb7041192174c81a5078f89a20992b8b9c12b4ee5e287683f9fdd4484847
F test/e_fkey.test 2febb2084aef9b0186782421c07bc9d377abf067c9cb4efd49d9647ae31f5afe
F test/e_fts3.test 17ba7c373aba4d4f5696ba147ee23fd1a1ef70782af050e03e262ca187c5ee07
F test/e_insert.test f02f7f17852b2163732c6611d193f84fc67bc641fb4882c77a464076e5eba80e
@ -1572,7 +1572,7 @@ F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
F test/transitive1.test 293300f46916569f08875cdb2fe2134be2c27677
F test/trigger1.test 746dc327e2a0817a22bfc6f5a5e423483d3e77b3733ac20a8fe939e6541b5e53
F test/trigger2.test 5cd7d69a7ba1143ee045e4ae2963ff32ae4c87a6
F test/trigger2.test d15da46f7012832faf3e0c536b47024409d5fb1722d2bb77e29c06d96d704bb1
F test/trigger3.test aa640bb2bbb03edd5ff69c055117ea088f121945
F test/trigger4.test 74700b76ebf3947b2f7a92405141eb2cf2a5d359
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
@ -1849,7 +1849,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 17e9f65814264de9c35bc5ba94e0a66fbbf1200c00d33ab9a19a0b6f92bc685a
R 859d886250160583161fe272329158d1
P 167cd574d6a1d4fe2253f5bc5aaa7b031cbc82853e4d33b8d9b72eaf049003d4
R 794e59eee68ad1454caf01bc0c6b2777
U drh
Z bd1f5e3871f2cd3e6943e58f0dd8ace6
Z 3ce02ac4b8e69a52ea025b6134fd1022

View File

@ -1 +1 @@
167cd574d6a1d4fe2253f5bc5aaa7b031cbc82853e4d33b8d9b72eaf049003d4
9c795c4d2b042d2932774bd1274fa0167ca2dc9838e127e0cf31eb9273a32f2c

View File

@ -2625,7 +2625,7 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
** the column names from the SELECT statement that defines the view.
*/
assert( pTable->aCol==0 );
pTable->nCol = pTable->nNVCol = pSelTab->nCol;
pTable->nCol = pSelTab->nCol;
pTable->aCol = pSelTab->aCol;
pSelTab->nCol = 0;
pSelTab->aCol = 0;
@ -2634,6 +2634,7 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
pTable->nCol = 0;
nErr++;
}
pTable->nNVCol = pTable->nCol;
sqlite3DeleteTable(db, pSelTab);
sqlite3SelectDelete(db, pSel);
EnableLookaside;

View File

@ -1909,9 +1909,6 @@ foreach {tn sql} {
# EVIDENCE-OF: R-18318-14995 The value of a subquery expression is the
# first row of the result from the enclosed SELECT statement.
#
# EVIDENCE-OF: R-15900-52156 In other words, an implied "LIMIT 1" is
# added to the subquery, overriding an explicitly coded LIMIT.
#
do_execsql_test e_expr-36.3.1 {
CREATE TABLE t4(x, y);
INSERT INTO t4 VALUES(1, 'one');

View File

@ -752,8 +752,23 @@ do_test trigger2-9.1 {
}
} {}
integrity_check trigger2-9.99
# 2019-11-02 Problem found by TH3, related to generated column support.
db close
sqlite3 db :memory:
do_execsql_test trigger2-10.1 {
CREATE TABLE t1(a,b,c,d);
CREATE VIEW v2(a,b,c,d) AS SELECT * FROM t1;
CREATE TRIGGER v2ins INSTEAD OF INSERT ON v2 BEGIN
INSERT INTO t1(a,b,c,d) VALUES(new.a, new.b, new.c, new.d);
END;
INSERT INTO v2(a,d) VALUES(11,14);
SELECT * FROM t1;
} {11 {} {} 14}
} ;# ifcapable view
integrity_check trigger2-9.9
integrity_check trigger2-999
finish_test