File: sqlite_master.test

package info (click to toggle)
duckdb 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 558
file content (63 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download | duplicates (3)
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
# name: test/sql/table_function/sqlite_master.test
# description: Test sqlite_master function
# group: [table_function]

statement ok
CREATE TABLE integers(i INTEGER);

query IIIII
SELECT * FROM sqlite_master;
----
table	integers	integers	0	CREATE TABLE integers(i INTEGER);

query I
SELECT EXISTS(SELECT * FROM sqlite_master)
----
1

query I
SELECT EXISTS(SELECT * FROM sqlite_master OFFSET 1)
----
0

query I
SELECT COUNT(*) FROM sqlite_master WHERE name='test'
----
0

query I
SELECT COUNT(*) FROM sqlite_master WHERE name='integers'
----
1

statement ok
create table tconstraint1(i integer primary key default(3), j blob not null);

query IIIII
SELECT * FROM sqlite_master WHERE name='tconstraint1';
----
table	tconstraint1	tconstraint1	0	CREATE TABLE tconstraint1(i INTEGER DEFAULT(3) PRIMARY KEY, j BLOB NOT NULL);

statement ok
create table tconstraint2(i integer, j integer, k integer, l integer unique, primary key(i, j, k));

query IIIII
SELECT * FROM sqlite_master WHERE name='tconstraint2';
----
table	tconstraint2	tconstraint2	0	CREATE TABLE tconstraint2(i INTEGER, j INTEGER, k INTEGER, l INTEGER UNIQUE, PRIMARY KEY(i, j, k));

statement ok
CREATE INDEX i_index ON integers(i);

query IIIII
SELECT * REPLACE (trim(sql, chr(10)) as sql) FROM sqlite_master WHERE name='i_index';
----
index	i_index	integers	0	CREATE INDEX i_index ON integers(i);

statement ok
CREATE VIEW v1 AS SELECT 42

query IIII
SELECT "type", "name", "tbl_name", rootpage FROM sqlite_master WHERE name='v1';
----
view	v1	v1	0