Commit Graph

7073 Commits

Author SHA1 Message Date
dan b1e1a0fd2d Minor improvements to the permutations.test script. Most notably, a command
like "permutations.test alter%" now runs all test scripts with names that
match the LIKE pattern "alter%". Or, say, "permutations wal alter%" to run all
alter% tests in wal mode.

FossilOrigin-Name: 3e1a2f6614eacb65e1dffe64c6292c809fc5808be2d9d7d103cfc57d7b32fcd9
2018-09-18 16:06:42 +00:00
drh d4cb09e3d2 Disable the ORDER BY LIMIT optimization in queries using window functions.
This fixes a problem that was introduced by check-in [206720129ed2fa8875a286]
which attempted to fix ticket [9936b2fa443fec03ff25f9].  This changes is
a fix for the follow-in tocket [510cde277783b5fb5de628].

FossilOrigin-Name: c6c9585f294710829ca24b64d70a36fd9f409261dd0661367c6c4198cdbc4c81
2018-09-17 15:19:13 +00:00
dan 0208337c16 Add extra test for the fix on this branch. Also fix a
pointer-compare-after-free problem that occurs in similar cases.

FossilOrigin-Name: 1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca
2018-09-17 08:27:23 +00:00
drh 95f78d98b9 First proposed fix for the ALTER TABLE problem described by ticket
[b41031ea2b5372378cb3d2d]

FossilOrigin-Name: 05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056
2018-09-16 23:27:37 +00:00
drh 9b84f03556 Add the new "explain" virtual table in ext/misc. Use this virtual table
for additional test cases for the optimization that avoids updating indexes
on expressions when none of the columns changed by the UPDATE are in the
expression.

FossilOrigin-Name: 2404304cc15eaeee2744cf3c8f9cac0a544631c4f1060c5a17a78b43ca86edf0
2018-09-16 16:18:01 +00:00
drh e9816d82a7 Optimization: when doing an UPDATE on a table with indexes on an expression,
do not update the expression indexes if they do not refer to any of the
columns of the table being updated.

FossilOrigin-Name: a71b101635ed28a4c99734dabb20bd65ef1018c1d63ac143b7321cdb0fafa5d7
2018-09-15 21:38:48 +00:00
dan f86ff13206 Update releasetest.tcl to run "make test" as part of the "Fast-One"
configuration.

FossilOrigin-Name: d5ebfe1c75d336dac374d9cfa257e45e77ab51f9c2f24d1af615cbbe9dd83d9b
2018-09-13 17:11:51 +00:00
drh 396a103612 Fix a requirement mark on a test script. No changes to code.
FossilOrigin-Name: 628d5c0aa057c05c7cf84c330a51b8a44720c97250eadf0e5e8c750b7a2969c3
2018-09-13 13:17:14 +00:00
dan e8ab40d219 Fix an invalid pointer comparison triggered by renaming a table column when
there are views with explicit column names in the schema.

FossilOrigin-Name: 572de7e4e33562c72cd90790b267ba389370f21ddcaebc4db609fd76ae9b7ada
2018-09-12 08:51:48 +00:00
drh 15c42942b3 Do not do the byte-by-byte modifications in the resetdb.test script if the
reserved-byte flag in the DB header is non-zero, because in that case the
bytes will be in the wrong place and the test won't work.

FossilOrigin-Name: 0af18674ca5b34e67e1685be3adcdd99a7b8650589c6a7cde7ad9ef1852a8777
2018-09-11 19:05:32 +00:00
dan e3e79213b1 Fix a problem causing ENABLE_CURSOR_HINTS builds to segfault.
FossilOrigin-Name: e7033104fa8bd974a9a3d173200aa07a3aa3daade86e7eb65cad5d00b086969e
2018-09-11 13:38:35 +00:00
dan 30a7d7ddc5 Fix a test script issue in fts3ao.test.
FossilOrigin-Name: 74c381b573817d0212153278b5ee5d2238a27a727dcf7ee769365c47bb9fc40d
2018-09-10 19:34:06 +00:00
drh b7a002f836 Fix the LIKE optimization so that it is disabled when the LHS of the
expression does not have TEXT affinity and the RHS is the pattern '/%'
or the RHS begins with the escape character. Fix for ticket
[c94369cae9b561b1f996d0054b].

FossilOrigin-Name: f191431d63aba187000b5cbaf3e072ff5f1b1eef6a2a407fb4d1629bda4e4e8f
2018-09-10 12:40:57 +00:00
dan eb3fe0b9d4 Fix a problem with processing a "vtab.col IS NULL" expression within
the WHERE clause of a query when "vtab" is a virtual table on the rhs of a
LEFT JOIN.

FossilOrigin-Name: 83da4d4104ee1870a2a95bb5fa15ee6584c655d8b314b6b8ab97592dad4ee811
2018-09-10 12:17:16 +00:00
drh 6ee5a7b481 Fix multiple issues with the ORDER BY LIMIT optimization. This is the
proposed resolution to ticket [9936b2fa443fec03ff25].

FossilOrigin-Name: 206720129ed2fa8875a286266d05b99fb2caf8671e4b74b26a6286a2073fcd8b
2018-09-08 20:09:46 +00:00
dan b2802128d6 Add extra test case to altertab.test.
FossilOrigin-Name: 64c3ee3c255e4630ccd5002116d66fd2af6b12dbdd4a3bee5ed413c3ef87d33a
2018-09-07 18:56:31 +00:00
dan d5e6fef2a1 Fix a problem with renaming a non-temp table that has at least one temp
trigger and shares its name with a temp table.

FossilOrigin-Name: ceb60bd7e5f2a0a4247bff476fc6468227305467339ae0c24591be9d2b14bdde
2018-09-07 15:50:31 +00:00
dan 202a0274db Minor fixes for problems revealed by releasetest.tcl.
FossilOrigin-Name: 1a8aedc3376b7ae32fa7b2c367eedd483e2629908836efd10ee5bd1fe0784675
2018-09-07 11:51:21 +00:00
drh 9fd88e8db7 Fix an uninitialized variable in the OP_ParseSchema opcode that comes up
only if the schema is corrupt.

FossilOrigin-Name: 725808d4c59176f71787452c7e500b563fd99cfc8ece47b1efe01d5e207efe0d
2018-09-07 11:08:31 +00:00
dan 803507f863 In all.test, do not attempt to run the RBU tests in non-RBU builds.
FossilOrigin-Name: 10c3e5a0314470ee1ffc37b68445a2cb2054530346d5f5ed3ffbd6df8003cad0
2018-09-06 20:33:11 +00:00
dan c50f75df96 Fix a problem with ALTER TABLE when there are views or triggers in the schema
that contain "<expr> IS NULL" expressions.

FossilOrigin-Name: 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5d3c3
2018-09-06 18:56:36 +00:00
dan 1041a6a817 Fix a problem in ALTER TABLE with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: fa835145e63749e06e04bd50ff992afaeae05dcdd1df597d13911f944e62076b
2018-09-06 17:47:09 +00:00
dan 7ea1edb703 Fix test script problems causing SQLITE_OMIT_VIRTUALTABLE builds to fail.
FossilOrigin-Name: 37ad064e5f5704cf345d23b38b3f6d627fbcf20dbb78c8a91e96c9704760a1b8
2018-09-06 17:23:08 +00:00
dan 71998f03b5 Add new test file "alterauth.test".
FossilOrigin-Name: 00940265b18a3cf848602e1e0b3edbd935cb4309ef91a34b0d5746a258a47ae6
2018-09-06 16:24:23 +00:00
dan 1d85c6bf48 Ensure that the tbl_name column in the sqlite_temp_master table is updated
correctly as part of a RENAME TABLE operation.

FossilOrigin-Name: ffecfca511718e39e0003b380d5113755b8a11405a5bd80cc04503d9557f0842
2018-09-06 16:01:37 +00:00
dan 5921f2b9e7 Fix some test script errors. And an incorrect assert() in fts5.
FossilOrigin-Name: f804336f083d8d26314bb1ba34cec427675065a67cbe2bf00bb42e40752aeb33
2018-09-05 17:45:17 +00:00
dan 65372fa963 Improve the error messages emitted by RENAME TABLE.
FossilOrigin-Name: 6805b5900df5e6d3329cbad2660875ebe4069efe37b19575f527d153dc0882a1
2018-09-03 20:05:15 +00:00
dan 143df55d24 Add another test case to altertab.test.
FossilOrigin-Name: 828e8849faed85812c03215b00a2ba34cbb00dfa4d4afdcbd11300ba7fcf9743
2018-09-01 20:38:42 +00:00
dan b87a9a8a5e Fix a problem with renaming a column in a table that has a temp trigger that
references another attached database.

FossilOrigin-Name: 336b8a0923bf65b7a2c35811cb6dec0e262a0b31e534d2a6ab093d2afdb05c1f
2018-09-01 20:23:28 +00:00
drh 010f8ee2fb Merge fixes from the alter-table-rename-column branch that occurred after
this branch separated from that one.

FossilOrigin-Name: 22e785aa2bbce4ae0852bc3d127d4b12222a192eb6e3ee874bf8e5c8582d05f3
2018-09-01 15:55:44 +00:00
drh c840b428fc Merge fixes and enhancements from trunk.
FossilOrigin-Name: 589186c083ff3af8d5a6d5ad34e1cefea57806ebf3831ea3bf5a48ef1e173140
2018-09-01 15:49:13 +00:00
dan 6ae2454a67 Update test script snapshot_fault.test to account for the new
sqlite3_snapshot_open() error code.

FossilOrigin-Name: c1aca7673ab04740bc8ad76af0a72a229c79a0cd51cf84d1c689a77424ff17c6
2018-09-01 06:13:07 +00:00
dan 8d4b7a3fa8 If a call to sqlite3_snapshot_open() fails because the requested snapshot no
longer exists, return SQLITE_ERROR_SNAPSHOT instead of SQLITE_BUSY_SNAPSHOT.

FossilOrigin-Name: e07923128bb164efbafde29d49175b61f2ef44b2dfac5ae4ed61937945dfcf4c
2018-08-31 19:00:16 +00:00
dan 141e119a17 Ensure b-tree mutexes are always held when sqlite3FindTable() is called. Do
not invoke the authorizer callback when parsing schema items as part of ALTER
TABLE commands. Fix test script issues.

FossilOrigin-Name: eac2aa7dce577f1998cc2078dd8ac384070f8acf1ceb565999a5cf719092024e
2018-08-31 18:23:53 +00:00
dan 9d324823a8 Test the schema after renaming a table. Ensure that temp database triggers and
views are updated when renaming a column.

FossilOrigin-Name: f3c27d916d4837f8fc3dd812bd004535f04c7a53bd2a0a2419613275f48bec76
2018-08-30 20:03:44 +00:00
dan 0ccda96867 Fix an ALTER TABLE problem with processing temp schema views and triggers.
FossilOrigin-Name: 72cfb1be29971d91a164f1d4f20cb054de68960a0bd547630bcd1160565971c5
2018-08-30 16:26:48 +00:00
dan c9461ecc28 Extend RENAME TABLE to edit triggers and views. Still buggy.
FossilOrigin-Name: 01308bae3acf33f78b5bb90892085eab340df093aafc17e6ccf6a7d6cf324897
2018-08-29 21:00:16 +00:00
drh 8ab114c6a9 Disable the server1.test script on old PPC Macs due to problems in the
pthreads implementation on those archaic machines.

FossilOrigin-Name: 43efdd8c7e468405c9d4956a8caa66548059499289cbcc091628de7b055268cd
2018-08-28 21:12:02 +00:00
dan f5778751f7 Fix a problem causing spurious SQLITE_CORRUPT errors when using the snapshot
API to read from old database snapshots.

FossilOrigin-Name: 535155be584ad8c1836e6b1c62de836d9872056d39608c995221c928cb5b365d
2018-08-28 11:23:52 +00:00
drh 050398bdf1 Fix a minor issue in the altercol.test script so that it runs on Windows.
FossilOrigin-Name: 62089c6daf9ea51be769c077c23d6fa881ba797255fa22d71baaac191a9c1ba7
2018-08-25 16:22:33 +00:00
drh 0d019b9243 Invoke the authorizer for ALTER TABLE RENAME COLUMN.
FossilOrigin-Name: fc293bcb3402f049fb9e22aacfb4fdcd13f8609edf29c97d6cb95ce351363873
2018-08-25 16:14:46 +00:00
dan aa42e9816b Fix a problem by renaming a column when the schema contains an trigger program
featuring an UPSERT that uses an "excluded.*" reference to a different table.

FossilOrigin-Name: 83d5f5abce6be2f6d342a6fc68839289400d7bcb80eaa38194789142c93a80c3
2018-08-24 20:20:33 +00:00
dan 85a9d508df Fix a problem with renaming a column that occurs as an "excluded.colname"
construction in an UPSERT that is part of a trigger program.

FossilOrigin-Name: bb2f7234968157b605522dea8e115d8772ab4234147894089d6e48fedf5d6a5d
2018-08-24 20:10:22 +00:00
dan 0d5fa6b979 After modifying and reparsing the schema as part of an ALTER TABLE RENAME
COLUMN, check that no new schema errors have been introduced (e.g. ambiguous
column names in views) before committing the operation.

FossilOrigin-Name: a0e06d2c5e3abb3f300491e7651bb177a436899efd4506de9239359096b6a9e7
2018-08-24 17:55:49 +00:00
dan 1b0c5de434 Avoid incorrectly replacing tokens that refer to a column being renamed via an
alias. For example, do not overwrite "xyz" when "a" is renamed in "CREATE VIEW
v1 AS SELECT a AS xyz FROM tbl WHERE xyz=1"

FossilOrigin-Name: ad072a835f97ff418f5919d94f547ce8afb4fc7c7b590deba41f1e62136a79ac
2018-08-24 16:04:26 +00:00
drh 355f2e02e9 Add the "atrc" test program to the Makefiles. Fix a typo in the instructions
in the header comment of the atrc program.

FossilOrigin-Name: 2130a407ddd8cdf3d29b109d773686c84906d9dc1663376e94e191086d524c9e
2018-08-23 20:09:19 +00:00
drh 79a5ee93c7 Fix harmless compiler warnings in the ALTER TABLE logic. Rephrase an
error message to use active voice.

FossilOrigin-Name: a7dae59a7e7b187fa2e9457bbb4b01cfe3d48bbdf59c3f8f7b4156bcde3bda98
2018-08-23 19:32:04 +00:00
dan 79e9d34764 Fix a test case that was failing for SQLITE_ENABLE_STAT4 builds.
FossilOrigin-Name: 1e29fd430dead641c5d92943ce81cf51b3df2f45c5a011bb2eed592efd62e056
2018-08-21 17:03:25 +00:00
dan 0624939818 Rationalize some duplicated code in alter.c. Also improve error messages for
ALTER TABLE RENAME COLUMN in some cases.

FossilOrigin-Name: 5d2163c734aea8c0e1611af1161734bf141e7bd02c08f0b5f2e7bac3c7dfd2a5
2018-08-21 15:06:59 +00:00
dan b013738b4c Add further tests for RENAME COLUMN.
FossilOrigin-Name: 82c4c10a96db76f39edf5f6d027294d449d75b5a18da70da3667786da90e184d
2018-08-20 20:01:01 +00:00