Merge fixes from the alter-table-rename-column branch that occurred after

this branch separated from that one.

FossilOrigin-Name: 22e785aa2bbce4ae0852bc3d127d4b12222a192eb6e3ee874bf8e5c8582d05f3
This commit is contained in:
drh 2018-09-01 15:55:44 +00:00
commit 010f8ee2fb
5 changed files with 87 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Merge\sfixes\sand\senhancements\sfrom\strunk. C Merge\sfixes\sfrom\sthe\salter-table-rename-column\sbranch\sthat\soccurred\safter\nthis\sbranch\sseparated\sfrom\sthat\sone.
D 2018-09-01T15:49:13.832 D 2018-09-01T15:55:44.527
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 6b650013511fd9d8b094203ac268af9220d292cc7d4e1bc9fbca15aacd8c7995 F Makefile.in 6b650013511fd9d8b094203ac268af9220d292cc7d4e1bc9fbca15aacd8c7995
@ -434,7 +434,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c 6fa0efb035dd6c1633c9b54425bbf65f89a402d131beffb93979686b21b7ec4e F src/alter.c 245152daa14007b02ecbab086b73fc0a9e372b9aad24b4178b6e5b2f802554c5
F src/analyze.c 3dc6b98cf007b005af89df165c966baaa48e8124f38c87b4d2b276fe7f0b9eb9 F src/analyze.c 3dc6b98cf007b005af89df165c966baaa48e8124f38c87b4d2b276fe7f0b9eb9
F src/attach.c 4bd5b92633671d3e8ce431153ebb1893b50335818423b5373f3f27969f79769a F src/attach.c 4bd5b92633671d3e8ce431153ebb1893b50335818423b5373f3f27969f79769a
F src/auth.c 32a5bbe3b755169ab6c66311c5225a3cd4f75a46c041f7fb117e0cbb68055114 F src/auth.c 32a5bbe3b755169ab6c66311c5225a3cd4f75a46c041f7fb117e0cbb68055114
@ -601,7 +601,7 @@ F test/alter.test 31b4e9128887457f1a7bdfea4764513204e88f09e33e89bc32b84fdd3d2122
F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060 F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060
F test/alter3.test 4d79934d812eaeacc6f22781a080f8cfe012fdc3 F test/alter3.test 4d79934d812eaeacc6f22781a080f8cfe012fdc3
F test/alter4.test b6d7b86860111864f6cddb54af313f5862dda23b F test/alter4.test b6d7b86860111864f6cddb54af313f5862dda23b
F test/altercol.test b89cd928c1e7513e569a18021f59754b164978860f5069bbebff703e4c7d2c50 F test/altercol.test 42250da2cba6d94fdf21a4c39d79c733911d18a7c1453216ef0f48c6c118966d
F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc
F test/altermalloc2.test 0231398534c494401a70a1d06a63d7849cb5b317fcc14228cbdb53039eba7eae F test/altermalloc2.test 0231398534c494401a70a1d06a63d7849cb5b317fcc14228cbdb53039eba7eae
F test/altertab.test 8c9631e9daca782905207c3c728c89181320d5ff8bfe1dc10cced233446a017f F test/altertab.test 8c9631e9daca782905207c3c728c89181320d5ff8bfe1dc10cced233446a017f
@ -635,7 +635,7 @@ F test/attach2.test 256bd240da1835fb8408dd59fb7ef71f8358c7a756c46662434d11d07ba3
F test/attach3.test c59d92791070c59272e00183b7353eeb94915976 F test/attach3.test c59d92791070c59272e00183b7353eeb94915976
F test/attach4.test 53bf502f17647c6d6c5add46dda6bac8b6f4665c F test/attach4.test 53bf502f17647c6d6c5add46dda6bac8b6f4665c
F test/attachmalloc.test 3a4bfca9545bfe906a8d2e622de10fbac5b711b0 F test/attachmalloc.test 3a4bfca9545bfe906a8d2e622de10fbac5b711b0
F test/auth.test 3d6cd8f3978ba55b1202574e6ecd79c6e00914ca44b9bfd6c1fe6fb873fcac88 F test/auth.test 4dd570df24d175f6c3a8988358e9ce884d86434edf8af0b396af97c97147ac57
F test/auth2.test 9eb7fce9f34bf1f50d3f366fb3e606be5a2000a1 F test/auth2.test 9eb7fce9f34bf1f50d3f366fb3e606be5a2000a1
F test/auth3.test db21405b95257c24d29273b6b31d0efc59e1d337e3d5804ba2d1fd4897b1ae49 F test/auth3.test db21405b95257c24d29273b6b31d0efc59e1d337e3d5804ba2d1fd4897b1ae49
F test/autoanalyze1.test b9cc3f32a990fa56669b668d237c6d53e983554ae80c0604992e18869a0b2dec F test/autoanalyze1.test b9cc3f32a990fa56669b668d237c6d53e983554ae80c0604992e18869a0b2dec
@ -1762,7 +1762,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P eac2aa7dce577f1998cc2078dd8ac384070f8acf1ceb565999a5cf719092024e c1aca7673ab04740bc8ad76af0a72a229c79a0cd51cf84d1c689a77424ff17c6 P 589186c083ff3af8d5a6d5ad34e1cefea57806ebf3831ea3bf5a48ef1e173140 62089c6daf9ea51be769c077c23d6fa881ba797255fa22d71baaac191a9c1ba7
R 34f28ccab2f7f9a4a506a2d90442b60b R 1d86d7939ae5916c3a0cbf5cee6b780f
U drh U drh
Z 50f92f34e3d19f5b5187cc33c2a11ab3 Z 720f2ed02ab0eac24853dcd860bc927c

View File

@ -1 +1 @@
589186c083ff3af8d5a6d5ad34e1cefea57806ebf3831ea3bf5a48ef1e173140 22e785aa2bbce4ae0852bc3d127d4b12222a192eb6e3ee874bf8e5c8582d05f3

View File

@ -646,6 +646,13 @@ void sqlite3AlterRenameColumn(
assert( iSchema>=0 ); assert( iSchema>=0 );
zDb = db->aDb[iSchema].zDbSName; zDb = db->aDb[iSchema].zDbSName;
#ifndef SQLITE_OMIT_AUTHORIZATION
/* Invoke the authorization callback. */
if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
goto exit_rename_column;
}
#endif
/* Make sure the old name really is a column name in the table to be /* Make sure the old name really is a column name in the table to be
** altered. Set iCol to be the index of the column being renamed */ ** altered. Set iCol to be the index of the column being renamed */
zOld = sqlite3NameFromToken(db, pOld); zOld = sqlite3NameFromToken(db, pOld);

View File

@ -246,6 +246,8 @@ do_execsql_test 6.3 {
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Triggers. # Triggers.
# #
db close
db2 close
reset_db reset_db
do_execsql_test 7.0 { do_execsql_test 7.0 {
CREATE TABLE c(x); CREATE TABLE c(x);

View File

@ -2133,6 +2133,75 @@ ifcapable {cte} {
} {1 {not authorized}} } {1 {not authorized}}
} ;# ifcapable cte } ;# ifcapable cte
#
# db eval {SELECT sql FROM temp.sqlite_master} {puts "TEMP: $sql;"}
# db eval {SELECT sql FROM main.sqlite_master} {puts "MAIN: $sql;"}
#
# MAIN: CREATE TABLE "t2"(a,b,c);
# MAIN: CREATE TABLE t4(a,b,c);
# MAIN: CREATE INDEX t4i1 ON t4(a);
# MAIN: CREATE INDEX t4i2 ON t4(b,a,c);
# MAIN: CREATE TABLE sqlite_stat1(tbl,idx,stat);
# MAIN: CREATE TABLE t1(a,b);
#
ifcapable altertable {
do_test 1.350 {
proc auth {code arg1 arg2 arg3 arg4 args} {
if {$code=="SQLITE_ALTER_TABLE"} {
set ::authargs [list $arg1 $arg2 $arg3 $arg4]
return SQLITE_OK
}
return SQLITE_OK
}
catchsql {
ALTER TABLE t1 RENAME COLUMN b TO bcdefg;
}
} {0 {}}
do_execsql_test auth-1.351 {
SELECT name FROM pragma_table_info('t1') ORDER BY cid;
} {a bcdefg}
do_test auth-1.352 {
set authargs
} {main t1 {} {}}
do_test 1.353 {
proc auth {code arg1 arg2 arg3 arg4 args} {
if {$code=="SQLITE_ALTER_TABLE"} {
set ::authargs [list $arg1 $arg2 $arg3 $arg4]
return SQLITE_IGNORE
}
return SQLITE_OK
}
catchsql {
ALTER TABLE t1 RENAME COLUMN bcdefg TO b;
}
} {0 {}}
do_execsql_test auth-1.354 {
SELECT name FROM pragma_table_info('t1') ORDER BY cid;
} {a bcdefg}
do_test auth-1.355 {
set authargs
} {main t1 {} {}}
do_test 1.356 {
proc auth {code arg1 arg2 arg3 arg4 args} {
if {$code=="SQLITE_ALTER_TABLE"} {
set ::authargs [list $arg1 $arg2 $arg3 $arg4]
return SQLITE_DENY
}
return SQLITE_OK
}
catchsql {
ALTER TABLE t1 RENAME COLUMN bcdefg TO b;
}
} {1 {not authorized}}
do_execsql_test auth-1.356 {
SELECT name FROM pragma_table_info('t1') ORDER BY cid;
} {a bcdefg}
do_test auth-1.357 {
set authargs
} {main t1 {} {}}
}
do_test auth-2.1 { do_test auth-2.1 {
proc auth {code arg1 arg2 arg3 arg4 args} { proc auth {code arg1 arg2 arg3 arg4 args} {
if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} { if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} {