1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Ensure that the "PRAGMA schema_version" command causes the schema to be

reparsed and reloaded.

FossilOrigin-Name: 27d4a9a7b530c77a5b2593d1a5232b10746da9906f8d12890de7a8fbd7270256
This commit is contained in:
drh
2020-07-01 16:19:14 +00:00
parent fa4b0d4453
commit e3863b5176
5 changed files with 36 additions and 10 deletions

View File

@ -658,5 +658,23 @@ do_catchsql_test 21.3 {
ALTER TABLE a RENAME TO e;
} {1 {error in view c: 1st ORDER BY term does not match any column in the result set}}
# After forum thread https://sqlite.org/forum/forumpost/ddbe1c7efa
# Ensure that PRAGMA schema_version=N causes a full schema reload.
#
reset_db
do_execsql_test 22.0 {
CREATE TABLE t1(a INT, b TEXT NOT NULL);
INSERT INTO t1 VALUES(1,2),('a','b');
BEGIN;
PRAGMA writable_schema=ON;
UPDATE sqlite_schema SET sql='CREATE TABLE t1(a INT, b TEXT)' WHERE name LIKE 't1';
PRAGMA schema_version=1234;
COMMIT;
PRAGMA integrity_check;
} {ok}
do_execsql_test 22.1 {
ALTER TABLE t1 ADD COLUMN c INT DEFAULT 78;
SELECT * FROM t1;
} {1 2 78 a b 78}
finish_test