# name: test/sql/pragma/test_show_tables.test # description: Test SHOW/DESCRIBE tables # group: [pragma] statement ok CREATE TABLE integers(i INTEGER, j INTEGER) statement ok CREATE TABLE "select"(i INTEGER); statement ok CREATE VIEW v1 AS SELECT DATE '1992-01-01' AS k statement ok CREATE TABLE t2 (id INTEGER PRIMARY KEY, j VARCHAR UNIQUE) statement ok CREATE SCHEMA s1; statement ok CREATE TABLE s1.tbl(i INTEGER UNIQUE); statement ok CREATE INDEX my_index ON s1.tbl(i); statement ok CREATE TABLE tbl(i INTEGER PRIMARY KEY); statement ok CREATE INDEX not_a_table ON tbl(i); # We test that right table is described (from s1 schema) # column_name | column_type | null | key | default | extra query TTTITI DESCRIBE s1.tbl; ---- i INTEGER YES UNI NULL NULL # We test that the index can't be described statement error DESCRIBE my_index; ---- # We test that right table is described (from main schema) # column_name | column_type | null | key | default | extra query TTTITI DESCRIBE tbl; ---- i INTEGER NO PRI NULL NULL # Validate PRI and UNI constrains # column_name | column_type | null | key | default | extra query TTTITI DESCRIBE t2 ---- id INTEGER NO PRI NULL NULL j VARCHAR YES UNI NULL NULL # equivalent to DESCRIBE t2 # column_name | column_type | null | key | default | extra query TTTITI PRAGMA "SHOW"('t2') ---- id INTEGER NO PRI NULL NULL j VARCHAR YES UNI NULL NULL # SHOW and DESCRIBE are aliases query T SHOW TABLES ---- integers select t2 tbl v1 query T DESCRIBE TABLES ---- integers select t2 tbl v1 # internally they are equivalent to PRAGMA SHOW_TABLES(); query T PRAGMA show_tables ---- integers select t2 tbl v1 # column_name | column_type | null | key | default | extra query TTTITI SHOW integers ---- i INTEGER YES NULL NULL NULL j INTEGER YES NULL NULL NULL # column_name | column_type | null | key | default | extra query TTTITI SHOW "select"; ---- i INTEGER YES NULL NULL NULL # equivalent to PRAGMA SHOW('integers') # column_name | column_type | null | key | default | extra query TTTITI PRAGMA "SHOW"('integers') ---- i INTEGER YES NULL NULL NULL j INTEGER YES NULL NULL NULL # we can also describe views # column_name | column_type | null | key | default | extra query TTTITI DESCRIBE v1 ---- k DATE YES NULL NULL NULL # view over show tables statement ok CREATE VIEW show_tables_view AS ( SHOW TABLES ); query T SELECT * FROM show_tables_view ORDER BY ALL ---- integers select show_tables_view t2 tbl v1