Commit Graph

67 Commits

Author SHA1 Message Date
drh
706631de32 When computing the datatypes for columns in a view, use the same datatype name
as the underlying table if such is available and is consistent with
the computed affinity of the column.
[forum:/forumpost/7fb1fe9dcf310ef5|Forum thread 7fb1fe9dcf310ef5].

FossilOrigin-Name: 497a98363fd1ed079544620ec5d0883f987ed03013131542741c93d7568e8568
2023-01-10 19:57:26 +00:00
drh
ed07d0ea76 If the SELECT that implements a subquery or a VIEW or a CREATE TABLE AS is
a compound with different result datatypes on two or more arms of the compound,
then the overall column type becomes BLOB (ANY).

FossilOrigin-Name: 6ebb178c6b688ebd632e91a5ec4c748567833037c679ab3d72fb770deb230fe1
2022-12-14 14:41:35 +00:00
drh
177b8c9c28 Use standard datatype names for the column datatypes in views and subqueries.
FossilOrigin-Name: baf2c2413346feb72ecb0bac800be9b945ebb4e01b42212132434d8ddef9cad0
2022-12-13 16:55:23 +00:00
dan
6fce561905 Ensure that the types and collation sequences of a view are taken from the leftmost component of compound SELECTs, even when column names are explicitly provided for the view. Possible fix for [679ed6a2].
FossilOrigin-Name: b0e49aa81a09c183b8baf8346b8a9b593c2b13073958617b6594500958d5bd46
2022-12-10 17:54:55 +00:00
dan
cf2ad7ae36 Remove a few unsuitable scripts from the "veryquick" test suite. Also have every second testrunner.tcl process favour running test scripts that contain text like "testrunner: slow" before any others.
FossilOrigin-Name: 22d280a5cd395abbedcfffbac3d3b3a614c327be25763ca380c1338a2a7bd33a
2022-07-18 19:32:30 +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
2e50f67073 Add the "PRAGMA table_list" command with its corresponding eponymous
table-valued function: "pragma_table_list".

FossilOrigin-Name: 2c0e7ae541e9ecb86aa58fa7e7057def8aac1b1af1af1aa80b8bf2d260f9a2f9
2021-09-21 17:26:23 +00:00
drh
70149ba47e Modify the SQLITE_DBCONFIG_ENABLE_VIEW option so that it always permits
TEMP views, just as SQLITE_DBCONFIG_ENABLE_TRIGGER always permits TEMP
triggers.

FossilOrigin-Name: 83dab8b358b6832a221a58e74dd5e99b9cdea4eee65124bb6799881e867d989c
2021-03-05 18:33:01 +00:00
drh
ed7974dee5 Always create a statement journal when using the OP_ParseSchema opcode,
as you never know when it might fail.  See the discussion on
[forum:/forumpost/daa2c728cc|forum post daa2c728cc].

FossilOrigin-Name: aa512f72cf5adfece6299db17bd122aeff0cdee2a25f83f60e2ebb05e99c9591
2020-10-26 18:14:12 +00:00
drh
11d88e68ab Add the SQLITE_DBCONFIG_ENABLE_VIEW option, together with a "db config"
command in the TCL interface that can access that option as well as all the
other sqlite3_db_config() boolean options.

FossilOrigin-Name: 61b4bccd2984f4c2cf50f58ef08677588e57aa7e079af07473b2e188d9ce4f52
2019-08-15 21:27:20 +00:00
dan
679c9613f6 Remove use of the affinity() function from view.test, as it is only available in SQLITE_DEBUG builds.
FossilOrigin-Name: 7f2246a17be9915b3492624a3d8deff56694bdc372f7627e3f16c1869415b1a3
2019-08-07 19:57:21 +00:00
dan
2712b022ab Ensure that when the col in an operator like "val IN(col)" is a column of a view, its affinity is not used to coerce val. Fix for [0a5e2c1d].
FossilOrigin-Name: 17b3d2218c02a4005d4c96471c452105b54abb25901ae62990b01f0c955135fe
2019-08-06 21:16:28 +00:00
dan
0a8d06a93f Add test cases to this branch.
FossilOrigin-Name: f37317d81cc2864ed57c76a7347351310d61c8056a2a0179218530ba60a44986
2019-08-05 20:45:53 +00:00
drh
53e8709b75 New test case for check-in [74ef97bf51dd531a] that takes the fix in the
previous check-in into account.

FossilOrigin-Name: cb1d06521de5918a2324a41e207b48c5e5149c23b927b9e3e1f3c3b38b82658e
2019-05-22 23:12:10 +00:00
dan
ac4085bc2c Fix a problem where self-joins on views that are aggregate queries may return the wrong result.
FossilOrigin-Name: 74ef97bf51dd531a277cf22fa4d42043d93799d5a5bd550812648834460fe0b7
2019-05-03 17:19:10 +00:00
dan
85c6892aa4 Fix a compilation issue in the "userauth" extension. Also fix a few test
script errors that occur with SQLITE_USER_AUTHENTICATION=1 builds.

FossilOrigin-Name: 221f3f572ed49d7af69a2e7c88741fa5206ea33ca59ee791eac7698bdd11ca4d
2018-09-19 17:09:09 +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
mistachkin
0fc2da3f79 When dropping a view, skip trying to delete from 'sqlite_stat*'.
FossilOrigin-Name: 2f5be3a2ddf469bd1b37b9e357545ce872b90c479a07094de2101d0a43ad70a4
2018-07-20 20:56:22 +00:00
drh
ed06a131da Carry table column types through into VIEW definitions, where possible.
FossilOrigin-Name: fb555c3c2af7f5e62ff839658f4fba7b645d3a68
2016-04-05 20:59:12 +00:00
drh
bfad7be78a Detect and report circularly defined views even if the views have the
columns defined in the CREATE VIEW statement.

FossilOrigin-Name: 9ab9c8c6d747647f8ade58c2c4812fc69a813368
2015-10-11 20:39:46 +00:00
drh
32498f1321 Fix a memory leak that can occur following a syntax error in CREATE VIEW.
FossilOrigin-Name: f4704035a6134f702c00110358e36f1579e2ea78
2015-09-26 11:15:44 +00:00
drh
2679f14fd9 Report an error if the number of named columns in a VIEW is different
from the number of result columns in the SELECT statement that implements
the VIEW.

FossilOrigin-Name: 6e4ac0be2de1a16fcbb2a314504122ad95aa257e
2015-09-25 13:42:55 +00:00
drh
8981b904b5 Enhance the CREATE VIEW syntax so that the names of columns of the view can
be specified after the view name.

FossilOrigin-Name: d794b34da6f9c77dfe17773b0b17b22de72cce7f
2015-08-24 17:42:49 +00:00
drh
fa4620b6f5 Allow a VIEW to reference undefined tables and functions when initially
created.  The error report is deferred until the VIEW is used.  This allows
views to be created before subviews and tables that the view references.

FossilOrigin-Name: 70b57dafb3216feb21091883196831fa1252e7bf
2015-08-03 13:44:45 +00:00
drh
19c6d96aec Avoid indexing off the front end of an array when creating a view with
two or more blank column names in the SELECT statement that defines the view.

FossilOrigin-Name: 554501f158534f9c27fd51900589c2ab7cf300d8
2014-03-04 21:19:51 +00:00
dan
84fb4c22b9 Omit a test that uses the progress handler callback from view.test if OMIT_PROGRESS_HANDLER is defined.
FossilOrigin-Name: f40552ada57622825d2974d392356aa34612d5ee
2013-03-04 17:41:32 +00:00
drh
d2a5623866 Issue an error message and quit (rather than overflowing a reference counter)
if the number of references to a table exceeds the maximum due to nested
UNION views.  Fix for ticket [d58ccbb3f1].

FossilOrigin-Name: c2462a95ed8e1e69886681400d673207d906bf1b
2013-01-28 19:00:20 +00:00
mistachkin
fda06befd5 Add retry logic for AV defense to winOpen. Also, refactor test suite to allow the key Tcl file operations (e.g. copy and delete) to be retried.
FossilOrigin-Name: 9007586fdabed8dbcc78581ea9821cfd1f9a4c8c
2011-08-02 00:57:34 +00:00
danielk1977
01ecbeeb57 Add the example from #3359 to the test suite. (CVS 6027)
FossilOrigin-Name: 84f8417c0794d3e5cec88f59ea71a7d557044409
2008-12-14 14:45:20 +00:00
drh
f0209f7410 Make sure "rowid" columns in views are named correctly. Ticket #3308. (CVS 5580)
FossilOrigin-Name: 8593218c7c8016fbdbcc223db951751eaba9c0dd
2008-08-21 14:54:28 +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
danielk1977
daf79acb68 Call the query flattener while processing the parent query. Previously, it was called while processing the sub-queries. (CVS 5330)
FossilOrigin-Name: 6fcb3bffe26ae1c21c72ce9019f1db1c118094a4
2008-06-30 18:12:28 +00:00
drh
ca4241140c Error messages says "no such view" instead of "no such table" when
trying to DROP a VIEW that does not exist. (CVS 4750)

FossilOrigin-Name: 50815a82e0ec9a5c1399f5fe6ef416434b55a821
2008-01-25 15:04:48 +00:00
danielk1977
5a8f9374ab Fixes to the test suite (no code changes) so that quick.test runs with OMIT_ATTACH builds. #2706. (CVS 4480)
FossilOrigin-Name: 07c00fffe50e8380748f7ae02328531a75d64610
2007-10-09 08:29:32 +00:00
drh
fdd48a76a6 Add support for IF EXISTS on CREATE/DROP TRIGGER/VIEW. Ticket #1899. (CVS 3406)
FossilOrigin-Name: e4fe736cfbbdc081581911a01690576034877b72
2006-09-11 23:45:48 +00:00
drh
b9bb7c187e Progress toward CREATE VIRTUAL TABLE. Still not even close to working... (CVS 3211)
FossilOrigin-Name: 898ec36b4102aaa03979f8f5c510936e57e2ae48
2006-06-11 23:41:55 +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
643054c18b Correct names returned from a query against a view. Ticket #1709, #1688, #1711. (CVS 3128)
FossilOrigin-Name: 36830fafa405c9eae4795045efc6843394c67555
2006-03-09 17:28:12 +00:00
drh
fb8de2dc07 Detect circularly defined views and issue an error message. Ticket #1658. (CVS 3055)
FossilOrigin-Name: f5341529d0cdbd63ce4c33606858158b6093969a
2006-02-05 18:55:20 +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
drh
85c23c61e2 Increased test coverage. Some malloc tests now fail though this is believed
to be an instrumentation problem not a real error. (CVS 2604)

FossilOrigin-Name: f786f37a5e31f42aaf81b3ad4a734f12855da69e
2005-08-20 03:03:04 +00:00
drh
9170dd7e1c Change the name of the OpenTemp opcode to OpenVirtual which is more
descriptive of what it does. (CVS 2541)

FossilOrigin-Name: 3bb9ce5f20d0a6bc19df31df9b8e82044c3e6004
2005-07-08 17:13:46 +00:00
drh
7c3d64f151 Do not allow parameters in VIEW definitions. Ticket #1270. (CVS 2492)
FossilOrigin-Name: 0d46289f02aad526f462a3ceceb1bca1b9f6a543
2005-06-06 15:32:08 +00:00
danielk1977
142bdf4051 Respect collation sequences in views. Ticket #1088. (CVS 2291)
FossilOrigin-Name: 9843c0dd795ceda3c260986f95b101a0cbc7cf64
2005-01-30 11:11:44 +00:00
danielk1977
b3bce66232 Modify sub-query handling. Tickets #1083 and #1084. (CVS 2286)
FossilOrigin-Name: b1b50f315873a8614920d1e3af4a07fb29a7ff6a
2005-01-29 08:32:43 +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
27c774388a Ensure tests pass when SQLITE_OMIT_COMPOUND_SELECT is defined. (CVS 2138)
FossilOrigin-Name: 007be591b7829f9ff38e4b14ba5a5043796c2ff3
2004-11-22 13:35:41 +00:00
danielk1977
0fa8ddbdec Modify test suite to work when SQLITE_OMIT_VIEW is defined. (CVS 2132)
FossilOrigin-Name: 711e8d7695dfc74b3f1ee00591dcdda2cd7fc7d5
2004-11-22 08:43:32 +00:00
drh
6bf895708c Update tests to work even if some features of the library are disabled. (CVS 2050)
FossilOrigin-Name: b11fc9b3f3a2711f98e7e45724aa1d30081197f3
2004-11-03 16:27:01 +00:00
drh
2c61c070d2 Correct handling of views on tables with quoted column names. Ticket #756. (CVS 1826)
FossilOrigin-Name: 8ac5a8ad5eec381585adb6812fc39a1a30aee4c1
2004-07-20 00:20:23 +00:00