Commit Graph

84 Commits

Author SHA1 Message Date
drh
da653b897d Improve EXPLAIN QUERY PLAN output and comments on bytecode listings by
distinguishing between "subquery" and "join" and using consistent names
across EQP and bytecode.

FossilOrigin-Name: a2d3ee92420ec564e31eb0005367cf7ff3d00bfaed5a98ffdbe17c91c95d9d97
2022-04-22 17:36:10 +00:00
drh
329eaaf0b3 Fix incorrect test name labels in the select1.test script.
FossilOrigin-Name: 179c79ea0deb0f5adaa8d369cfcad06d959a9cc18a8a41e01ef013b2d90acd61
2021-02-13 18:14:15 +00:00
drh
9bb612f2c8 Fix a faulty assert() statement. Add new test cases.
FossilOrigin-Name: 80ecdb3da4558bb08ee3ec6edbde906ad5b3b8182e672b5ba0d5dfa8041cee0a
2020-10-02 12:42:51 +00:00
drh
90996885fc Fix the OP_Copy-coalesce optimization so that if the previous row happens
to end with OP_Copy but is not a candidate for the optimization due to jumps,
then the optimization is correctly bypassed.

FossilOrigin-Name: b36126c1889e323c9a8f04b4f4884576993c845e7d393e5e73aaa6ab5158c1f9
2020-01-03 14:16:43 +00:00
drh
fc705da15d When generating code for a subquery, make a copy of the Select object and
generate the code out of the copy, in case the code generator makes
modifications to expression and the Select object needs to be reused.

FossilOrigin-Name: 4edddcc0bc8d71e9b8abac67bc3766f1d9143dddd1f59264859ce65e5aa9b8c6
2020-01-01 21:14:30 +00:00
drh
50efa58600 Remove an assert() in the code generator that can fail due to an invalid
INSERT statement.  The same assert() appears again in the VDBE and will fire
there if the problem persists in an SQL statement that does not contain
errors.  Gramfuzz find.

FossilOrigin-Name: 9bdd57cb9ad8ac1f4a0f1a3942d94ca5193109eeb1975343c4f0c7abf7135946
2019-12-18 01:31:21 +00:00
drh
00c12a51e3 Fix faulty asserts in the code generator.
Ticket [c52b09c7f38903b1]

FossilOrigin-Name: 01cdc590f7894ea23ee0d674747d7ebf8196efbef3c87d47e72dbc1ab6ae2883
2019-07-24 23:15:19 +00:00
drh
375afb8bda Fix a problem in the code generator for sorting results with SRT_EphemTab
and a LIMIT clause.

FossilOrigin-Name: 49fcde2f1f981ac0c75728bed3444e7c1d3167311db282d3375c96ce090b2210
2019-01-16 19:26:31 +00:00
drh
6116ee4eee Compute the correct column name even if the column identifier is the
very last token in the SQL statement.  This fixes a problem introduced
by check-in [0fdf97efe5df745510c6b] and reported by the community during
beta-testing.

FossilOrigin-Name: 36b89d728ff13d395fe0e1db8e7c01263f73dccb278b3ece27f6ef78e909b492
2018-01-10 00:40:06 +00:00
drh
23768298d2 Better names for subqueries in EXPLAIN comments.
FossilOrigin-Name: 04ef40a8fea88776e0d8b73d942922d45d0c038fbfac1a9a82b9322181b4ad92
2017-09-29 12:12:52 +00:00
drh
b8289a8b00 Fix a faulty assert() in sqlite3SelectNew().
FossilOrigin-Name: 620d19c3b462f5c4763ebd26513321431f21dd72
2015-04-17 15:16:58 +00:00
dan
5b1c07e7fb Ensure the sqlite3Select() routine always returns non-zero if an error has occurred.
FossilOrigin-Name: b51028ed2f57f4245a7ebd9bdb99d1bcfaf1a01b
2015-04-16 07:19:23 +00:00
drh
b50596d64d Rollback some of the previous changes in the branch such that the estimated
row sizes are now only used as a tie-breaker for index scans.

FossilOrigin-Name: 65553ff34b41e54d129ff2fee96be714105503c4
2013-10-08 20:42:41 +00:00
drh
63296052a1 Fix an obscure bug that causes a crash when parsing certain invalid SQL
statements.

FossilOrigin-Name: c8c7846fb990199dcc0774a69e8257510bc36f2d
2012-02-23 17:35:28 +00:00
drh
33e619fc1c Additional refinements to Expr handling. Restore compression of trigger
expressions.  Change Expr.zToken to Expr.u.zToken and added Expr.u.iValue.
Remove an unnecessary ExprDup from CHECK constraint processing.  And so forth. (CVS 6682)

FossilOrigin-Name: 4ac2bdfbb4230b6ceaae87e738fa61036bbe03cb
2009-05-28 01:00:55 +00:00
drh
b7916a78ff Simplifications to the Expr object: Remove Expr.span completely and convert
Expr.token into a char* Expr.zToken.  Also simplify the Token object by
removing the Token.dyn and Token.quoted fields. (CVS 6681)

FossilOrigin-Name: 7cb1c3ba0759539cb035978fdaff6316775986f3
2009-05-27 10:31:29 +00:00
danielk1977
a3f065980e Move the asynchronous IO code from src/test_async.c to ext/async/. Refactor it to be a standalone module and to support windows. (CVS 6539)
FossilOrigin-Name: e71fb0fb8d83b4453c3c1e84606bf58d04926809
2009-04-23 14:58:39 +00:00
drh
01e61eecb3 Disable the select1-15 tests when locking_mode is EXCLUSIVE. Ticket #3771. (CVS 6484)
FossilOrigin-Name: 88cefbb4a12ab7037f025141ddbe041ea82a6c61
2009-04-10 15:38:42 +00:00
danielk1977
e1fb65a0b8 Ensure the required VerifyCookie/Transaction/TableLock opcodes are added for "x
IN (SELECT c FROM t)" expressions. Ticket #3771. (CVS 6439)

FossilOrigin-Name: 058a2f20930d7707c03c3c27db8e761d5657ee46
2009-04-02 17:23:32 +00:00
danielk1977
de3e41e304 Fix (make test) with SQLITE_OMIT_COMPOUND_SELECT. Ticket #3235. (CVS 5530)
FossilOrigin-Name: 9ca975c8fdeaae7d5af8fe62e097d8d251362cfe
2008-08-04 03:51:24 +00:00
drh
85e9e22b33 Increased test coverage. (CVS 5414)
FossilOrigin-Name: 7cf91e08c08ce515c24c738c7d079f5b81eebee6
2008-07-15 00:27:34 +00:00
drh
93a960a0a8 Remove unused code. Test coverage enhancements. Modify the algorithm used
to select column names for VIEWs of joins so that the constructed column
names omits the underlying table names. (CVS 5386)

FossilOrigin-Name: 636cd723296a8b1709011fdd99b236ffddf3f1b0
2008-07-10 00:32:42 +00:00
drh
e49b146f30 Additional test coverage in select.c and expr.c. (CVS 5381)
FossilOrigin-Name: c6cf08477cc4d622a05ad6706cb9418cf7eea432
2008-07-09 01:39:44 +00:00
drh
f6e369a119 Fix a problem in sqlite3ExprIsInteger() causing failures on select1-4.9.2.
Other bug fixes in compound-merge.  The compound-merge is still disabled
in this check-in using "#if 0" due to additional bugs. (CVS 5295)

FossilOrigin-Name: 95037e6dbf4ed0ffd38790f3270dcaa4c1ae64ed
2008-06-24 12:46:30 +00:00
drh
398cf3d707 Remove a surplus "breakpoint" from select4.test. (CVS 5294)
FossilOrigin-Name: 3117238ce9cbfc36e2de929592decef86220e2a2
2008-06-24 12:28:03 +00:00
drh
92b01d53c2 The compound-select merge optimization is mostly working with this check-in.
But there are still a few problems and so the optimization is disabled by
and "#if 0".  This check-in is to synchronize with the other changes happening
in parallel. (CVS 5291)

FossilOrigin-Name: e2ba324cbcac0ba35bbde50048677e085abb092b
2008-06-24 00:32:35 +00:00
danielk1977
f7b9d66fd4 Fix a bug in handling queries on the sqlite_master table with an empty (0 bytes in size) database file. (CVS 5286)
FossilOrigin-Name: f8238770bf41e17014c6de05363b759304fc80de
2008-06-23 18:49:43 +00:00
danielk1977
01874bfc51 Adjust the test suite to account for recent changes related to #2822. Most changes are related to English language error messages only. (CVS 4622)
FossilOrigin-Name: 2f88b9b3e3c9abc3ae4a5dcef82707dd74f8aace
2007-12-13 07:58:50 +00:00
danielk1977
284f4aca32 Fix compilation/testing with OMIT_SUBQUERY defined. Ticket #2828. (CVS 4603)
FossilOrigin-Name: 0b34a18651764e650faba983be8593992ab2f4a9
2007-12-10 05:03:46 +00:00
drh
4c77431448 Better resolution of ORDER BY terms in compound queries. Candidate
solution for ticket #2822.  Needs more testing and documentation
before going final. (CVS 4602)

FossilOrigin-Name: 62a78d212c53a9cb1759d03134653a75f3a086b6
2007-12-08 21:10:20 +00:00
drh
36379e973b Detect nested aggregate functions even if the inner aggregate function is
aliased using an AS clause.  Ticket #2526. (CVS 4179)

FossilOrigin-Name: de000280c6d0b13440d2450eb6ba42073ad46c56
2007-07-23 22:51:15 +00:00
drh
94ccde58d0 Match ORDER BY terms to columns using names in compound queries. Make sure
this works for subqueries, especially in the right-hand side of an IN
operator. Ticket #2296. (CVS 3842)

FossilOrigin-Name: cfc6f933dc60ca88ae848f7f0c402e820437c2ff
2007-04-13 16:06:32 +00:00
drh
15926590ed Binary file I/O infrastructure added and used to increase test coverage
for detection of corrupt database files. (CVS 3822)

FossilOrigin-Name: 479b3d965b19c3ec4cb72542718751debf8ff75c
2007-04-06 15:02:13 +00:00
drh
18e87cff0a Allow constant terms in the ORDER BY or GROUP BY clauses. Ticket #1768. (CVS 3173)
FossilOrigin-Name: d83e0230c0c4909cb035e266beffc0967526d9c1
2006-04-11 14:16:21 +00:00
drh
923782530b SQLite now always chooses the column names for compound selects using
the left-most select.  This makes SQLite work like other SQL database,
but it also is a change from historical behavior and may break some
scripts.  Ticket #1721. (CVS 3153)

FossilOrigin-Name: 80cda9f7ce83f2de6cd2fdaf6150bbc35b670fee
2006-03-26 01:21:22 +00:00
drh
afed086386 Set and clear the full_column_name flag using direct invocation rather than
the execsql tcl command so that the select1 test works with the serialized
statement extension. (CVS 3136)

FossilOrigin-Name: 4d70013a6a42a58bc7af3a87bf79c131a0070e96
2006-03-14 13:10:42 +00:00
drh
29d7210819 SUM never gives an error. An integer result is returned for exact results
and a floating point result is returned for approximate results.
Tickets #1664, #1669, and #1670. (CVS 3066)

FossilOrigin-Name: 9e04f8fdf1ec0dc36effb55c05d075b3b4777fef
2006-02-09 22:13:41 +00:00
danielk1977
1576cd9251 Fixes for OMIT_SUBQUERY builds: Disable where clause OR->IN optimization. Include EXISTS keyword (for new CREATE TABLE syntax). Test file fixes. (CVS 2943)
FossilOrigin-Name: 8e79a0c24a03ccf960d6ccfb7c6b9b0f7c614e9b
2006-01-14 08:02:28 +00:00
danielk1977
327bd59216 Fix a vdbe stack overflow problem that could occur with a correlated sub-query. (CVS 2938)
FossilOrigin-Name: caa7da807d6578f7d8848978a7d3175b6ea1743b
2006-01-13 13:01:19 +00:00
danielk1977
13a68c3f61 Add the sqlite3_os_routine_set()/get() functions. (CVS 2818)
FossilOrigin-Name: c1ed79f594fb85009c2e9e5e281cbe66a9d2fa17
2005-12-15 10:11:30 +00:00
danielk1977
2e588c7525 Many small changes to ensure memory is not leaked after malloc() fails. (CVS 2808)
FossilOrigin-Name: 601c335463aaabc2e9918e4b9298cff6161be5c4
2005-12-09 14:25:08 +00:00
drh
3d1d95e625 The SUM() aggregate function returns an integer result if all inputs are
integers.  Any single non-integer input causes the result to be a floating
point value. (CVS 2669)

FossilOrigin-Name: 21adf4bd99e732650a1e8e9a1cc954126983a654
2005-09-08 10:37:01 +00:00
danielk1977
e61b9f4f3c Modify test scripts to work when SQLITE_OMIT_SUBQUERY (but no other OMIT macros) is defined. (CVS 2252)
FossilOrigin-Name: d4e19efcef68d834c55c7d496cdb3696d63a31a2
2005-01-21 04:25:47 +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
79d5f63fa2 CREATE TABLE ... AS ... uses short names for columns. Ticket #1036. (CVS 2232)
FossilOrigin-Name: b1d4c42d2be07adda68d31c570ba7cf8b115c3ad
2005-01-18 17:20:10 +00:00
drh
47a6db2bfd Column names coming back from a SELECT are now just the name of the
source column without the "table." prefix. In other words,
"PRAGMA short_column_names=ON" is now the default.
This makes the names of columns behave more like other SQL engines.
The old behavior can be restored by setting "PRAGMA short_column_names=OFF". (CVS 2231)

FossilOrigin-Name: 9295050af1bf2d9d4dc63adc225a2848d67cbe17
2005-01-18 16:02:40 +00:00
drh
018d1a4929 Test coverage improvements. (CVS 2215)
FossilOrigin-Name: 92f9d2b2f480fccfa6e8b70a1d19058b92a4ea8f
2005-01-15 01:52:31 +00:00
danielk1977
27c774388a Ensure tests pass when SQLITE_OMIT_COMPOUND_SELECT is defined. (CVS 2138)
FossilOrigin-Name: 007be591b7829f9ff38e4b14ba5a5043796c2ff3
2004-11-22 13:35:41 +00:00
drh
92febd92ad Tcl interface transfers values directly between SQLite and Tcl_Objs, without
at translation to strings. (CVS 1898)

FossilOrigin-Name: e97c331362545ce21117776c7b61d3488668f2bf
2004-08-20 18:34:20 +00:00
drh
cf55b7aef7 Handle quotes on the table name in TABLE.* terms in SELECT statements.
Ticket #680. (CVS 1833)

FossilOrigin-Name: 826b6797a9f08c69b9378cb403d746e91a54dcde
2004-07-20 01:45:19 +00:00