]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
6 years agoHave "ALTER TABLE ADD COLUMN" reload the entire db schema, as "RENAME COLUMN" alter-table-rename-table
dan [Sat, 1 Sep 2018 16:05:50 +0000 (16:05 +0000)] 
Have "ALTER TABLE ADD COLUMN" reload the entire db schema, as "RENAME COLUMN"
and "RENAME TABLE" do.

FossilOrigin-Name: 8d89ddc1a628e983b0fbd929c9c9daac86ee23d18f8dd2709c971012389395c6

6 years agoMerge fixes from the alter-table-rename-column branch that occurred after
drh [Sat, 1 Sep 2018 15:55:44 +0000 (15:55 +0000)] 
Merge fixes from the alter-table-rename-column branch that occurred after
this branch separated from that one.

FossilOrigin-Name: 22e785aa2bbce4ae0852bc3d127d4b12222a192eb6e3ee874bf8e5c8582d05f3

6 years agoMerge fixes and enhancements from trunk.
drh [Sat, 1 Sep 2018 15:49:13 +0000 (15:49 +0000)] 
Merge fixes and enhancements from trunk.

FossilOrigin-Name: 589186c083ff3af8d5a6d5ad34e1cefea57806ebf3831ea3bf5a48ef1e173140

6 years agoUpdate test script snapshot_fault.test to account for the new
dan [Sat, 1 Sep 2018 06:13:07 +0000 (06:13 +0000)] 
Update test script snapshot_fault.test to account for the new
sqlite3_snapshot_open() error code.

FossilOrigin-Name: c1aca7673ab04740bc8ad76af0a72a229c79a0cd51cf84d1c689a77424ff17c6

6 years agoNew hyperlink on the README.md file.
drh [Fri, 31 Aug 2018 23:22:40 +0000 (23:22 +0000)] 
New hyperlink on the README.md file.

FossilOrigin-Name: c663961e34ec03ef76aabc9741f37d19544826e3e0b5931711313fc088e9e62c

6 years agoIf a call to sqlite3_snapshot_open() fails because the requested snapshot no
dan [Fri, 31 Aug 2018 19:00:16 +0000 (19:00 +0000)] 
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

6 years agoEnsure b-tree mutexes are always held when sqlite3FindTable() is called. Do
dan [Fri, 31 Aug 2018 18:23:53 +0000 (18:23 +0000)] 
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

6 years agoTry to identify the places in WAL code where thread-safety depends on the
drh [Thu, 30 Aug 2018 20:28:18 +0000 (20:28 +0000)] 
Try to identify the places in WAL code where thread-safety depends on the
underlying architecture supporting atomic load and store of aligned 32-bit
values.

FossilOrigin-Name: 47d44be4a68d377d0049a12b2587dbbcc0870b469473e1098f7c0358fe8c7532

6 years agoTest the schema after renaming a table. Ensure that temp database triggers and
dan [Thu, 30 Aug 2018 20:03:44 +0000 (20:03 +0000)] 
Test the schema after renaming a table. Ensure that temp database triggers and
views are updated when renaming a column.

FossilOrigin-Name: f3c27d916d4837f8fc3dd812bd004535f04c7a53bd2a0a2419613275f48bec76

6 years agoGive the debugging routine print_pager_stats() external linkage in order to
drh [Thu, 30 Aug 2018 18:53:09 +0000 (18:53 +0000)] 
Give the debugging routine print_pager_stats() external linkage in order to
suppress harmless compiler and TSAN warnings.

FossilOrigin-Name: ff4dc08298ab3988e69fe60802657791f65d2af15f4b1cbd1d02649bc597d0d6

6 years agoFix an ALTER TABLE problem with processing temp schema views and triggers.
dan [Thu, 30 Aug 2018 16:26:48 +0000 (16:26 +0000)] 
Fix an ALTER TABLE problem with processing temp schema views and triggers.

FossilOrigin-Name: 72cfb1be29971d91a164f1d4f20cb054de68960a0bd547630bcd1160565971c5

6 years agoImproved JSON parser caching.
drh [Thu, 30 Aug 2018 01:52:10 +0000 (01:52 +0000)] 
Improved JSON parser caching.

FossilOrigin-Name: 58078c0d2647a194279fa80e032670441b296ffc3acee692901faa5beca460b7

6 years agoAdditional test cases for geopoly.
drh [Wed, 29 Aug 2018 21:01:22 +0000 (21:01 +0000)] 
Additional test cases for geopoly.

FossilOrigin-Name: 19b5eb45e090c4b7169a52d881495ee2eafc59f80e3db2288fc1814ba76134ac

6 years agoExtend RENAME TABLE to edit triggers and views. Still buggy.
dan [Wed, 29 Aug 2018 21:00:16 +0000 (21:00 +0000)] 
Extend RENAME TABLE to edit triggers and views. Still buggy.

FossilOrigin-Name: 01308bae3acf33f78b5bb90892085eab340df093aafc17e6ccf6a7d6cf324897

6 years agoFixes to the UPDATE logic in Geopoly.
drh [Wed, 29 Aug 2018 20:52:40 +0000 (20:52 +0000)] 
Fixes to the UPDATE logic in Geopoly.

FossilOrigin-Name: 7c3cee0a2a5ccacff27400c38bd708f7b9b968eb013a8fa685d876dfe85e12a6

6 years agoAlso free up the MEM_RowSet bit in the Mem.flags field and have RowSet objects
drh [Wed, 29 Aug 2018 20:24:03 +0000 (20:24 +0000)] 
Also free up the MEM_RowSet bit in the Mem.flags field and have RowSet objects
be destroyed using Mem.xDel.  This change results in faster code.

FossilOrigin-Name: f48e9feb3fca514e4e586932e6d19a5e34a384204effeba553006dcddf5f13d2

6 years agoFree up the MEM_Frame bit in Mem.flags object. Store VdbeFrame objects
drh [Wed, 29 Aug 2018 18:47:22 +0000 (18:47 +0000)] 
Free up the MEM_Frame bit in Mem.flags object.  Store VdbeFrame objects
as MEM_Blob with a special Mem.xDel pointer instead.

FossilOrigin-Name: 62db5fd47660bbc4fcf2c6d4a6c5a3077f12c6442a128d22b66b789a0409ef32

6 years agoAdd the geopoly_group_bbox() aggregate function to the Geopoly module.
drh [Wed, 29 Aug 2018 15:50:47 +0000 (15:50 +0000)] 
Add the geopoly_group_bbox() aggregate function to the Geopoly module.

FossilOrigin-Name: 2d4debccbc027405a33aeb10f9d65f6fe4bfb5eb1be5a4d8b82158caba04643f

6 years agoDisable the server1.test script on old PPC Macs due to problems in the
drh [Tue, 28 Aug 2018 21:12:02 +0000 (21:12 +0000)] 
Disable the server1.test script on old PPC Macs due to problems in the
pthreads implementation on those archaic machines.

FossilOrigin-Name: 43efdd8c7e468405c9d4956a8caa66548059499289cbcc091628de7b055268cd

6 years agoStricter enforcement of the JSON and GeoJSON standards in the Geopoly extension.
drh [Tue, 28 Aug 2018 19:23:41 +0000 (19:23 +0000)] 
Stricter enforcement of the JSON and GeoJSON standards in the Geopoly extension.

FossilOrigin-Name: c0bf3ff3af4d34ef7801c16e39128e894b00699313f4915f57aa73b57642f7fd

6 years agoFix new issues in the geopoly module discovered by TH3.
drh [Tue, 28 Aug 2018 15:51:10 +0000 (15:51 +0000)] 
Fix new issues in the geopoly module discovered by TH3.

FossilOrigin-Name: 22fff9afc2fb20906173f258aa8feae9b52acc69a0ca7baf4e914d29c4279a23

6 years agoFix a problem causing spurious SQLITE_CORRUPT errors when using the snapshot
dan [Tue, 28 Aug 2018 11:23:52 +0000 (11:23 +0000)] 
Fix a problem causing spurious SQLITE_CORRUPT errors when using the snapshot
API to read from old database snapshots.

FossilOrigin-Name: 535155be584ad8c1836e6b1c62de836d9872056d39608c995221c928cb5b365d

6 years agoAdd support for the Geopoly extension to the R-Tree extension. This also
drh [Mon, 27 Aug 2018 17:13:12 +0000 (17:13 +0000)] 
Add support for the Geopoly extension to the R-Tree extension.  This also
involves adding the SQLITE_INDEX_CONSTRAINT_FUNCTION capability to the
xFindFunction method of the sqlite3_module object, and to the
sqlite3_index_info.aConstraint.op field in the xBestIndex implementation of
virtual tables.

FossilOrigin-Name: 666133e32ca8e95807f8437dc8401bc93e2e6508ab8e6ae1e6031b7cee1584ae

6 years agoMinor changes to the visual01.txt test script. rtree-geopoly
drh [Mon, 27 Aug 2018 17:05:59 +0000 (17:05 +0000)] 
Minor changes to the visual01.txt test script.

FossilOrigin-Name: 4bc28eed32154be0e62fe69acd30f828c2e6f59c6579618ecad8ecf632a90517

6 years agoSplit the three-argument version of geopoly_within() off into a separate
drh [Mon, 27 Aug 2018 15:55:37 +0000 (15:55 +0000)] 
Split the three-argument version of geopoly_within() off into a separate
function named geopoly_contains_point().

FossilOrigin-Name: 5a0e1541037b5bbc1b4bf26a7da304c9b32ea72960aca8b9309cf2180757c8a4

6 years agoEnhance the geopoly virtual table so that it does a better job of optimizing
drh [Sat, 25 Aug 2018 23:03:27 +0000 (23:03 +0000)] 
Enhance the geopoly virtual table so that it does a better job of optimizing
geopoly_within() queries.

FossilOrigin-Name: 1f717385340f295064a7649cfc36ad048573cbacb6faa20f5c6067328c40c745

6 years agoProvide the two-argument geopoly_within(P1,P2) routine that determines if
drh [Sat, 25 Aug 2018 19:51:49 +0000 (19:51 +0000)] 
Provide the two-argument geopoly_within(P1,P2) routine that determines if
polygon P2 is contained within polygon P1.  Make this function available to
the query planner for optimized rtree lookups.  Update the visual01.txt
script to verify that the new functionality actually works.

FossilOrigin-Name: 6eb5d09b7f9d9bf8edbf993dccc2e2f702b95ba96cf68445609feb0ccc3ac0f7

6 years agoFix a harmless compiler warning.
drh [Sat, 25 Aug 2018 18:57:12 +0000 (18:57 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: d49be9838d237b57ba1f12ed00e2d3411314ee1b9c30ef7bbaf65aca20d0870e

6 years agoFix a minor issue in the altercol.test script so that it runs on Windows.
drh [Sat, 25 Aug 2018 16:22:33 +0000 (16:22 +0000)] 
Fix a minor issue in the altercol.test script so that it runs on Windows.

FossilOrigin-Name: 62089c6daf9ea51be769c077c23d6fa881ba797255fa22d71baaac191a9c1ba7

6 years agoInvoke the authorizer for ALTER TABLE RENAME COLUMN.
drh [Sat, 25 Aug 2018 16:14:46 +0000 (16:14 +0000)] 
Invoke the authorizer for ALTER TABLE RENAME COLUMN.

FossilOrigin-Name: fc293bcb3402f049fb9e22aacfb4fdcd13f8609edf29c97d6cb95ce351363873

6 years agoRemove an unnecessary IN_RENAME_COLUMN macro from resolve.c.
drh [Sat, 25 Aug 2018 03:29:34 +0000 (03:29 +0000)] 
Remove an unnecessary IN_RENAME_COLUMN macro from resolve.c.

FossilOrigin-Name: 5858c0bde7c210f07cfa72cee95325847b26733abab4f56301b57cd816931e97

6 years agoThe implementation of sqlite_rename_column() must be holding the
drh [Sat, 25 Aug 2018 02:04:05 +0000 (02:04 +0000)] 
The implementation of sqlite_rename_column() must be holding the
schema mutexes.

FossilOrigin-Name: f0eed21d4e2e1f2c8e680a510a283ac21156c9766efec5b80a362a040424bce7

6 years agoFix a problem by renaming a column when the schema contains an trigger program
dan [Fri, 24 Aug 2018 20:20:33 +0000 (20:20 +0000)] 
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

6 years agoFix a problem with renaming a column that occurs as an "excluded.colname"
dan [Fri, 24 Aug 2018 20:10:22 +0000 (20:10 +0000)] 
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

6 years agoSet SQLITE_PTRSIZE to 4 when compiling with xlc on 32-bit AIX.
mistachkin [Fri, 24 Aug 2018 19:04:08 +0000 (19:04 +0000)] 
Set SQLITE_PTRSIZE to 4 when compiling with xlc on 32-bit AIX.

FossilOrigin-Name: d158e5b12eec5b81d54c8f5902a972795423947a21d0212b6cceb2810aa6cc5c

6 years agoAfter modifying and reparsing the schema as part of an ALTER TABLE RENAME
dan [Fri, 24 Aug 2018 17:55:49 +0000 (17:55 +0000)] 
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

6 years agoAvoid incorrectly replacing tokens that refer to a column being renamed via an
dan [Fri, 24 Aug 2018 16:04:26 +0000 (16:04 +0000)] 
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

6 years agoAdd the "atrc" test program to the Makefiles. Fix a typo in the instructions
drh [Thu, 23 Aug 2018 20:09:19 +0000 (20:09 +0000)] 
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

6 years agoFix harmless compiler warnings in the ALTER TABLE logic. Rephrase an
drh [Thu, 23 Aug 2018 19:32:04 +0000 (19:32 +0000)] 
Fix harmless compiler warnings in the ALTER TABLE logic.  Rephrase an
error message to use active voice.

FossilOrigin-Name: a7dae59a7e7b187fa2e9457bbb4b01cfe3d48bbdf59c3f8f7b4156bcde3bda98

6 years agoAutomatically detect when compiling for AArch64 on windows and set
drh [Thu, 23 Aug 2018 18:56:33 +0000 (18:56 +0000)] 
Automatically detect when compiling for AArch64 on windows and set
SQLITE_BYTEORDER to little-endian to avoid compile-time testing.

FossilOrigin-Name: ef6729be85ed106212ed23a024d83b85b709207cf287436c0603a21c659f36ad

6 years agoThe Expr.iColumn field must also be initialized in tokenExpr().
drh [Thu, 23 Aug 2018 18:50:19 +0000 (18:50 +0000)] 
The Expr.iColumn field must also be initialized in tokenExpr().

FossilOrigin-Name: 772985f18b2ab8fa04a0c29593fc6d9b74c1361260cb59e566606dd56f326535

6 years agoMake sure the Expr.iTable field is initialized by tokenExpr().
drh [Thu, 23 Aug 2018 18:22:00 +0000 (18:22 +0000)] 
Make sure the Expr.iTable field is initialized by tokenExpr().

FossilOrigin-Name: 02a05a3b3c6440432fc15daa14678a6eba40759e17e43ae8d63d19a0842de56a

6 years agoMerge enhancements from trunk.
drh [Thu, 23 Aug 2018 14:54:45 +0000 (14:54 +0000)] 
Merge enhancements from trunk.

FossilOrigin-Name: c446c8841192054c97ba5003fb6185b135a687b36c10fe0986e627282955520a

6 years agoFix a test case that was failing for SQLITE_ENABLE_STAT4 builds.
dan [Tue, 21 Aug 2018 17:03:25 +0000 (17:03 +0000)] 
Fix a test case that was failing for SQLITE_ENABLE_STAT4 builds.

FossilOrigin-Name: 1e29fd430dead641c5d92943ce81cf51b3df2f45c5a011bb2eed592efd62e056

6 years agoRename internal function sqlite3RenameToken() to sqlite3RenameTokenMap() and
dan [Tue, 21 Aug 2018 16:32:53 +0000 (16:32 +0000)] 
Rename internal function sqlite3RenameToken() to sqlite3RenameTokenMap() and
sqlite3MoveRenameToken() to sqlite3RenameTokenRemap().

FossilOrigin-Name: b9ae9a0a188b82d7066f6ef7d21592889df0a61559e9a0e01819e9d5a92c3f36

6 years agoRationalize some duplicated code in alter.c. Also improve error messages for
dan [Tue, 21 Aug 2018 15:06:59 +0000 (15:06 +0000)] 
Rationalize some duplicated code in alter.c. Also improve error messages for
ALTER TABLE RENAME COLUMN in some cases.

FossilOrigin-Name: 5d2163c734aea8c0e1611af1161734bf141e7bd02c08f0b5f2e7bac3c7dfd2a5

6 years agoFurther attempts to reduce the number of false-positives genenerated by
drh [Tue, 21 Aug 2018 12:46:34 +0000 (12:46 +0000)] 
Further attempts to reduce the number of false-positives genenerated by
static analysis tools.

FossilOrigin-Name: 38f9ce6503c4dd05ccdd73463b1784a6df7ed6e5018c29c5874a3681ca34ba54

6 years agoFix various harmless warnings generated by static analysis tools.
drh [Tue, 21 Aug 2018 12:16:33 +0000 (12:16 +0000)] 
Fix various harmless warnings generated by static analysis tools.

FossilOrigin-Name: a04a0ea9e30e0ef12bafa0b90b7d1b7764865768bb4a738b0c73a7a3ef9416db

6 years agoMinor changes to function tokenExpr() in order to claw back cycles lost to the
dan [Tue, 21 Aug 2018 08:29:48 +0000 (08:29 +0000)] 
Minor changes to function tokenExpr() in order to claw back cycles lost to the
rename-column change.

FossilOrigin-Name: 479976955ecb27c3e77a280187eaf23722178549e072b34f3183354a27a4e5c3

6 years agoAdd further tests for RENAME COLUMN.
dan [Mon, 20 Aug 2018 20:01:01 +0000 (20:01 +0000)] 
Add further tests for RENAME COLUMN.

FossilOrigin-Name: 82c4c10a96db76f39edf5f6d027294d449d75b5a18da70da3667786da90e184d

6 years agoEnsure that it is not possible to rename columns of system tables, views or
dan [Mon, 20 Aug 2018 16:16:05 +0000 (16:16 +0000)] 
Ensure that it is not possible to rename columns of system tables, views or
virtual tables.

FossilOrigin-Name: 786b5991dc0bb6ba13327a3ac9d04efbf8b591dedc736b719b206ffd865b1918

6 years agoAdditional fixes for harmless compiler warnings that are specific to this
drh [Sat, 18 Aug 2018 18:27:18 +0000 (18:27 +0000)] 
Additional fixes for harmless compiler warnings that are specific to this
branch.

FossilOrigin-Name: 9d8e73bf71e996b810959ffc0e60de69b5e8ca3301df52f9c35d5e9075921798

6 years agoMerge trunk fixes.
drh [Sat, 18 Aug 2018 18:14:02 +0000 (18:14 +0000)] 
Merge trunk fixes.

FossilOrigin-Name: ccad277927baa2c36d0b5a03832dc51d9a7f3071587f0da0f2c1b44885c82e8d

6 years agoHave ALTER TABLE RENAME COLUMN also edit trigger and view definitions.
dan [Sat, 18 Aug 2018 18:01:58 +0000 (18:01 +0000)] 
Have ALTER TABLE RENAME COLUMN also edit trigger and view definitions.

FossilOrigin-Name: 7908e8a4a3b9577211a5d3da9c4142c46e9d5872be4a6499ec053f2b547019b8

6 years agoImprovements to error handling in ALTER TABLE RENAME COLUMN. edit-trigger-wrapper
dan [Sat, 18 Aug 2018 17:35:38 +0000 (17:35 +0000)] 
Improvements to error handling in ALTER TABLE RENAME COLUMN.

FossilOrigin-Name: 7fa1faeaff30b74b68ee6f4b363d837f21cf313d8262361c901bda884df139a2

6 years agoFix harmless compiler warnings only seen with STAT4 enabled.
mistachkin [Fri, 17 Aug 2018 21:14:28 +0000 (21:14 +0000)] 
Fix harmless compiler warnings only seen with STAT4 enabled.

FossilOrigin-Name: 6f5e84bafcaf425cb664c7db8179c9c09a13c96aaf057551c04a919ca554d057

6 years agoAllow an ALTER TABLE RENAME COLUMN to proceed even if the schema contains a
dan [Fri, 17 Aug 2018 18:08:28 +0000 (18:08 +0000)] 
Allow an ALTER TABLE RENAME COLUMN to proceed even if the schema contains a
virtual table for which the module is unavailable.

FossilOrigin-Name: 7b72b2360a70eb1f788b3c4d745967dfedb2c80af6b2e146ba940a3741fd51a1

6 years agoEnsure that CREATE VIEW, TRIGGER or INDEX statements can be edited by ALTER
dan [Fri, 17 Aug 2018 17:18:16 +0000 (17:18 +0000)] 
Ensure that CREATE VIEW, TRIGGER or INDEX statements can be edited by ALTER
TABLE RENAME COLUMN even if they use collation-sequences or
user-defined-functions that are not available.

FossilOrigin-Name: 540014efd6a048373313c6cd9413de10d5d7114daf537cf5999ccf3c5c3f9358

6 years agoFurther progress on updating trigger programs as part of ALTER TABLE RENAME
dan [Thu, 16 Aug 2018 19:49:16 +0000 (19:49 +0000)] 
Further progress on updating trigger programs as part of ALTER TABLE RENAME
COLUMN.

FossilOrigin-Name: 3f47222b6e20e1c1ef41c0f7391c8b5c7648e2a2d6013303d155ad59ce27143a

6 years agoFix a harmless unused-variable compiler warning that only came up in certain
drh [Thu, 16 Aug 2018 16:24:24 +0000 (16:24 +0000)] 
Fix a harmless unused-variable compiler warning that only came up in certain
compile-time configurations.

FossilOrigin-Name: 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61

6 years agoFix EXPLAIN QUERY PLAN so that it describes IN operators implemented using
drh [Thu, 16 Aug 2018 15:29:40 +0000 (15:29 +0000)] 
Fix EXPLAIN QUERY PLAN so that it describes IN operators implemented using
a ROWID lookup.

FossilOrigin-Name: 60045fbf52162f15f2e18a4e392e80fab19bdbce242728b5e62b0894eac49dfd

6 years ago(no comment)
dan [Wed, 15 Aug 2018 20:28:39 +0000 (20:28 +0000)] 
(no comment)

FossilOrigin-Name: e272dc2b1c0edab59a40f32c77c81a3e636937280524161eff5669cb0046ad84

6 years agoAllow sqlite3_snapshot_open() to be called to change the snapshot after a read
dan [Wed, 15 Aug 2018 14:03:26 +0000 (14:03 +0000)] 
Allow sqlite3_snapshot_open() to be called to change the snapshot after a read
transaction is already open on database.

FossilOrigin-Name: 41399169954f9bef53c3fa89879f39823b80bd127f76cf60abbe24217878a571

6 years agoFix a problem when renaming an IPK column that is also part of a child key.
dan [Tue, 14 Aug 2018 21:05:35 +0000 (21:05 +0000)] 
Fix a problem when renaming an IPK column that is also part of a child key.

FossilOrigin-Name: 6e6a2bfdbbfd4ffc14be88962ff97bf3c626fef9d1a337715d2a4be1a657fb0d

6 years agoFix a problem when renaming an IPK column that is also part of a child key.
dan [Tue, 14 Aug 2018 21:03:38 +0000 (21:03 +0000)] 
Fix a problem when renaming an IPK column that is also part of a child key.

FossilOrigin-Name: ad15486022209205c65fb5ffdbe30a7b99379170451e6aff4bab6e90b549d6c7

6 years agoMerge latest trunk and ALTER TABLE error message improvements into this
dan [Tue, 14 Aug 2018 20:40:25 +0000 (20:40 +0000)] 
Merge latest trunk and ALTER TABLE error message improvements into this
branch.

FossilOrigin-Name: 7a45802dafaed3c058f59d1487fe8091e1f309cc5f0a5bcf2579f0bdd8e92d89

6 years agoDo not allow ALTER TABLE RENAME COLUMN on a virtual table.
drh [Tue, 14 Aug 2018 20:38:18 +0000 (20:38 +0000)] 
Do not allow ALTER TABLE RENAME COLUMN on a virtual table.

FossilOrigin-Name: f6d6b472713c21deace3fd52c0b0b6901d758af043c238f004fabe52b01f730c

6 years agoHave ALTER TABLE RENAME edit column references in CREATE VIEW statements.
dan [Tue, 14 Aug 2018 20:18:50 +0000 (20:18 +0000)] 
Have ALTER TABLE RENAME edit column references in CREATE VIEW statements.

FossilOrigin-Name: db829dc1a2d7afa49798a2fd32d1f070185b23e513416e65d8144fda24f23b50

6 years agoImproved error messages when an ALTER TABLE RENAME COLUMN fails due to a
drh [Tue, 14 Aug 2018 19:27:51 +0000 (19:27 +0000)] 
Improved error messages when an ALTER TABLE RENAME COLUMN fails due to a
duplicate column name.

FossilOrigin-Name: 37d11b8e8224a8b241ff57b9c4b9499db39dde4ddcb56ff8b03a3d08091a4c11

6 years agoMerge fixes and enhancements from trunk.
drh [Tue, 14 Aug 2018 18:12:33 +0000 (18:12 +0000)] 
Merge fixes and enhancements from trunk.

FossilOrigin-Name: dff0314b7e7ef2d04375ff21fbf89039bf5f64a9cdca53d7bc7120faacd92c06

6 years agoFix ALTER TABLE RENAME COLUMN in cases where the column being renamed is an
dan [Tue, 14 Aug 2018 16:18:19 +0000 (16:18 +0000)] 
Fix ALTER TABLE RENAME COLUMN in cases where the column being renamed is an
IPK declared with a separate PRIMARY KEY clause - "CREATE TABLE x(y INTEGER,
PRIMARY KEY(y))".

FossilOrigin-Name: 32ca8418df8735a6c53e53153f733579e514711f091e4e09ecce83db85fe4d85

6 years agoFix UPSERT so that it checks the target-constraint first and fires the
drh [Tue, 14 Aug 2018 15:12:52 +0000 (15:12 +0000)] 
Fix UPSERT so that it checks the target-constraint first and fires the
DO UPDATE if that constraint is violated regardless of whether or not
other constraints are in violation.  This aligns SQLite behavior with
what PostgreSQL does. Fix for ticket [908f001483982c43cdb476dfb590a1a].

FossilOrigin-Name: 529fb55e3d00472f13446117527b0896827b11e870b581af7fe7cbb7392ef3cd

6 years agoStop requiring the global VFS mutex to access the unixInodeInfo.pUnused field.
drh [Mon, 13 Aug 2018 22:50:34 +0000 (22:50 +0000)] 
Stop requiring the global VFS mutex to access the unixInodeInfo.pUnused field.
The unixInodeInfo mutex is sufficient.

FossilOrigin-Name: e3ea43dabf099dc2954c23d348638e7b2a8b9122d2994154bc649a2c09260c46

6 years agoTake extra precautions to ensure access to unixInodeInfo.pUnused is protected
drh [Mon, 13 Aug 2018 20:46:18 +0000 (20:46 +0000)] 
Take extra precautions to ensure access to unixInodeInfo.pUnused is protected
by all necessary mutexes.

FossilOrigin-Name: 8b1e0010b9e0b548a90087f4d25843d2b40f7e9551722ac587fa925d37b510c2

6 years agoEdit the WHEN and UPDATE OF clauses of trigger programs as part of ALTER TABLE
dan [Mon, 13 Aug 2018 17:14:26 +0000 (17:14 +0000)] 
Edit the WHEN and UPDATE OF clauses of trigger programs as part of ALTER TABLE
RENAME COLUMN.

FossilOrigin-Name: 5fdb6b0aafba727139e1937ef5950e4434a77f95a10fc46f8010ca2de3922326

6 years agoMake the sqlite_rename_column() SQL function resistant to problems caused
drh [Mon, 13 Aug 2018 17:02:26 +0000 (17:02 +0000)] 
Make the sqlite_rename_column() SQL function resistant to problems caused
by OOMs and/or malformed parameters submitted by hostile application code.
Also add additional comments to the RENAME COLUMN logic.

FossilOrigin-Name: 87743ddef11749b4017d60abc297abfd673e02a26a2ae45ffec861327578aa30

6 years agoFix legacy comments on Token. Begin commenting the new ALTER TABLE RENAME
drh [Mon, 13 Aug 2018 15:09:48 +0000 (15:09 +0000)] 
Fix legacy comments on Token.  Begin commenting the new ALTER TABLE RENAME
COLUMN code.  Fix a memory leak in the sqlite_rename_column() SQL function.

FossilOrigin-Name: 32edc8920376aabb84ebe1900eaa9512d23f1b44d6459e4916dc6b07db66e27c

6 years agoFix issues with ALTER TABLE RENAME COLUMN associated with OOM errors.
drh [Mon, 13 Aug 2018 13:43:11 +0000 (13:43 +0000)] 
Fix issues with ALTER TABLE RENAME COLUMN associated with OOM errors.

FossilOrigin-Name: 0b28dd5c2e4908d5e49eaedd359492e46de8af3bf84120f4683b3ea906882fbf

6 years agoFix an incorrect comment on the unix-nolock VFS object. No functional
drh [Mon, 13 Aug 2018 11:32:07 +0000 (11:32 +0000)] 
Fix an incorrect comment on the unix-nolock VFS object.  No functional
code changes.

FossilOrigin-Name: 90f7c193b42f0d8120a8e429bdea5e1cec5d3f45b901db8fc5a5c2ca3e69cba8

6 years agoAdd the "atrc" test program. "Atrc" is short for "ALTER TABLE RENAME COLUMN".
drh [Sat, 11 Aug 2018 20:46:54 +0000 (20:46 +0000)] 
Add the "atrc" test program.   "Atrc" is short for "ALTER TABLE RENAME COLUMN".
See the header comment on the program itself for further information.

FossilOrigin-Name: ed64a55a2242408ac0b889b330cf91d38a954399b75c6ebe71232613b864c70b

6 years agoIf the new column name in an ALTER TABLE RENAME COLUMN statement is quoted,
dan [Sat, 11 Aug 2018 20:38:33 +0000 (20:38 +0000)] 
If the new column name in an ALTER TABLE RENAME COLUMN statement is quoted,
then also use quotes for the column name in the edited SQL statements.

FossilOrigin-Name: ca5184a25f9150540a3e401ef67df0606efa7a294d70e3fa5edad9854003eb36

6 years agoAvoid an assert() sometimes triggered by ALTER TABLE RENAME COLUMN in non-debug builds.
dan [Sat, 11 Aug 2018 18:34:25 +0000 (18:34 +0000)] 
Avoid an assert() sometimes triggered by ALTER TABLE RENAME COLUMN in non-debug builds.

FossilOrigin-Name: 520c1c75dae5e3f4695fcdf0aad5fb9f492f0e528b5fbb49d5d3b5fc02762f47

6 years agoFix a bug causing ALTER TABLE RENAME COLUMN to fail when renaming an IPK
dan [Sat, 11 Aug 2018 17:49:23 +0000 (17:49 +0000)] 
Fix a bug causing ALTER TABLE RENAME COLUMN to fail when renaming an IPK
column that is used in a CHECK constraint.

FossilOrigin-Name: 6595c8811f13719d0aed8041abc7e1cade41c57427bcbf3503e2e42408eaa03b

6 years agoFix a bug causing all ALTER TABLE RENAME COLUMN commands to fail if ANALYZE
dan [Sat, 11 Aug 2018 17:34:38 +0000 (17:34 +0000)] 
Fix a bug causing all ALTER TABLE RENAME COLUMN commands to fail if ANALYZE
had been run on the database. Also prevent the user from renaming the columns
of system tables.

FossilOrigin-Name: ca644a2877c26561f8fb3b3feb74a070cd46621acb105577f04bc936c9b72a95

6 years agoReload the entire schema after renaming a column in order to ensure that the
dan [Sat, 11 Aug 2018 13:40:20 +0000 (13:40 +0000)] 
Reload the entire schema after renaming a column in order to ensure that the
schema for any tables for which parent key definitions were changed are
reloaded.

FossilOrigin-Name: f4497b0136e9fcb1121a834c86f84eeaf8f1e7d3157d409484e086bcef3487f1

6 years agoEnsure the schema cookie is changed when a column is renamed.
dan [Fri, 10 Aug 2018 20:19:34 +0000 (20:19 +0000)] 
Ensure the schema cookie is changed when a column is renamed.

FossilOrigin-Name: 2dec9ea4ab1779d00bb22add0aa9a8536661d8abc9f4c2fb8628e04d4cd84326

6 years agoFix harmless compiler warnings.
drh [Fri, 10 Aug 2018 19:33:09 +0000 (19:33 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 9564d7008c3fd804401a5da6ea342c6f4261db14e9f994d1a38883358a7c6f8c

6 years agoWhen a column is renamed, update any references to it in REFERENCES clauses
dan [Fri, 10 Aug 2018 19:19:33 +0000 (19:19 +0000)] 
When a column is renamed, update any references to it in REFERENCES clauses
that belong to other tables.

FossilOrigin-Name: 191079bd4f774528a1e39b71b4a4ce7859dee0edf0ce72e4b6968ae889dc35c8

6 years agoMerge latest trunk changes with this branch.
dan [Fri, 10 Aug 2018 15:27:55 +0000 (15:27 +0000)] 
Merge latest trunk changes with this branch.

FossilOrigin-Name: c355a8370782aa70f155ee956fa0faec7f45d7c483c442b169b63c5f0a988fd3

6 years agoFix a problem with renaming columns on tables with REFERENCES clauses that
dan [Fri, 10 Aug 2018 14:23:41 +0000 (14:23 +0000)] 
Fix a problem with renaming columns on tables with REFERENCES clauses that
specify a large number of columns.

FossilOrigin-Name: d48f7bbdf4a1686c25e634a8dec6ead88bf2866fee94ed8e5058f830363424a8

6 years agoFix the isLikeOrGlob() routine in the WHERE clause processing logic so that
drh [Thu, 9 Aug 2018 21:45:45 +0000 (21:45 +0000)] 
Fix the isLikeOrGlob() routine in the WHERE clause processing logic so that
it avoids signed/unsigned character comparisons, as that can lead to an
incorrect answer if the ESCAPE clause is an invalid UTF8 string.  Problem
found by OSSFuzz.

FossilOrigin-Name: 4195a3f8b5d2c2ec63771890c5aa7b5e2de60b9fa2273652730239b8577ae418

6 years agoExperimental implementation of ALTER TABLE ... RENAME COLUMN. Still buggy.
dan [Thu, 9 Aug 2018 20:47:01 +0000 (20:47 +0000)] 
Experimental implementation of ALTER TABLE ... RENAME COLUMN. Still buggy.

FossilOrigin-Name: fa0fc01eb48a864f0a3d43f9b805d5ed2e530846ee0c34fcbc2eabd9e5696277

6 years agoWhen a column must be a constant due to WHERE clause and the value of that
drh [Thu, 9 Aug 2018 18:36:54 +0000 (18:36 +0000)] 
When a column must be a constant due to WHERE clause and the value of that
column is being coded as a constant, make sure the affinity is correct.

FossilOrigin-Name: 7404ea83168e6c739ebe8fc5d65bbf0265432ccb35b3418bb0381d74362f7527

6 years agoMinor style improvements.
mistachkin [Wed, 8 Aug 2018 20:46:35 +0000 (20:46 +0000)] 
Minor style improvements.

FossilOrigin-Name: 60bbca2b9a591800cd8e7b374e62d75b1df0e8fd2d2f71f9b4d5fd044da78be0

6 years agoAllow sqlite3_snapshot_open() to be called to change the snapshot after a exp-snapshot-open
dan [Mon, 6 Aug 2018 17:12:36 +0000 (17:12 +0000)] 
Allow sqlite3_snapshot_open() to be called to change the snapshot after a
read transaction is already open on database.

FossilOrigin-Name: 051ac0152048ef52723196c26ca5f2629dafb782aec1c66fc30531bf54335043

6 years agoEnhance the edit() function so that it converts text from \r\n back into \n
drh [Mon, 6 Aug 2018 02:08:53 +0000 (02:08 +0000)] 
Enhance the edit() function so that it converts text from \r\n back into \n
only if the original unedited copy contained no \r\n values.

FossilOrigin-Name: 20c995d3f0f4de5410962172cb59da0f25edf0c62e199420186cc59ea874e981

6 years agoAdd the --info option to the fuzzcheck test utility.
drh [Mon, 6 Aug 2018 01:39:31 +0000 (01:39 +0000)] 
Add the --info option to the fuzzcheck test utility.

FossilOrigin-Name: 1caaaaa70f21fe71fbe0af227eea8d1367870e2575eedf248cc2a0b515783390

6 years agoFix an overzealous assert() statement discovered by OSSFuzz.
drh [Mon, 6 Aug 2018 01:21:53 +0000 (01:21 +0000)] 
Fix an overzealous assert() statement discovered by OSSFuzz.

FossilOrigin-Name: d9c9fe9f5ad3fc9123ad29ebafcb7f40dcecd448fb7a928bb31bea8181d81ec1

6 years agoRemove the column-cache from the code generator. The column-cache has been
drh [Sat, 4 Aug 2018 20:30:55 +0000 (20:30 +0000)] 
Remove the column-cache from the code generator.  The column-cache has been
a persistent source of bugs for years and with recent improvements
in the performance of OP_Column, it no longer provides a benefit.  After
the column cache is removed, the binary is almost 2KB smaller and the
speed-check.sh performance test is over 3 million cycles faster.

FossilOrigin-Name: cdff3af7bedc5ebea04bd9b5e2112d3db451a475c18c9a9ebd45f6f3a89a43cb

6 years agoRemove a testcase() that is no longer reachable without the column cache. omit-column-cache
drh [Sat, 4 Aug 2018 20:12:10 +0000 (20:12 +0000)] 
Remove a testcase() that is no longer reachable without the column cache.
Provide an assert() to help prove that the testcase is no longer reachable.

FossilOrigin-Name: a500893b6f64aced197cd32b79d51a481629a39d45dbcf0f02d65e5451ac4706