Commit Graph

11836 Commits

Author SHA1 Message Date
dan 4e9119d9e8 Add code to handle non-recursive CTEs in the same way as SQL views.
FossilOrigin-Name: a26f399ba485e8127c276c5f103ec6c555e11734
2014-01-13 15:12:23 +00:00
dan 7d562dbe02 Update the parser so that sub-queries and CTEs may have WITH clauses.
FossilOrigin-Name: 704d3931b855562a619769955969d439c42ca406
2014-01-11 19:19:36 +00:00
drh 8b4718636c Parse common table expressions. But do not do anything with them (yet).
FossilOrigin-Name: da98b7205eb3d7ec2ddbf8a8e24eee0b2ff499a5
2014-01-11 13:22:17 +00:00
drh 03e1b1f5ff In LEMON, limit the size of the grammar file to 100MB. This ensures that
the program will never experience integer overflow.  To be doubly sure,
use calloc() instead of malloc() when allocating arrays.

FossilOrigin-Name: 29ba458d849ad8864711cbe59fb10447a947e06a
2014-01-11 12:52:25 +00:00
drh f59b12fbc1 Optimizations to the SQL language grammar that result in a small size
reduction and speed increase.

FossilOrigin-Name: cb5d1f83e0a33d546d4c0cb817ef1f8440d1f738
2014-01-11 03:54:05 +00:00
drh ecaa9d399c Add the "%token_class" directive to the LEMON parser generator. This opens up
the possibility of simplifying the parser.  Also remove all calls to 
sprintf(), strcpy(), and strcat() from LEMON to avoid compiler warnings
on OpenBSD.  (Aside:  It is this change to avoid harmless compiler warnings
that was the cause of the reason spat of bugs.)

FossilOrigin-Name: 8eb48c04bd0a14031488b3160fde67307eb8b35d
2014-01-11 03:27:37 +00:00
drh 61f92cd045 In LEMON, fix a bug in the text formatter introduced by the previous
commit.  Also add the new "%token_class" directive for defining symbolic
names that stand any one of a collection of tokens.

FossilOrigin-Name: da7890ca6b1d8e511377a469047120220e8c3b2d
2014-01-11 03:06:18 +00:00
drh 898799fa00 Do not use sprintf(), strcpy() or strcat() in the implementation of the
lemon parser generator tool, to avoid compiler warnings in OpenBSD.

FossilOrigin-Name: e43c522dde01e134f1adc94f534d2b3eda74afc2
2014-01-10 23:21:00 +00:00
drh 144ffe7bfb Remove unused structure definition from parse.y.
FossilOrigin-Name: 7f1e7ae313c7625ef2623d78883dce776eecca30
2014-01-10 20:51:16 +00:00
drh 75593d96be Allow a VALUES clause to be used any place that a SELECT statement can be
used.

FossilOrigin-Name: c9ea7d199f06a7801ab639e7ac98ebeb98706f24
2014-01-10 20:46:55 +00:00
drh c740752470 Fix CREATE TABLE ... AS so that it works with column names that are empty
strings.

FossilOrigin-Name: 632045f21c553e10f59a14c772d50d7824ca0c2c
2014-01-10 20:38:12 +00:00
dan 9871c59a2d Fix another harmless compiler warning in unixUnfetch().
FossilOrigin-Name: 0484549bb82ca5246488330c8d266e429ccd19b9
2014-01-10 16:40:21 +00:00
drh 1bcbc621df Fix harmless compiler warning in unixUnfetch().
FossilOrigin-Name: 618f248f4ea9fb0b6ff019a4c2cd72857389301f
2014-01-09 13:39:07 +00:00
drh b66e21fda5 Fix an typo that breaks the build when SQLITE_ENABLE_TREE_EXPLAIN is defined.
FossilOrigin-Name: f461e2b3973d0fe6a7b8cb7a3aaab8a30b3e16c0
2014-01-04 20:00:14 +00:00
dan 2e08486a08 Add the usual "fts3" prefix to new static method setEstimatedRows() in fts3.c. This fixes a problem when compiling the amalgamation, as the r-tree module also contains a static method named setEstimatedRows.
FossilOrigin-Name: d6fcfc8890489b942e5b3f1bc271835d77c5ef96
2014-01-04 19:58:29 +00:00
drh 1c2c0b776f Avoid redundant register loads during index key generation when doing a
DELETE or INTEGRITY_CHECK on a table with multiple indices.

FossilOrigin-Name: 8f6e6149a165f516be6395fd753e163d52ffd52e
2014-01-04 19:27:05 +00:00
drh 61019c7883 Omit OP_Close operations that occur immediately prior to OP_Halt and which
cannot be jumped over.

FossilOrigin-Name: 874b7e9999811c288ad41d07709f88e458d2d497
2014-01-04 16:49:02 +00:00
drh 54e2adb5f3 Improvements to the column-cache for nested AND/OR operators.
FossilOrigin-Name: 4e725f53131d3584319c710c8710a068989543c6
2014-01-04 15:17:04 +00:00
dan 8c7d4ddd5a Have FTS assign extremely high costs to plans that feature unusable MATCH constraints. This discourages the planner from choosing such plans, which lead to "unable to use function MATCH in the requested context" errors.
FossilOrigin-Name: fa8be488a3ad290722dae7a1a7396c77277b2149
2014-01-04 14:46:39 +00:00
dan 69014393f8 Instead of having the planner ignore plans with unusable MATCH constraints, have FTS assign extremely high costs to such plans in order to discourage the planner from using them.
FossilOrigin-Name: 24f84b38131866f7b435ffe641bb2f6991a70db2
2014-01-04 14:42:14 +00:00
dan 42899543f8 Have the planner detect cases where a MATCH constraint is applied to a virtual table, and ignore any plans that do not allow the virtual table implementation to implement the MATCH filtering.
FossilOrigin-Name: 19f3208b26597625728d1ef716d4e44407cf96ac
2014-01-04 14:16:06 +00:00
drh 5426d80948 Avoid some unnecessary OP_SCopy operations when inserting into a table
with multiple indices.

FossilOrigin-Name: 429018b19cb525a4bb0843d20955457b53900d4b
2014-01-03 16:03:43 +00:00
drh 759e858811 Try to factor constant subcomponents of the WHERE clause out of the loop.
FossilOrigin-Name: 9d05777fe24e1a5ce71762de38db840931ef0bc8
2014-01-02 21:05:10 +00:00
drh 762c1c4071 Avoid unnecessary affinity transformations when building indices using
data from a table.

FossilOrigin-Name: 10d851353c2abeadbd2852c210a7ff9f7f513e5d
2014-01-02 19:35:30 +00:00
drh 991a198511 Be more aggressive in optimizing constant conditional expressions.
FossilOrigin-Name: b7e39851a75b87ebca747b26a39989560fd6362b
2014-01-02 17:57:16 +00:00
drh b00d862139 Try to detect process ID changes due to fork() calls in os_unix.c and
reset the PRNG when a process ID change is detected.

FossilOrigin-Name: e1eba1fb09d7db49d77928bd115b27b8002ae640
2014-01-01 15:18:36 +00:00
drh fe98081e18 Enhance sqlite3_randomness(N,P) such that it resets the internal PRNG
if N is less than 1.  Subsequent calls to sqlite3_randomness() will reinitialize
the internal PRNG by calling the xRandomness() method of the default VFS.

FossilOrigin-Name: a221aa82bb5496885fd0bf76e4601443799511de
2014-01-01 14:00:13 +00:00
drh 3312348cf8 Add -I. to the main.mk makefile for building sqlite3.o and speedtest1.
FossilOrigin-Name: cc72c5aec7fe93d4a1368517aab949dc98d33003
2013-12-24 12:04:24 +00:00
drh 73d5b8f550 Move elements of the Vdbe object that are only used during statement
preparation out into the Parse object.

FossilOrigin-Name: c289a253c0c053ac8fc344efe138262c327d8096
2013-12-23 19:09:07 +00:00
drh 58c960816f Remove a stray tab character.
FossilOrigin-Name: 25b8a1c9ba77df3b7c78cbce922cb593d661696d
2013-12-23 11:33:32 +00:00
drh eaf4f523a5 Remove a condition that is always in the logic that handles reading
default values for columns.

FossilOrigin-Name: 895af097e71749f423b63ece17c5a4b4dfcd164d
2013-12-22 22:45:14 +00:00
drh 6c1de308f2 Make sure the WhereLoop.aLTerm[] array is large enough when processing
the skip-scan optimization.  Fix for ticket [520070ec7fbaac].

FossilOrigin-Name: 46d040591f27be01b1860344f8a268797fe344f4
2013-12-22 20:44:10 +00:00
drh 25555506df Fix speedtest1.c so that in --explain mode it only outputs non-explain text
for DDL statements.

FossilOrigin-Name: 2d2b3c4951dc2b8317d5ba8b5cf72b1f4a6668f6
2013-12-21 17:14:58 +00:00
drh 685e3c481c Avoid compiler warnings by only enabling sqlite3ErrName() when
SQLITE_TEST is defined.

FossilOrigin-Name: 862228e50534a6b89c9498c4db664610db11485e
2013-12-21 17:07:13 +00:00
drh c73d0d9dec Fix harmless compiler warnings in FTS4. This involved corrupting
Martin Porter's beautifully written and elegant stemmer code, making it
a little less beautiful and a little less elegant.  Today is a sad
day.  But the warnings from GCC grow increasingly verbose and irksome
with each new release and so something had to be done.

FossilOrigin-Name: df05679838b571c16a7ab7e135f9564cd2d9647c
2013-12-21 16:06:47 +00:00
drh 849a9d92ba Fix the ".echo on" dot-command of the shell so that it echos comments in
addition to SQL statements and dot-commands.  Add the --explain option
to speedtest1 so that the output can be piped into the command-line shell
to show nicely-formated VDBE code for the entire test.

FossilOrigin-Name: 96397263f94256e284aae9506de1fc48fea89193
2013-12-21 15:46:06 +00:00
drh ae28d6efc6 Add a case to speedtest1.c that demonstrates the need to factor OP_Column
operators out of inner loops.

FossilOrigin-Name: 69a17336fdf4ae891e815914be8942f7222230c2
2013-12-21 00:04:37 +00:00
drh a47941fe42 Fix compiler harmless warnings in tclsqlite.c that appeared with GCC 4.8.x.
FossilOrigin-Name: d93ae6833a7fca0672caf902a7b48846e54242cd
2013-12-20 18:57:44 +00:00
drh d42ef839bc Code simplification in sqlite3GenerateIndexKey() by making use of a subroutine
found over in expr.c.

FossilOrigin-Name: 0026d3355340d66687a3fd4cbece28811ef1b505
2013-12-20 18:44:35 +00:00
drh 4eded604ea Combine adjacent single-register OP_Copy instructions into a single
multi-register OP_Copy, where possible.  Fix the Synopsis comment for
multi-register OP_Copy instructions to show the correct register ranges.

FossilOrigin-Name: 2ae22dc0cbed2feca4baf89d02aaace0331971d6
2013-12-20 15:59:20 +00:00
drh aed1819875 Allow any arbitrary expression as the filename in an ATTACH statement,
including functions and subqueries.

FossilOrigin-Name: df70a1f30393b34146d6b8bf1df5a76aaf362efe
2013-12-20 14:48:12 +00:00
drh 7e61d18eb4 Simplify the accumulator reset for aggregate query processing so that it
uses a single multi-register OP_Null rather than a separate OP_Null for each
register.

FossilOrigin-Name: 2c7fd9b043f5f3d9d8e22dbefa84a9770ca951d0
2013-12-20 13:11:45 +00:00
dan 1001ee8819 Do not inject OOM faults into SQLITE_FCNTL_COMMIT_PHASE_TWO file-control invocations. It causes problems for test scripts.
FossilOrigin-Name: 8eb28d23e353139d24a8af78309d39249ab9eaf0
2013-12-19 17:04:58 +00:00
drh f6b1a8e1a5 Make sure errors encountered while initializing extensions such as FTS4
get reported out from sqlite3_open().  This fixes a bug introduced by
check-in [9d347f547e7ba9].  Also remove lots of forgotten "breakpoint"
commands left in test scripts over the years.

FossilOrigin-Name: ca3fdfd41961d8d3d1e39d20dc628e8a95dabb2f
2013-12-19 16:26:05 +00:00
drh a021f121c9 Remove an unneeded column-cache flush in aggregate SELECT
and an unreachable branch in the INSERT logic.

FossilOrigin-Name: ffa092e13b3781677b18418cca40e3dd1e388aed
2013-12-19 14:34:34 +00:00
drh edfac3456e Omit an unnecessary OP_Null opcode from UPDATE.
FossilOrigin-Name: 72d111336c5016e5b5092dfebcd01253266a7685
2013-12-19 02:56:01 +00:00
drh 46d03fcbfc Omit one or more pointless instructions that occur in between OP_NoConflict
and OP_Halt.

FossilOrigin-Name: 61e2f3575c4a94f9571c28fb2bd19da84b0edceb
2013-12-19 02:23:45 +00:00
drh 935c34711b Remove an unnecessary column-cache flush operation. Add code to trace the
column cache when compiled with SQLITE_DEBUG and using
PRAGMA vdbe_addoptrace=ON.

FossilOrigin-Name: 58704ed1f4cd78bb3b0c095ffd1626906a95a413
2013-12-18 18:44:43 +00:00
drh 039468ef2d Remove an unnecessary column-cache flush. Add another test case to the
speedtest1.c program to accentuate the benefit of not flushing the cache at
that point.

FossilOrigin-Name: 97fdfc6b79833011fc0c506fe5e0985c0fb1906c
2013-12-18 16:27:48 +00:00
drh 9ac7962ace Show changes to the column cache when PRAGMA vdbe_addoptrace=ON is set.
FossilOrigin-Name: 4c6a659c432e4f7c0285f58675a67f967b07bb0d
2013-12-18 15:11:47 +00:00