Commit Graph

30 Commits

Author SHA1 Message Date
drh
7d44b22d45 Fix test cases so that they all still work even with -DSQLITE_DQS=0.
FossilOrigin-Name: 4883776669ee2f2310ea82b0d6df4d008eebaa7cb252102539cf21a635402ebb
2022-01-16 19:11:13 +00:00
dan
37f3ac8faa Change things so that SQLITE_OMIT_VIRTUALTABLE implies SQLITE_OMIT_ALTER_TABLE.
FossilOrigin-Name: 2f7c946c5f25a858167f5193ca06e53310394c8cff15426ab8a1327a1ec835fd
2021-10-01 20:39:50 +00:00
drh
7b14b65d20 Do not allow triggers that run as part of REPLACE conflict resolution
during an UPDATE to modify the the table being updated.  Otherwise, those
triggers might delete content out from under the update operation, leading
to all kinds of problems.  Ticket [314cc133e5ada126]

FossilOrigin-Name: db4b7e1dc399c1f16b827ac087aa37c0815f4b2f41f1ffad59963eead2ab5562
2019-12-29 22:08:20 +00:00
drh
be3da24134 Add the OP_FinishSeek opcode which completes an OP_DeferredSeek if the seek
has not already completed.  Also add the sqlite3WhereUsesDeferredSeek()
interface to the query planner.  The UPDATE implementation adds an
OP_FinishSeek before running the final OP_Insert if one is needed.
Ticket [ec8abb025e78f40c] and also an assertion fault reported by Yongheng.

FossilOrigin-Name: 21ef6e99331210b80fa7c71b4f02e8f768a748d01aef884368af2f6b51a067e0
2019-12-29 00:52:41 +00:00
drh
13d7950267 Enhance the sqlite3VdbeMemAboutToChange() shallow-copy validation mechanism
by adding the new OP_ReleaseReg opcode to tell MemAboutToChange() that a
range of registers is no longer needed so that the source register can be
freely changed.  This is a change to debugging and test builds only and
does not impact release builds.  Fix for ticket
[c62c5e58524b204d] and [5ad2aa6921faa1ee].  The previous fix to ticket
[5ad2aa6921faa1ee] is backed out by this change since this change is a better
fix.

FossilOrigin-Name: 36fdeb4f0a66970a35de688b617f90899c89cfdfab659f864df99aa7ebf854ea
2019-12-23 02:18:49 +00:00
drh
5d762b2d1d Make a hard copy of strings in constraint checks prior to applying
OP_RealAffinity, to avoid problems with a pointer accounting assert.
This change is not strictly necessary - the correct answer is obtained
without it and no UB occurs - however the pointer accounting asserts are
useful to prevent other problems so it is a simple matter to bring this
piece into compliance.  Ticket [5ad2aa6921faa1ee]

FossilOrigin-Name: 89a9dad6330270a4c3b962f86a208088d2ea9883c7d291351a77f058e0ed8b0c
2019-12-22 20:29:25 +00:00
drh
7a9698456d Fix a gramfuzz find. If a partial index that does not reference any column
of its table is used by an UPDATE statement in one-pass mode, then avoid the
use of OP_DeferredSeek since the seek might not be resolved prior to the
OP_Delete and OP_Insert that implement the UPDATE.

FossilOrigin-Name: e3398c5ffb060b2b26334b8598e2c63953741e2d6f5124dbd6bdfc8e94742539
2019-12-09 14:34:37 +00:00
drh
bb6b1ca73d Fix a problem in the new upsert implemention, discovered by OSSFuzz.
FossilOrigin-Name: b6d5ea59fe83716f464e408b7eef0310c6d30b3493e3f966362db2e30b36e821
2018-04-19 13:52:39 +00:00
drh
5e3a6ebf34 Fix the table name aliasing on INSERT so that it occurs before the column list
rather than afterwards, just as it does for PostgreSQL.  Add table name
aliasing to UPDATE and DELETE.

FossilOrigin-Name: 861a2e2a4895f96a5d8e1730e744983b2ac4311d0c2cf201c0e59f409030d5d7
2018-04-19 11:45:16 +00:00
drh
22e8d833f0 In the OP_Column opcode, when extracting a field that is past the end of
a short record (because the row was originally inserted prior to ALTER TABLE
ADD COLUMN) then make sure the output register is fully NULL and does not
contain leftover flags (such as MEM_Ephem) from its previous use.
Fix for ticket [43107840f1c02].

FossilOrigin-Name: 24780f8ddc1683fc62180e6961dc6bfe1168f4df
2014-10-29 00:58:38 +00:00
drh
f9c8ce3ced Standardize the error messages generated by constraint failures to a format
of "$TYPE constraint failed: $DETAIL".  This involves many changes to the
expected output of test cases.

FossilOrigin-Name: 54b221929744b1bcdbcc2030fef2e510618afd41
2013-11-05 13:33:55 +00:00
drh
80106e5c4b Enhancements to the change counter tests. Ticket #3013. (CVS 4986)
FossilOrigin-Name: 1aaed6a4694f60ebcec5dee98f09fe756c81dfa4
2008-04-10 18:44:36 +00:00
danielk1977
24acd8f939 Use 1<<$x instead of pow(2,$x) in the test suite code. (CVS 4715)
FossilOrigin-Name: 3a289b6d28bcf399845586b15f100d7c3a78b550
2008-01-16 18:20:41 +00:00
danielk1977
3e8c37e7f8 Modify test scripts to work when SQLITE_OMIT_SUBQUERY (along with other OMIT macros) is defined. (CVS 2251)
FossilOrigin-Name: bb0254ab14417f0ab40f10f37cb63a60507f070a
2005-01-21 03:12:14 +00:00
drh
8b07c7178a Improved test coverage for update.c. (CVS 2214)
FossilOrigin-Name: 3ef95d5fe98e7451f8b87b3f5259163f3e7d0289
2005-01-15 00:40:42 +00:00
drh
fb044c1d1c Perform updates in search order. Ticket #602. (CVS 1221)
FossilOrigin-Name: cf1cec74ae039cd7cbc8a1032d29f067dedb4210
2004-02-10 13:41:52 +00:00
drh
37ed48ed2f Provide a more informative error message when a uniqueness constraint
fails.  Ticket #419. (CVS 1068)

FossilOrigin-Name: 086aa1c9922b7bf399b3ee8b73ba7353d126b119
2003-08-05 13:13:38 +00:00
drh
ed717fe3b2 Enhance the "PRAGMA integrity_check" command to verify that all indices are
correctly constructed.  New calls to integrity_check are made in the test
suite. These changes are intended to prevent any future problems such
as seen in ticket #334. (CVS 1024)

FossilOrigin-Name: c9734c27074d2039a1896a8c6965c08d03711b13
2003-06-15 23:42:24 +00:00
drh
4303feedd3 Fix the pager so that correct rollbacks occur when synchronous is turned off.
This check-in also included unrelated documentation updates. (CVS 866)

FossilOrigin-Name: 3ef0ad8a4f2696a58aff9d812f90038c2c63f3fc
2003-02-15 23:09:17 +00:00
drh
483750ba8a Better error messages on constraint violations. Additional tests and bug fixes
for the callback-free API. (CVS 854)

FossilOrigin-Name: ccc82f1ab4539a60ee5cc2625743c5389f9ccd8e
2003-01-29 18:46:51 +00:00
drh
53e3fc70bf Fix for ticket #105: Fix the UPDATE command so that it works properly with
indexed tables when there is a subquery in the WHERE clause.  Add tests
to verify correct operation. (CVS 680)

FossilOrigin-Name: bbca16f88d00cd33ac7229edf3ee4623eff6e62f
2002-07-16 17:22:50 +00:00
drh
79b0c95687 Fix for ticket #45: Allow an UPDATE statement to change the INTEGER PRIMARY KEY
to itself without triggering a constraint error. (CVS 573)

FossilOrigin-Name: 592da1346872e1373bd13525d05d0f33c1056709
2002-05-21 12:56:43 +00:00
drh
04096485f4 Minor bugs fixed. (CVS 307)
FossilOrigin-Name: 6e7e7dbf8e93d00eced88404aed792fcf9e75b7d
2001-11-09 22:41:44 +00:00
drh
1bee3d7b43 Added support for the COUNT_CHANGES pragma in order to help out the
ODBC driver.  Fixed a but on count(*) when applied to empty tables. (CVS 289)

FossilOrigin-Name: 747bf1b30b74cfd0e9c27e7c0bc5172637f35520
2001-10-15 00:44:35 +00:00
drh
b19a2bc603 Disclaimed copyright. Preparing for release 2.0. (CVS 250)
FossilOrigin-Name: 4e926efe2b59adfec4086eb1d2ba830238facb4c
2001-09-16 00:13:26 +00:00
drh
4f3c63e475 fix the UPDATE bug (CVS 185)
FossilOrigin-Name: 99aae9aaa9f53d1be6600f8598f66594692aae39
2001-02-19 18:24:21 +00:00
drh
967e8b7351 :-) (CVS 104)
FossilOrigin-Name: e1bf96a467b739373191bf75e6a097fc0f24bffc
2000-06-21 13:59:10 +00:00
drh
6206d50a4a :-) (CVS 102)
FossilOrigin-Name: 8cce4d279de00da45c5970c8f0946f49e03e6846
2000-06-19 19:09:08 +00:00
drh
c837e70996 :-) (CVS 82)
FossilOrigin-Name: 33355b2d8d23b51e917961b7fb336bc1d454497f
2000-06-08 16:26:24 +00:00
drh
1d37e284f7 :-) (CVS 12)
FossilOrigin-Name: 20f2811fc19f937ed03bdb0e9d87a40c75452b17
2000-05-30 03:12:21 +00:00