File: duckdb_tables.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 (49 lines) | stat: -rw-r--r-- 1,004 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
# name: test/sql/table_function/duckdb_tables.test
# description: Test duckdb_tables function
# group: [table_function]

query I
SELECT COUNT(*) FROM duckdb_tables();
----
0

statement ok
CREATE TABLE integers(i INTEGER)

statement ok
CREATE TABLE pk(i INTEGER PRIMARY KEY, j VARCHAR, CHECK(i<100))

statement ok
CREATE SCHEMA myschema;

statement ok
CREATE TABLE myschema.mytable(k DOUBLE)

statement ok
CREATE TEMPORARY TABLE mytemp(i INTEGER)

statement ok
CREATE VIEW v1 AS SELECT 42

query IIIIIIII
SELECT schema_name, table_name, temporary, has_primary_key, estimated_size, column_count, index_count, check_constraint_count
FROM duckdb_tables() ORDER BY table_name;
----
main	integers	False	False	0	1	0	0
myschema	mytable	False	False	0	1	0	0
main	mytemp	True	False	0	1	0	0
main	pk	False	True	0	2	1	1

query I
SELECT database_name = current_database() OR database_name = 'temp'
FROM duckdb_tables();
----
True
True
True
True

statement error
SELECT * FROM temp.duckdb_tables
----
main.duckdb_tables