Repository navigation
Expand file tree
/
Copy pathaltertab.test
More file actions
1043 lines (895 loc) · 21.5 KB
/
Copy pathaltertab.test
File metadata and controls
1043 lines (895 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
==== 1.0
CREATE TABLE t1(a, b, CHECK(t1.a != t1.b));
CREATE TABLE t2(a, b);
CREATE INDEX t2expr ON t2(a) WHERE t2.b>0;
----
stmt 0 ok
stmt 46 ok
stmt 72 err 1 -1 117 no such table: main.t2
==== 1.1
SELECT sql FROM sqlite_master
----
stmt 0 ok
==== 1.2
ALTER TABLE t1 RENAME TO t1new;
----
stmt 0 err 1 -1 34 no such table: t1
==== 1.3
CREATE TABLE t3(c, d);
ALTER TABLE t3 RENAME TO t3new;
DROP TABLE t3new;
----
stmt 0 ok
stmt 25 err 1 -1 59 no such table: t3
stmt 59 err 1 -1 79 no such table: t3new
==== 1.4
SELECT sql FROM sqlite_master
----
stmt 0 ok
==== 1.3.dup1
ALTER TABLE t2 RENAME TO t2new;
----
stmt 0 err 1 -1 34 no such table: t2
==== 1.4.dup1
SELECT sql FROM sqlite_master
----
stmt 0 ok
==== 2.0
CREATE TABLE abc(a, b, c);
INSERT INTO abc VALUES(1, 2, 3);
CREATE VIRTUAL TABLE eee USING echo('abc');
SELECT * FROM eee;
----
stmt 0 ok
stmt 31 err 1 -1 68 no such table: abc
stmt 68 ok
stmt 116 err 1 -1 139 no such table: eee
==== 2.1
ALTER TABLE eee RENAME TO fff;
SELECT * FROM fff;
----
stmt 0 err 1 -1 35 no such table: eee
stmt 35 err 1 -1 58 no such table: fff
==== 2.2
ALTER TABLE fff RENAME TO ggg;
----
stmt 0 err 1 -1 35 no such table: fff
==== 3.0
CREATE TABLE txx(a, b, c);
INSERT INTO txx VALUES(1, 2, 3);
CREATE VIEW vvv AS SELECT main.txx.a, txx.b, c FROM txx;
CREATE VIEW uuu AS SELECT main.one.a, one.b, c FROM txx AS one;
CREATE VIEW temp.ttt AS SELECT main.txx.a, txx.b, one.b, main.one.a FROM txx AS one, txx;
----
stmt 0 ok
stmt 29 err 1 -1 64 no such table: txx
stmt 64 ok
stmt 123 ok
stmt 189 ok
==== 3.1.1
SELECT * FROM vvv;
----
stmt 0 err 1 -1 21 no such table: vvv
==== 3.1.2
ALTER TABLE txx RENAME TO "t xx";
SELECT * FROM vvv;
----
stmt 0 err 1 -1 36 no such table: txx
stmt 36 err 1 -1 57 no such table: vvv
==== 3.1.3
SELECT sql FROM sqlite_master WHERE name='vvv';
----
stmt 0 ok
==== 3.2.1
SELECT * FROM uuu;
----
stmt 0 err 1 -1 21 no such table: uuu
==== 3.2.2
SELECT sql FROM sqlite_master WHERE name='uuu';;
----
stmt 0 ok
==== 3.3.1
SELECT * FROM ttt;
----
stmt 0 err 1 -1 21 no such table: ttt
==== 3.3.2
SELECT sql FROM sqlite_temp_master WHERE name='ttt';
----
stmt 0 ok
==== 4.0
CREATE table t1(x, y);
CREATE table t2(a, b);
CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
SELECT t1.x, * FROM t1, t2;
INSERT INTO t2 VALUES(new.x, new.y);
END;
----
stmt 0 ok
stmt 25 ok
stmt 50 err 1 -1 97 no such table: main.t1
==== 4.1
INSERT INTO t1 VALUES(1, 1);
ALTER TABLE t1 RENAME TO t11;
INSERT INTO t11 VALUES(2, 2);
ALTER TABLE t2 RENAME TO t22;
INSERT INTO t11 VALUES(3, 3);
----
stmt 0 err 1 -1 31 no such table: t1
stmt 31 err 1 -1 63 no such table: t1
stmt 63 err 1 -1 95 no such table: t11
stmt 95 err 1 -1 127 no such table: t2
stmt 127 err 1 -1 159 no such table: t11
==== 4.2
SELECT squish(sql) FROM sqlite_master WHERE name = 'tr1'
----
stmt 0 err 1 8 58 no such function: squish
==== 5.0
CREATE TABLE t9(a, b, c);
CREATE TABLE t10(a, b, c);
CREATE TEMP TABLE t9(a, b, c);
CREATE TRIGGER temp.t9t AFTER INSERT ON temp.t9 BEGIN
INSERT INTO t10 VALUES(new.a, new.b, new.c);
END;
INSERT INTO temp.t9 VALUES(1, 2, 3);
SELECT * FROM t10;
----
stmt 0 ok
stmt 28 ok
stmt 57 ok
stmt 90 err 1 -1 147 no such table: temp.t9
stmt 203 err 1 -1 243 no such table: temp.t9
stmt 243 err 1 -1 264 no such table: t10
==== 5.1
ALTER TABLE temp.t9 RENAME TO 't1234567890'
----
stmt 0 err 1 -1 47 no such table: temp.t9
==== 5.2
CREATE TABLE t1(a, b);
CREATE TABLE t2(a, b);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t2 VALUES(3, 4);
CREATE VIEW v AS SELECT one.a, one.b, t2.a, t2.b FROM t1 AS one, t2;
SELECT * FROM v;
----
stmt 0 ok
stmt 25 ok
stmt 50 err 1 -1 81 no such table: t1
stmt 81 err 1 -1 112 no such table: t2
stmt 112 ok
stmt 183 err 1 -1 202 no such table: v
==== 5.3
ALTER TABLE t2 RENAME TO one;
----
stmt 0 err 1 -1 32 no such table: t2
==== 5.4
SELECT * FROM v
----
stmt 0 err 1 -1 21 no such table: v
==== 5.5
DROP VIEW v;
CREATE VIEW temp.vv AS SELECT one.a, one.b, t2.a, t2.b FROM t1 AS one, t2;
SELECT * FROM vv;
----
stmt 0 err 1 -1 15 no such view: v
stmt 15 ok
stmt 92 err 1 -1 112 no such table: vv
==== 5.6
ALTER TABLE t2 RENAME TO one;
----
stmt 0 err 1 -1 32 no such table: t2
==== 6.0
CREATE VIRTUAL TABLE x1 USING tcl(tcl_command);
----
stmt 0 ok
==== 6.1
ALTER TABLE x1 RENAME TO x2;
SELECT sql FROM sqlite_master WHERE name = 'x2'
----
stmt 0 err 1 -1 33 no such table: x1
stmt 33 ok
==== 7.1
CREATE TABLE ddd(db, sql, zOld, zNew, bTemp);
INSERT INTO ddd VALUES(
'main', 'CREATE TABLE x1(i INTEGER, t TEXT)', 'ddd', NULL, 0
), (
'main', 'CREATE TABLE x1(i INTEGER, t TEXT)', NULL, 'eee', 0
), (
'main', NULL, 'ddd', 'eee', 0
);
----
stmt 0 ok
stmt 50 err 1 -1 279 no such table: ddd
==== 7.2
SELECT
sqlite_rename_table(db, 0, 0, sql, zOld, zNew, bTemp)
FROM ddd;
----
stmt 0 err 1 -1 84 no such table: ddd
==== 8.1
ATTACH 'test.db2' AS aux;
PRAGMA foreign_keys = on;
CREATE TABLE aux.p1(a INTEGER PRIMARY KEY, b);
CREATE TABLE aux.c1(x INTEGER PRIMARY KEY, y REFERENCES p1(a));
INSERT INTO aux.p1 VALUES(1, 1);
INSERT INTO aux.p1 VALUES(2, 2);
INSERT INTO aux.c1 VALUES(NULL, 2);
CREATE TABLE aux.c2(x INTEGER PRIMARY KEY, y REFERENCES c1(a));
----
stmt 0 ok
stmt 28 ok
stmt 56 err 1 72 79 unknown database aux
stmt 105 err 1 121 128 unknown database aux
stmt 171 err 1 -1 206 no such table: aux.p1
stmt 206 err 1 -1 241 no such table: aux.p1
stmt 241 err 1 -1 279 no such table: aux.c1
stmt 279 err 1 295 302 unknown database aux
==== 8.2
ALTER TABLE aux.p1 RENAME TO ppp;
----
stmt 0 err 1 -1 36 no such table: aux.p1
==== 8.2.dup1
INSERT INTO aux.c1 VALUES(NULL, 1);
SELECT sql FROM aux.sqlite_master WHERE name = 'c1';
----
stmt 0 err 1 -1 38 no such table: aux.c1
stmt 38 err 1 -1 93 no such table: aux.sqlite_master
==== 9.0
CREATE TABLE t1(a, b, c);
CREATE VIEW v1 AS SELECT * FROM t2;
----
stmt 0 ok
stmt 28 ok
==== 9.1
ALTER TABLE t1 RENAME TO t3;
----
stmt 0 err 1 -1 31 no such table: t1
==== 9.2
DROP VIEW v1;
CREATE TRIGGER tr AFTER INSERT ON t1 BEGIN
INSERT INTO t2 VALUES(new.a);
END;
----
stmt 0 err 1 -1 16 no such view: v1
stmt 16 err 1 -1 61 no such table: main.t1
==== 9.3
ALTER TABLE t1 RENAME TO t3;
----
stmt 0 err 1 -1 31 no such table: t1
==== 9.4
DROP TRIGGER tr;
ATTACH 'test.db2' AS aux;
CREATE TRIGGER tr AFTER INSERT ON t1 WHEN new.a IS NULL BEGIN SELECT 1, 2, 3; END;
CREATE TABLE aux.t1(x);
CREATE TEMP TRIGGER tr AFTER INSERT ON aux.t1 BEGIN SELECT 1, 2, 3; END;
----
stmt 0 err 1 -1 19 no such trigger: tr
stmt 19 ok
stmt 48 err 1 -1 112 no such table: main.t1
stmt 133 err 1 150 157 unknown database aux
stmt 160 err 1 -1 214 no such table: aux.t1
==== 9.5
ALTER TABLE main.t1 RENAME TO t3;
----
stmt 0 err 1 -1 36 no such table: main.t1
==== 9.6
SELECT sql FROM sqlite_temp_master;
SELECT sql FROM sqlite_master WHERE type='trigger';
----
stmt 0 ok
stmt 38 ok
==== 10.0
CREATE VIRTUAL TABLE fff USING fts5(x, y, z);
----
stmt 0 ok
==== 10.1
BEGIN;
INSERT INTO fff VALUES('a', 'b', 'c');
ALTER TABLE fff RENAME TO ggg;
COMMIT;
----
stmt 0 ok
stmt 11 err 1 -1 56 no such table: fff
stmt 56 err 1 -1 93 no such table: fff
stmt 93 ok
==== 10.2
SELECT * FROM ggg;
----
stmt 0 err 1 -1 23 no such table: ggg
==== 11.0
ATTACH 'test.db2' AS aux;
CREATE TABLE aux.t1(a, b, c);
CREATE TABLE main.t1(a, b, c);
CREATE TEMP TRIGGER tr AFTER INSERT ON aux.t1 BEGIN
SELECT trigger(new.a, new.b, new.c);
END;
----
stmt 0 ok
stmt 28 err 1 44 51 unknown database aux
stmt 60 ok
stmt 93 err 1 -1 147 no such table: aux.t1
==== 11.1
INSERT INTO main.t1 VALUES(1, 2, 3);
INSERT INTO aux.t1 VALUES(4, 5, 6);
----
stmt 0 err 1 -1 39 no such table: main.t1
stmt 39 err 1 -1 77 no such table: aux.t1
==== 11.3
SELECT name, tbl_name FROM sqlite_temp_master;
----
stmt 0 ok
==== 11.4
ALTER TABLE main.t1 RENAME TO t2;
SELECT name, tbl_name FROM sqlite_temp_master;
----
stmt 0 err 1 -1 36 no such table: main.t1
stmt 36 ok
==== 11.5
ALTER TABLE aux.t1 RENAME TO t2;
SELECT name, tbl_name FROM sqlite_temp_master;
----
stmt 0 err 1 -1 35 no such table: aux.t1
stmt 35 ok
==== 11.6
INSERT INTO aux.t2 VALUES(7, 8, 9);
----
stmt 0 err 1 -1 38 no such table: aux.t2
==== 12.0
CREATE TABLE t1(a);
CREATE TABLE t2(w);
CREATE TRIGGER temp.r1 AFTER INSERT ON main.t2 BEGIN
INSERT INTO t1(a) VALUES(new.w);
END;
CREATE TEMP TABLE t2(x);
----
stmt 0 ok
stmt 22 ok
stmt 44 err 1 -1 99 no such table: main.t2
stmt 143 ok
==== 12.1
ALTER TABLE main.t2 RENAME TO t3;
----
stmt 0 err 1 -1 36 no such table: main.t2
==== 12.2
INSERT INTO t3 VALUES('WWW');
SELECT * FROM t1;
----
stmt 0 err 1 -1 32 no such table: t3
stmt 32 err 1 -1 52 no such table: t1
==== 13.0
CREATE TABLE t1(x, y);
CREATE TABLE t2(a, b);
CREATE TABLE log(c);
CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
INSERT INTO log SELECT y FROM t1, t2;
END;
----
stmt 0 ok
stmt 25 ok
stmt 50 ok
stmt 73 err 1 -1 119 no such table: main.t1
==== 13.1
INSERT INTO t1 VALUES(1, 2);
----
stmt 0 err 1 -1 31 no such table: t1
==== 13.2
ALTER TABLE t2 RENAME b TO y;
----
stmt 0 err 1 -1 32 no such table: t2
==== 14.0
CREATE VIRTUAL TABLE rt USING rtree(id, minx, maxx, miny, maxy);
CREATE TABLE "mytable" ( "fid" INTEGER PRIMARY KEY, "geom" BLOB);
CREATE TRIGGER tr1 AFTER UPDATE OF "geom" ON "mytable"
WHEN OLD."fid" = NEW."fid" AND NEW."geom" IS NULL BEGIN
DELETE FROM rt WHERE id = OLD."fid";
END;
INSERT INTO mytable VALUES(1, X'abcd');
----
stmt 0 ok
stmt 69 ok
stmt 140 err 1 -1 267 no such table: main.mytable
stmt 321 err 1 -1 366 no such table: mytable
==== 14.1
UPDATE mytable SET geom = X'1234'
----
stmt 0 err 1 -1 39 no such table: mytable
==== 14.2
ALTER TABLE mytable RENAME TO mytable_renamed;
----
stmt 0 err 1 -1 51 no such table: mytable
==== 14.3
CREATE TRIGGER tr2 AFTER INSERT ON mytable_renamed BEGIN
DELETE FROM rt WHERE id=(SELECT min(id) FROM rt);
END;
----
stmt 0 err 1 -1 61 no such table: main.mytable_renamed
==== 14.4
ALTER TABLE mytable_renamed RENAME TO mytable2;
----
stmt 0 err 1 -1 52 no such table: mytable_renamed
==== 14.5
CREATE TABLE t1(a, b, c);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TRIGGER xyz AFTER INSERT ON t1 BEGIN
SELECT a, b FROM v1;
END;
----
stmt 0 ok
stmt 28 ok
stmt 66 err 1 -1 112 no such table: main.t1
==== 14.6
ALTER TABLE t1 RENAME TO tt1;
----
stmt 0 err 1 -1 32 no such table: t1
==== 15.0
CREATE TABLE t1(a integer NOT NULL PRIMARY KEY);
CREATE VIEW v1 AS SELECT a FROM t1;
CREATE TRIGGER tr1 INSTEAD OF INSERT ON v1 BEGIN
UPDATE t1 SET a = NEW.a;
END;
CREATE TRIGGER tr2 INSTEAD OF INSERT ON v1 BEGIN
SELECT new.a;
END;
CREATE TABLE t2 (b);
----
stmt 0 ok
stmt 51 ok
stmt 89 err 1 -1 140 no such table: main.v1
stmt 177 err 1 -1 228 no such table: main.v1
stmt 254 ok
==== 15.1
INSERT INTO v1 VALUES(1);
ALTER TABLE t2 RENAME TO t3;
----
stmt 0 err 1 -1 28 no such table: v1
stmt 28 err 1 -1 59 no such table: t2
==== 15.2
CREATE TABLE x(f1 integer NOT NULL);
CREATE VIEW y AS SELECT f1 AS f1 FROM x;
CREATE TRIGGER t INSTEAD OF UPDATE OF f1 ON y BEGIN
UPDATE x SET f1 = NEW.f1;
END;
CREATE TABLE z (f1 integer NOT NULL PRIMARY KEY);
ALTER TABLE z RENAME TO z2;
----
stmt 0 ok
stmt 39 ok
stmt 82 err 1 -1 136 no such table: main.y
stmt 175 ok
stmt 227 err 1 -1 257 no such table: z
==== 15.3
INSERT INTO x VALUES(1), (2), (3);
ALTER TABLE x RENAME f1 TO f2;
SELECT * FROM x;
----
stmt 0 err 1 -1 37 no such table: x
stmt 37 err 1 -1 70 no such table: x
stmt 70 err 1 -1 89 no such table: x
==== 15.4
UPDATE y SET f1 = 'x' WHERE f1 = 1;
SELECT * FROM x;
----
stmt 0 err 1 -1 38 no such table: y
stmt 38 err 1 -1 57 no such table: x
==== 15.5
SELECT sql FROM sqlite_master WHERE name = 'y';
----
stmt 0 ok
==== 16.0
CREATE VIRTUAL TABLE y1 USING fts3;
VACUUM;
----
stmt 0 ok
stmt 40 ok
==== 16.10
INSERT INTO y1_segments VALUES(1, X'1234567890');
----
stmt 0 err 1 -1 54 no such table: y1_segments
==== 16.20
DROP TABLE y1_segments;
----
stmt 0 err 1 -1 28 no such table: y1_segments
==== 16.20.dup1
ALTER TABLE y1_segments RENAME TO abc;
----
stmt 0 err 1 -1 43 no such table: y1_segments
==== 16.22
ALTER TABLE y1_segments RENAME TO abc;
----
stmt 0 err 1 -1 43 no such table: y1_segments
==== 16.23
CREATE TABLE y1_segments AS SELECT * FROM abc;
----
stmt 0 err 1 -1 51 no such table: abc
==== 16.24
CREATE VIEW y1_segments AS SELECT * FROM abc;
----
stmt 0 ok
==== 16.25
ALTER TABLE abc RENAME TO y1_segments;
----
stmt 0 err 1 -1 43 no such table: abc
==== 16.30
ALTER TABLE y1 RENAME TO z1;
----
stmt 0 err 1 -1 33 no such table: y1
==== 16.40
SELECT * FROM z1_segments;
----
stmt 0 err 1 -1 31 no such table: z1_segments
==== 17.0
CREATE TABLE sqlite1234 (id integer);
ALTER TABLE sqlite1234 RENAME TO User;
SELECT name, sql FROM sqlite_master WHERE sql IS NOT NULL;
----
stmt 0 ok
stmt 40 err 1 -1 81 no such table: sqlite1234
stmt 81 ok
==== 18.1.0
CREATE TABLE t0 (c0 INTEGER, PRIMARY KEY(c0)) WITHOUT ROWID;
----
stmt 0 ok
==== 18.1.1
ALTER TABLE t0 RENAME COLUMN c0 TO c1;
----
stmt 0 err 1 -1 41 no such table: t0
==== 18.1.2
SELECT sql FROM sqlite_master;
----
stmt 0 ok
==== 18.2.0
CREATE TABLE t0 (c0 INTEGER, PRIMARY KEY(c0));
----
stmt 0 ok
==== 18.2.1
ALTER TABLE t0 RENAME COLUMN c0 TO c1;
----
stmt 0 err 1 -1 41 no such table: t0
==== 18.2.2
SELECT sql FROM sqlite_master;
----
stmt 0 ok
==== 19.100
CREATE TABLE t1(x);
CREATE VIEW t2 AS SELECT 1 FROM t1, (t1 AS a0, t1);
ALTER TABLE t1 RENAME TO t3;
SELECT sql FROM sqlite_master;
----
stmt 0 ok
stmt 22 ok
stmt 76 err 1 -1 107 no such table: t1
stmt 107 ok
==== 19.110
INSERT INTO t3(x) VALUES(123);
SELECT * FROM t2;
----
stmt 0 err 1 -1 33 no such table: t3
stmt 33 err 1 -1 53 no such table: t2
==== 19.120
INSERT INTO t3(x) VALUES('xyz');
SELECT * FROM t2;
----
stmt 0 err 1 -1 35 no such table: t3
stmt 35 err 1 -1 55 no such table: t2
==== 20.0
CREATE TABLE a(a);
CREATE VIEW b AS SELECT(SELECT *FROM c JOIN a USING(d, a, a, a) JOIN a) IN();
----
stmt 0 ok
stmt 21 ok
==== 20.1
ALTER TABLE a RENAME a TO e;
----
stmt 0 err 1 -1 31 no such table: a
==== 21.0
CREATE TABLE a(b);
CREATE VIEW c AS
SELECT NULL INTERSECT
SELECT NULL ORDER BY
likelihood(NULL, (d, (SELECT c)));
----
stmt 0 ok
stmt 21 ok
==== 21.1
SELECT likelihood(NULL, (d, (SELECT c)));
----
stmt 0 err 1 10 44 second argument to likelihood() must be a constant between 0.0 and 1.0
==== 21.2
SELECT * FROM c;
----
stmt 0 err 1 -1 19 no such table: c
==== 21.3
ALTER TABLE a RENAME TO e;
----
stmt 0 err 1 -1 29 no such table: a
==== 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;
----
stmt 0 ok
stmt 43 err 1 -1 83 no such table: t1
stmt 83 ok
stmt 92 ok
stmt 121 ok
stmt 207 ok
stmt 237 ok
stmt 247 ok
==== 22.1
ALTER TABLE t1 ADD COLUMN c INT DEFAULT 78;
SELECT * FROM t1;
----
stmt 0 err 1 -1 42 no such table: t1
stmt 46 err 1 -1 66 no such table: t1
==== 23.1
CREATE TABLE gigo(a text);
CREATE TABLE idx(x text COLLATE compare64);
CREATE VIEW v1 AS SELECT * FROM idx WHERE x='abc';
----
stmt 0 ok
stmt 29 err 1 -1 74 no such collation sequence: compare64
stmt 75 ok
==== 23.2
alter table gigo rename to ggiiggoo;
alter table idx rename to idx2;
----
stmt 0 err 1 -1 39 no such table: gigo
stmt 39 err 1 -1 73 no such table: idx
==== 23.3
SELECT sql FROM sqlite_master;
----
stmt 0 ok
==== 23.4
ALTER TABLE idx2 RENAME x TO y;
SELECT sql FROM sqlite_master;
----
stmt 0 err 1 -1 34 no such table: idx2
stmt 34 ok
==== 24.1.0
CREATE TABLE t1(a, b);
CREATE TRIGGER AFTER INSERT ON t1 BEGIN
INSERT INTO nosuchtable VALUES(new.a) ON CONFLICT(a) DO NOTHING;
END;
----
stmt 0 ok
stmt 25 err 1 -1 67 no such table: main.t1
==== 24.1.1
ALTER TABLE t1 RENAME TO t2;
----
stmt 0 err 1 -1 31 no such table: t1
==== 24.2.0
CREATE TABLE t1(a, b);
CREATE TRIGGER AFTER INSERT ON t1 BEGIN
INSERT INTO v1 VALUES(new.a) ON CONFLICT(a) DO NOTHING;
END;
CREATE VIEW v1 AS SELECT * FROM nosuchtable;
----
stmt 0 ok
stmt 25 err 1 -1 67 no such table: main.t1
stmt 134 ok
==== 24.2.1
ALTER TABLE t1 RENAME TO t2;
----
stmt 0 err 1 -1 31 no such table: t1
==== 25.1
CREATE TABLE xx(x);
CREATE VIEW v3(b) AS WITH b AS (SELECT b FROM (SELECT * FROM t2)) VALUES(1);
----
stmt 0 ok
stmt 22 ok
==== 25.2
ALTER TABLE json_each RENAME TO t4;
----
stmt 0 err 1 -1 40 table json_each may not be altered
==== 26.1
CREATE TABLE t1(k,v);
CREATE TABLE t2_a(k,v);
CREATE VIEW t2 AS SELECT * FROM t2_a;
CREATE TRIGGER r2 AFTER INSERT ON t1 BEGIN
UPDATE t1
SET (k,v)=((WITH cte1(a) AS (SELECT 1 FROM t2) SELECT t2.k FROM t2, cte1),1);
END;
ALTER TABLE t1 RENAME TO t1x;
INSERT INTO t2_a VALUES(2,3);
INSERT INTO t1x VALUES(98,99);
SELECT * FROM t1x;
----
stmt 0 ok
stmt 24 ok
stmt 50 ok
stmt 90 err 1 -1 135 no such table: main.t1
stmt 242 err 1 -1 274 no such table: t1
stmt 274 err 1 -1 306 no such table: t2_a
stmt 306 err 1 -1 339 no such table: t1x
stmt 339 err 1 -1 360 no such table: t1x
==== 27.1
create table t_sa (
c_muyat INTEGER NOT NULL,
c_d4u TEXT
);
create table t2 ( abc );
CREATE TRIGGER trig AFTER DELETE ON t_sa
BEGIN
DELETE FROM t_sa WHERE (
SELECT 123 FROM t2
WINDOW oamat7fzf AS ( PARTITION BY t_sa.c_d4u )
);
END;
----
stmt 0 ok
stmt 66 ok
stmt 93 err 1 -1 145 no such table: main.t_sa
==== 27.2
alter table t_sa rename column c_muyat to c_dg;
----
stmt 0 err 1 -1 50 no such table: t_sa
==== 29.1
CREATE TABLE t1(a, b, c);
INSERT INTO t1 VALUES('a', 'b', 'c');
CREATE VIEW v0 AS
WITH p AS ( SELECT 1 FROM t1 ),
g AS ( SELECT 1 FROM p, t1 )
SELECT 1 FROM g;
----
stmt 0 ok
stmt 28 err 1 -1 68 no such table: t1
stmt 68 ok
==== 29.2
SELECT * FROM v0
----
stmt 0 err 1 -1 20 no such table: v0
==== 29.2.dup1
ALTER TABLE t1 RENAME TO t2
----
stmt 0 err 1 -1 31 no such table: t1
==== 29.3
SELECT sql FROM sqlite_schema WHERE name='v0'
----
stmt 0 ok
==== 29.4
CREATE VIEW v2 AS
WITH p AS ( SELECT 1 FROM t2 ),
g AS ( SELECT 1 FROM (
WITH i AS (SELECT 1 FROM p, t2)
SELECT * FROM i
)
)
SELECT 1 FROM g;
----
stmt 0 ok
==== 29.4.dup1
SELECT * FROM v2;
----
stmt 0 err 1 -1 22 no such table: v2
==== 29.5
ALTER TABLE t2 RENAME TO t3;
----
stmt 0 err 1 -1 31 no such table: t2
==== 29.5.dup1
SELECT sql FROM sqlite_schema WHERE name='v2'
----
stmt 0 ok
==== 28.1
CREATE TABLE t1(a);
CREATE TABLE t2(b,c);
CREATE TABLE t4(b,c);
INSERT INTO t2 VALUES(1,2),(1,3),(2,5);
INSERT INTO t4 VALUES(1,2),(1,3),(2,5);
CREATE VIEW v3 AS
WITH RECURSIVE t3(x,y,z) AS (
SELECT b,c,NULL FROM t4
UNION
SELECT x,y,NULL FROM t3, t2
)
SELECT * FROM t3 AS xyz;
----
stmt 0 ok
stmt 22 ok
stmt 46 ok
stmt 70 err 1 -1 112 no such table: t2
stmt 112 err 1 -1 154 no such table: t4
stmt 154 ok
==== 28.2
SELECT * FROM v3
----
stmt 0 err 1 -1 20 no such table: v3
==== 28.3
ALTER TABLE t1 RENAME a TO a2; -- fails in v3
----
stmt 0 err 1 -1 33 no such table: t1
==== 28.4
ALTER TABLE t2 RENAME TO t5;
----
stmt 0 err 1 -1 31 no such table: t2
==== 28.5
SELECT sql FROM sqlite_schema WHERE name='v3'
----
stmt 0 ok
==== 30.0
CREATE TABLE t1(a,b,c,d,e,f);
CREATE TABLE t2(a,b,c);
CREATE INDEX t1abc ON t1(a,b,c+d+e);
CREATE VIEW v1(x,y) AS
SELECT t1.b,t2.b FROM t1,t2 WHERE t1.a=t2.a
GROUP BY 1 HAVING t2.c NOT NULL LIMIT 10;
CREATE TRIGGER r1 AFTER INSERT ON t1 WHEN 'no' NOT NULL BEGIN
INSERT INTO t2(a,a,b,c) VALUES(new.b,new.a,new.c-7);
WITH c1(x) AS (
VALUES(0)
UNION ALL
SELECT current_time+x FROM c1 WHERE x
UNION ALL
SELECT 1+x FROM c1 WHERE x<1
), c2(x) AS (VALUES(0),(1))
SELECT * FROM c1 AS x1, c2 AS x2, (
SELECT x+1 FROM c1 WHERE x IS NOT TRUE
UNION ALL
SELECT 1+x FROM c1 WHERE 1<x
) AS x3, c2 x5;
END;
----
stmt 0 ok
stmt 32 ok
stmt 58 err 1 -1 97 no such table: main.t1
stmt 97 ok
stmt 220 err 1 -1 284 no such table: main.t1
==== 30.1
ALTER TABLE t1 RENAME TO t1x;
----
stmt 0 err 1 -1 32 no such table: t1
==== 30.2
SELECT sql FROM sqlite_schema ORDER BY rowid
----
stmt 0 ok
==== 31.0
CREATE TABLE t1(q);
CREATE VIEW vvv AS WITH x AS (WITH y AS (SELECT * FROM x) SELECT 1) SELECT 1;
----
stmt 0 ok
stmt 22 ok
==== 31.1
SELECT * FROM vvv;
----
stmt 0 err 1 -1 21 no such table: vvv
==== 31.2