should be it
This commit is contained in:
13
external/duckdb/test/sql/pragma/pragma_database_size_readonly.test
vendored
Normal file
13
external/duckdb/test/sql/pragma/pragma_database_size_readonly.test
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# name: test/sql/pragma/pragma_database_size_readonly.test
|
||||
# description: PRAGMA database_size read only
|
||||
# group: [pragma]
|
||||
|
||||
load __TEST_DIR__/database_size_read_only.db
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER);
|
||||
|
||||
load __TEST_DIR__/database_size_read_only.db readonly
|
||||
|
||||
statement ok
|
||||
PRAGMA database_size
|
||||
102
external/duckdb/test/sql/pragma/profiling/test_attach_and_checkpoint_latency.test
vendored
Normal file
102
external/duckdb/test/sql/pragma/profiling/test_attach_and_checkpoint_latency.test
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
# name: test/sql/pragma/profiling/test_attach_and_checkpoint_latency.test
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
require noforcestorage
|
||||
|
||||
require skip_reload
|
||||
|
||||
# Setup.
|
||||
|
||||
statement ok
|
||||
SET threads = 1;
|
||||
|
||||
statement ok
|
||||
SET wal_autocheckpoint = '1TB';
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown;
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"WAITING_TO_ATTACH_LATENCY": "true", "ATTACH_LOAD_STORAGE_LATENCY": "true", "ATTACH_REPLAY_WAL_LATENCY": "true", "CHECKPOINT_LATENCY": "true"}';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
# Finished setup.
|
||||
|
||||
# CHECKPOINT_LATENCY.
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/profile_fs.db';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE profile_fs.tbl AS SELECT range AS id FROM range(100_000);
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
CHECKPOINT profile_fs;
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN checkpoint_latency > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
# WAITING_TO_ATTACH_LATENCY, ATTACH_LOAD_STORAGE_LATENCY and ATTACH_REPLAY_WAL_LATENCY.
|
||||
|
||||
statement ok
|
||||
CREATE TABLE profile_fs.other_tbl AS SELECT range AS id FROM range(100_000);
|
||||
|
||||
statement ok
|
||||
DETACH profile_fs;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/profile_fs.db';
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN waiting_to_attach_latency > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN attach_load_storage_latency > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN attach_replay_wal_latency > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
46
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_blocked_thread_time.test
vendored
Normal file
46
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_blocked_thread_time.test
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_blocked_thread_time.test
|
||||
# description: Test BLOCKED_THREAD_TIME metric.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA threads = 4;
|
||||
|
||||
statement ok
|
||||
CREATE TABLE bigdata AS SELECT i AS col_a, i AS col_b FROM range(0, 10000) tbl(i);
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"BLOCKED_THREAD_TIME": "true"}';
|
||||
|
||||
statement ok
|
||||
SELECT (SELECT COUNT(*) FROM bigdata WHERE col_a = 1) + (SELECT COUNT(*) FROM bigdata WHERE col_b = 1);
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL
|
||||
----
|
||||
"BLOCKED_THREAD_TIME": "true"
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
query I
|
||||
SELECT COUNT(blocked_thread_time) FROM metrics_output;
|
||||
----
|
||||
1
|
||||
108
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_disable_metrics.test
vendored
Normal file
108
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_disable_metrics.test
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_disable_metrics.test
|
||||
# description: Change CPU_TIME and other metrics.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"CPU_TIME": "false", "EXTRA_INFO": "true", "OPERATOR_CARDINALITY": "true", "OPERATOR_TIMING": "true", "LATENCY": "true"}';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
# Evaluate results.
|
||||
|
||||
query I rowsort
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL;
|
||||
----
|
||||
"EXTRA_INFO": "true"
|
||||
"LATENCY": "true"
|
||||
"OPERATOR_CARDINALITY": "true"
|
||||
"OPERATOR_TIMING": "true"
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement error
|
||||
SELECT cpu_time FROM metrics_output;
|
||||
----
|
||||
<REGEX>:Binder Error.*Referenced column "cpu_time" not found in FROM clause!.*
|
||||
|
||||
statement ok
|
||||
SELECT extra_info, latency FROM metrics_output;
|
||||
|
||||
# Re-enable the CPU TIME.
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"CPU_TIME": "true", "EXTRA_INFO": "true", "CUMULATIVE_CARDINALITY": "true", "CUMULATIVE_ROWS_SCANNED": "true"}'
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL
|
||||
----
|
||||
"CPU_TIME": "true"
|
||||
"CUMULATIVE_CARDINALITY": "true"
|
||||
"CUMULATIVE_ROWS_SCANNED": "true"
|
||||
"EXTRA_INFO": "true"
|
||||
|
||||
# Re-enabled profiling.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN cpu_time > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN cumulative_cardinality > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
# Only collect ROWS_SCANNED for table queries.
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN cumulative_rows_scanned > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
false
|
||||
|
||||
28
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_errors.test
vendored
Normal file
28
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_errors.test
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_errors.test
|
||||
# description: Test different errors for custom_profiling_settings.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement error
|
||||
PRAGMA custom_profiling_settings='}}}}}}'
|
||||
----
|
||||
<REGEX>:IO Error.*Could not parse the custom profiler settings file due to incorrect JSON: "}}}}}}".*
|
||||
|
||||
statement error
|
||||
PRAGMA custom_profiling_settings=BONJOUR
|
||||
----
|
||||
<REGEX>:IO Error.*Could not parse the custom profiler settings file due to incorrect JSON: "BONJOUR".*
|
||||
|
||||
statement error
|
||||
PRAGMA custom_profiling_settings=[NOT_A_JSON]
|
||||
----
|
||||
<REGEX>:Binder Error.*SET value cannot contain column names.*
|
||||
|
||||
statement error
|
||||
PRAGMA custom_profiling_settings='{"INVALID_SETTING": "true"}'
|
||||
----
|
||||
<REGEX>:IO Error.*Invalid custom profiler settings: "INVALID_SETTING".*
|
||||
62
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_memory_and_temp_dir.test_slow
vendored
Normal file
62
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_memory_and_temp_dir.test_slow
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_memory_and_temp_dir.test_slow
|
||||
# description: Test SYSTEM_PEAK_BUFFER_MEMORY and SYSTEM_PEAK_TEMP_DIR_SIZE metrics.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
SET memory_limit = '0.7gb';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE test AS SELECT hash(range) i FROM range(100_000_000);
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
# should both be non-zero, and sum up to ~1 GB
|
||||
query III
|
||||
SELECT
|
||||
system_peak_buffer_memory != 0,
|
||||
system_peak_temp_dir_size != 0,
|
||||
round((system_peak_buffer_memory + system_peak_temp_dir_size) / 1e9),
|
||||
FROM metrics_output;
|
||||
----
|
||||
true true 1.0
|
||||
|
||||
# disabling should omit them from output
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"SYSTEM_PEAK_BUFFER_MEMORY": "false", "SYSTEM_PEAK_TEMP_DIR_SIZE": "false"}';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE test AS SELECT hash(range) i FROM range(100_000_000);
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement error
|
||||
SELECT system_peak_buffer_memory FROM metrics_output;
|
||||
----
|
||||
Binder Error
|
||||
|
||||
statement error
|
||||
SELECT system_peak_temp_dir_size FROM metrics_output;
|
||||
----
|
||||
Binder Error
|
||||
200
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_optimizer.test
vendored
Normal file
200
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_optimizer.test
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_optimizer.test
|
||||
# description: Test custom optimizer profiling settings.
|
||||
# group: [profiling]
|
||||
|
||||
# This file is automatically generated by scripts/generate_metric_enums.py
|
||||
# Do not edit this file manually, your changes will be overwritten
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"ALL_OPTIMIZERS": "true"}';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT * FROM (
|
||||
SELECT unnest(res) str FROM (
|
||||
SELECT current_setting('custom_profiling_settings') as raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
)
|
||||
) WHERE '"true"' NOT in str
|
||||
ORDER BY ALL
|
||||
----
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{}'
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL;
|
||||
----
|
||||
(empty)
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"OPTIMIZER_JOIN_ORDER": "true"}'
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL;
|
||||
----
|
||||
"OPTIMIZER_JOIN_ORDER": "true"
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN optimizer_join_order > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
statement ok
|
||||
SET disabled_optimizers = 'JOIN_ORDER';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"OPTIMIZER_JOIN_ORDER": "true"}'
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL;
|
||||
----
|
||||
(empty)
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"CUMULATIVE_OPTIMIZER_TIMING": "true"}';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN cumulative_optimizer_timing > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
# All phase timings must be collected when using detailed profiling mode.
|
||||
|
||||
statement ok
|
||||
RESET custom_profiling_settings;
|
||||
|
||||
statement ok
|
||||
SET profiling_mode = 'detailed';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT * FROM (
|
||||
SELECT unnest(res) str FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
)
|
||||
)
|
||||
WHERE '"true"' NOT IN str
|
||||
ORDER BY ALL
|
||||
----
|
||||
|
||||
statement ok
|
||||
RESET custom_profiling_settings;
|
||||
|
||||
statement ok
|
||||
SET profiling_mode = 'standard';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL;
|
||||
----
|
||||
"ATTACH_LOAD_STORAGE_LATENCY": "true"
|
||||
"ATTACH_REPLAY_WAL_LATENCY": "true"
|
||||
"BLOCKED_THREAD_TIME": "true"
|
||||
"CHECKPOINT_LATENCY": "true"
|
||||
"CPU_TIME": "true"
|
||||
"CUMULATIVE_CARDINALITY": "true"
|
||||
"CUMULATIVE_ROWS_SCANNED": "true"
|
||||
"EXTRA_INFO": "true"
|
||||
"LATENCY": "true"
|
||||
"OPERATOR_CARDINALITY": "true"
|
||||
"OPERATOR_NAME": "true"
|
||||
"OPERATOR_ROWS_SCANNED": "true"
|
||||
"OPERATOR_TIMING": "true"
|
||||
"OPERATOR_TYPE": "true"
|
||||
"QUERY_NAME": "true"
|
||||
"RESULT_SET_SIZE": "true"
|
||||
"ROWS_RETURNED": "true"
|
||||
"SYSTEM_PEAK_BUFFER_MEMORY": "true"
|
||||
"SYSTEM_PEAK_TEMP_DIR_SIZE": "true"
|
||||
"TOTAL_BYTES_READ": "true"
|
||||
"TOTAL_BYTES_WRITTEN": "true"
|
||||
"WAITING_TO_ATTACH_LATENCY": "true"
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
SELECT cpu_time, extra_info, rows_returned, latency FROM metrics_output;
|
||||
|
||||
68
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_planner.test_slow
vendored
Normal file
68
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_planner.test_slow
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_planner.test_slow
|
||||
# description: Test profiling the physical planner.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"PLANNER": "true", "PHYSICAL_PLANNER": "true"}';
|
||||
|
||||
loop i 0 8
|
||||
|
||||
statement ok
|
||||
CREATE TABLE t${i}(a int);
|
||||
|
||||
statement ok
|
||||
INSERT INTO t${i} VALUES (1);
|
||||
|
||||
endloop
|
||||
|
||||
statement ok
|
||||
SELECT t1.a FROM t1
|
||||
JOIN t2 ON t1.a = t2.a
|
||||
JOIN t3 ON t2.a = t3.a
|
||||
JOIN t4 ON t3.a = t4.a
|
||||
JOIN t5 ON t4.a = t5.a
|
||||
JOIN t6 ON t5.a = t6.a
|
||||
JOIN t7 ON t6.a = t7.a;
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I rowsort
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL
|
||||
----
|
||||
"PHYSICAL_PLANNER": "true"
|
||||
"PLANNER": "true"
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN physical_planner > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN planner > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
43
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_result_set_size.test
vendored
Normal file
43
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_result_set_size.test
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_result_set_size.test
|
||||
# description: Test RESULT_SET_SIZE metric.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"RESULT_SET_SIZE": "true", "OPERATOR_CARDINALITY": "true"}'
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
CREATE TYPE Result AS UNION (
|
||||
Ok BOOLEAN,
|
||||
Err BIGINT
|
||||
);
|
||||
|
||||
# Expected size: 144 = 9 (length of list) * 12 (size of a string)
|
||||
query I
|
||||
SELECT
|
||||
CASE
|
||||
WHEN result_set_size = 144 THEN TRUE::Result
|
||||
ELSE result_set_size::Result
|
||||
END AS result
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
71
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_rows_scanned.test
vendored
Normal file
71
external/duckdb/test/sql/pragma/profiling/test_custom_profiling_rows_scanned.test
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# name: test/sql/pragma/profiling/test_custom_profiling_rows_scanned.test
|
||||
# description: Test ROWS_SCANNED metric.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"OPERATOR_CARDINALITY": "true", "OPERATOR_ROWS_SCANNED": "true", "CUMULATIVE_CARDINALITY": "true", "CUMULATIVE_ROWS_SCANNED": "true"}';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO integers VALUES (1), (2), (3), (NULL);
|
||||
|
||||
statement ok
|
||||
SELECT * FROM integers i1, integers i2 WHERE i1.i = i2.i ORDER BY 1;
|
||||
|
||||
statement ok
|
||||
pragma disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
SELECT cumulative_cardinality, cumulative_rows_scanned FROM metrics_output;
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN cumulative_rows_scanned > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
# Only output the cumulative metric.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"CUMULATIVE_CARDINALITY": "true", "CUMULATIVE_ROWS_SCANNED": "true", "BLOCKED_THREAD_TIME": "true"}';
|
||||
|
||||
statement ok
|
||||
SELECT * FROM integers i1, integers i2 WHERE i1.i = i2.i ORDER BY 1;
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN cumulative_rows_scanned > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
60
external/duckdb/test/sql/pragma/profiling/test_default_profiling_settings.test
vendored
Normal file
60
external/duckdb/test/sql/pragma/profiling/test_default_profiling_settings.test
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# name: test/sql/pragma/profiling/test_default_profiling_settings.test
|
||||
# description: Test default profiling settings.
|
||||
# group: [profiling]
|
||||
|
||||
# This file is automatically generated by scripts/generate_metric_enums.py
|
||||
# Do not edit this file manually, your changes will be overwritten
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL;
|
||||
----
|
||||
"ATTACH_LOAD_STORAGE_LATENCY": "true"
|
||||
"ATTACH_REPLAY_WAL_LATENCY": "true"
|
||||
"BLOCKED_THREAD_TIME": "true"
|
||||
"CHECKPOINT_LATENCY": "true"
|
||||
"CPU_TIME": "true"
|
||||
"CUMULATIVE_CARDINALITY": "true"
|
||||
"CUMULATIVE_ROWS_SCANNED": "true"
|
||||
"EXTRA_INFO": "true"
|
||||
"LATENCY": "true"
|
||||
"OPERATOR_CARDINALITY": "true"
|
||||
"OPERATOR_NAME": "true"
|
||||
"OPERATOR_ROWS_SCANNED": "true"
|
||||
"OPERATOR_TIMING": "true"
|
||||
"OPERATOR_TYPE": "true"
|
||||
"QUERY_NAME": "true"
|
||||
"RESULT_SET_SIZE": "true"
|
||||
"ROWS_RETURNED": "true"
|
||||
"SYSTEM_PEAK_BUFFER_MEMORY": "true"
|
||||
"SYSTEM_PEAK_TEMP_DIR_SIZE": "true"
|
||||
"TOTAL_BYTES_READ": "true"
|
||||
"TOTAL_BYTES_WRITTEN": "true"
|
||||
"WAITING_TO_ATTACH_LATENCY": "true"
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
SELECT cpu_time, extra_info, rows_returned, latency FROM metrics_output;
|
||||
|
||||
62
external/duckdb/test/sql/pragma/profiling/test_empty_profiling_settings.test
vendored
Normal file
62
external/duckdb/test/sql/pragma/profiling/test_empty_profiling_settings.test
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# name: test/sql/pragma/profiling/test_empty_profiling_settings.test
|
||||
# description: Test empty profiling settings.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{}'
|
||||
|
||||
statement ok
|
||||
SELECT unnest(['Maia', 'Thijs', 'Mark', 'Hannes', 'Tom', 'Max', 'Carlo', 'Sam', 'Tania']) AS names ORDER BY random();
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
# Evaluate results.
|
||||
|
||||
query I
|
||||
SELECT unnest(res) FROM (
|
||||
SELECT current_setting('custom_profiling_settings') AS raw_setting,
|
||||
raw_setting.trim('{}') AS setting,
|
||||
string_split(setting, ', ') AS res
|
||||
) ORDER BY ALL
|
||||
----
|
||||
(empty)
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profiling_output.json';
|
||||
|
||||
statement error
|
||||
SELECT cpu_time FROM metrics_output;
|
||||
----
|
||||
<REGEX>:Binder Error.*Referenced column "cpu_time" not found in FROM clause!.*
|
||||
|
||||
statement error
|
||||
SELECT extra_info FROM metrics_output;
|
||||
----
|
||||
<REGEX>:Binder Error.*Referenced column "extra_info" not found in FROM clause!.*
|
||||
|
||||
statement error
|
||||
SELECT operator_cardinality FROM metrics_output;
|
||||
----
|
||||
<REGEX>:Binder Error.*Referenced column "operator_cardinality" not found in FROM clause!.*
|
||||
|
||||
statement error
|
||||
SELECT operator_timing FROM metrics_output;
|
||||
----
|
||||
<REGEX>:Binder Error.*Referenced column "operator_timing" not found in FROM clause!.*
|
||||
|
||||
statement error
|
||||
SELECT cumulative_cardinality FROM metrics_output;
|
||||
----
|
||||
<REGEX>:Binder Error.*Referenced column "cumulative_cardinality" not found in FROM clause!.*
|
||||
15
external/duckdb/test/sql/pragma/profiling/test_no_reset_setting.test
vendored
Normal file
15
external/duckdb/test/sql/pragma/profiling/test_no_reset_setting.test
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# name: test/sql/pragma/profiling/test_no_reset_setting.test
|
||||
# description: Test that the profiling settings are not reset after setting profiling output.
|
||||
# group: [profiling]
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profile_file.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"TOTAL_BYTES_READ": "true", "TOTAL_BYTES_WRITTEN": "true"}';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
135
external/duckdb/test/sql/pragma/profiling/test_profiling_all.test
vendored
Normal file
135
external/duckdb/test/sql/pragma/profiling/test_profiling_all.test
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
# name: test/sql/pragma/profiling/test_profiling_all.test
|
||||
# description: Test profiling all operator types.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
require skip_reload
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profile_attach.json';
|
||||
|
||||
# Test ATTACH.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/profile_attach.db';
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='SELECT';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_attach.json';
|
||||
|
||||
query II
|
||||
SELECT latency != 0, contains(query_name, 'ATTACH') FROM metrics_output;
|
||||
----
|
||||
true true
|
||||
|
||||
# Test CREATE TABLE.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE profile_attach.tbl AS SELECT range AS id FROM range(10000);
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='SELECT';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_attach.json';
|
||||
|
||||
query II
|
||||
SELECT latency != 0, contains(query_name, 'CREATE TABLE') FROM metrics_output;
|
||||
----
|
||||
true true
|
||||
|
||||
# Test INSERT.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
INSERT INTO profile_attach.tbl SELECT range + 20000 FROM range(10000);
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='SELECT';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_attach.json';
|
||||
|
||||
query II
|
||||
SELECT latency != 0, contains(query_name, 'INSERT INTO') FROM metrics_output;
|
||||
----
|
||||
true true
|
||||
|
||||
# Test CREATE INDEX.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
CREATE INDEX idx ON profile_attach.tbl(id);
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='SELECT';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_attach.json';
|
||||
|
||||
query II
|
||||
SELECT latency != 0, contains(query_name, 'CREATE INDEX') FROM metrics_output;
|
||||
----
|
||||
true true
|
||||
|
||||
# Test DETACH.
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
DETACH profile_attach;
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='SELECT';
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_attach.json';
|
||||
|
||||
query II
|
||||
SELECT latency != 0, contains(query_name, 'DETACH') FROM metrics_output;
|
||||
----
|
||||
true true
|
||||
91
external/duckdb/test/sql/pragma/profiling/test_profiling_fs.test
vendored
Normal file
91
external/duckdb/test/sql/pragma/profiling/test_profiling_fs.test
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
# name: test/sql/pragma/profiling/test_profiling_fs.test
|
||||
# description: Test profiling file system reads and writes.
|
||||
# group: [profiling]
|
||||
|
||||
require json
|
||||
|
||||
require noforcestorage
|
||||
|
||||
require skip_reload
|
||||
|
||||
# FIXME: Enable when more read paths have been added to profiling.
|
||||
require no_alternative_verify
|
||||
|
||||
statement ok
|
||||
SET threads = 1;
|
||||
|
||||
statement ok
|
||||
SET wal_autocheckpoint = '1TB';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/profile_fs.db';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE profile_fs.tbl AS SELECT range AS id FROM range(10000);
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"TOTAL_BYTES_READ": "true", "TOTAL_BYTES_WRITTEN": "true"}';
|
||||
|
||||
statement ok
|
||||
SET profiling_coverage='ALL';
|
||||
|
||||
statement ok
|
||||
CHECKPOINT profile_fs;
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
statement ok
|
||||
SELECT total_bytes_written FROM metrics_output;
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN total_bytes_written > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
|
||||
statement ok
|
||||
CREATE INDEX idx ON profile_fs.tbl(id);
|
||||
|
||||
statement ok
|
||||
DETACH profile_fs;
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_profiling = 'json';
|
||||
|
||||
statement ok
|
||||
PRAGMA profiling_output = '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
statement ok
|
||||
PRAGMA custom_profiling_settings='{"TOTAL_BYTES_READ": "true", "TOTAL_BYTES_WRITTEN": "true"}';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/profile_fs.db';
|
||||
|
||||
statement ok
|
||||
SELECT * FROM profile_fs.tbl;
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_profiling;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE metrics_output AS SELECT * FROM '__TEST_DIR__/profile_fs.json';
|
||||
|
||||
query I
|
||||
SELECT
|
||||
CASE WHEN total_bytes_read > 0 THEN 'true'
|
||||
ELSE 'false' END
|
||||
FROM metrics_output;
|
||||
----
|
||||
true
|
||||
10
external/duckdb/test/sql/pragma/test_db_invalidation_after_load.test
vendored
Normal file
10
external/duckdb/test/sql/pragma/test_db_invalidation_after_load.test
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
# name: test/sql/pragma/test_db_invalidation_after_load.test
|
||||
# description: Test trying to disable database invalidation after opening the database.
|
||||
# group: [pragma]
|
||||
|
||||
load __TEST_DIR__/db_invalidation.db
|
||||
|
||||
statement error
|
||||
SET disable_database_invalidation=true;
|
||||
----
|
||||
<REGEX>:Invalid Input Error.*Cannot change disable_database_invalidation setting while database is running.*
|
||||
23
external/duckdb/test/sql/pragma/test_disabled_compression.test
vendored
Normal file
23
external/duckdb/test/sql/pragma/test_disabled_compression.test
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# name: test/sql/pragma/test_disabled_compression.test
|
||||
# description: Test PRAGMA force_compression
|
||||
# group: [pragma]
|
||||
|
||||
foreach compression rle dictionary bitpacking fsst
|
||||
|
||||
statement ok
|
||||
PRAGMA disabled_compression_methods='${compression}'
|
||||
|
||||
endloop
|
||||
|
||||
statement error
|
||||
PRAGMA disabled_compression_methods='uncompressed,rle'
|
||||
----
|
||||
Uncompressed compression cannot be disabled
|
||||
|
||||
statement ok
|
||||
PRAGMA disabled_compression_methods='dictionary,rle'
|
||||
|
||||
statement error
|
||||
PRAGMA disabled_compression_methods='xzx'
|
||||
----
|
||||
Unrecognized compression method
|
||||
16
external/duckdb/test/sql/pragma/test_enable_http_logging.test
vendored
Normal file
16
external/duckdb/test/sql/pragma/test_enable_http_logging.test
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# name: test/sql/pragma/test_enable_http_logging.test
|
||||
# description: Test PRAGMA enable_http_logging parsing
|
||||
# group: [pragma]
|
||||
|
||||
# select the location of where to save the http logging output (instead of printing to stdout)
|
||||
statement error
|
||||
SET http_logging_output='__TEST_DIR__/httplog.txt'
|
||||
----
|
||||
Not implemented Error: This setting is deprecated and can no longer be used. Check out the DuckDB docs on logging for more information
|
||||
|
||||
# disable/enable
|
||||
statement ok
|
||||
SET enable_http_logging=false
|
||||
|
||||
statement ok
|
||||
SET enable_http_logging=true
|
||||
32
external/duckdb/test/sql/pragma/test_enable_profile.test
vendored
Normal file
32
external/duckdb/test/sql/pragma/test_enable_profile.test
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# name: test/sql/pragma/test_enable_profile.test
|
||||
# description: Test PRAGMA enable_profiling parsing
|
||||
# group: [pragma]
|
||||
|
||||
# enable profiling cannot be called
|
||||
statement error
|
||||
PRAGMA enable_profiling()
|
||||
----
|
||||
Parser Error: syntax error at or near ")"
|
||||
|
||||
|
||||
statement error
|
||||
PRAGMA enable_profiling='unsupported'
|
||||
----
|
||||
Parser Error: Unrecognized print format unsupported, supported formats: [json, query_tree, query_tree_optimizer, no_output]
|
||||
|
||||
statement error
|
||||
PRAGMA profiling_output
|
||||
----
|
||||
|
||||
# select the location of where to save the profiling output (instead of printing to stdout)
|
||||
statement ok
|
||||
PRAGMA profiling_output='test.json'
|
||||
|
||||
# but we can clear it again
|
||||
statement ok
|
||||
PRAGMA profiling_output=''
|
||||
|
||||
# enable and disable profiling
|
||||
statement ok
|
||||
PRAGMA disable_profiling
|
||||
|
||||
15
external/duckdb/test/sql/pragma/test_force_compression.test
vendored
Normal file
15
external/duckdb/test/sql/pragma/test_force_compression.test
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# name: test/sql/pragma/test_force_compression.test
|
||||
# description: Test PRAGMA force_compression
|
||||
# group: [pragma]
|
||||
|
||||
foreach compression none uncompressed rle dictionary pfor bitpacking fsst dict_fsst
|
||||
|
||||
statement ok
|
||||
PRAGMA force_compression='${compression}'
|
||||
|
||||
endloop
|
||||
|
||||
statement error
|
||||
PRAGMA force_compression='unknown'
|
||||
----
|
||||
<REGEX>:.*Parser Error.*Unrecognized option for PRAGMA force_compression.*
|
||||
136
external/duckdb/test/sql/pragma/test_memory_limit.test
vendored
Normal file
136
external/duckdb/test/sql/pragma/test_memory_limit.test
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# name: test/sql/pragma/test_memory_limit.test
|
||||
# description: Test PRAGMA memory_limit
|
||||
# group: [pragma]
|
||||
|
||||
# set memory_limit
|
||||
statement ok
|
||||
PRAGMA memory_limit='1GB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit=-1
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='-1'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='none'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit=' -1'
|
||||
|
||||
# different units can be used
|
||||
# G and GB = gigabyte
|
||||
statement ok
|
||||
PRAGMA memory_limit='1G'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit=' 1G'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='1GB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='1gb'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit = '1GB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='1.0gb'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='1.0 gb'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='488.2 MiB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='1.0 gigabytes'
|
||||
|
||||
# M and MB = megabyte
|
||||
statement ok
|
||||
PRAGMA memory_limit='100M'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='100MB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='100mb'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='100 megabytes'
|
||||
|
||||
# K and KB = kilobyte
|
||||
statement ok
|
||||
PRAGMA memory_limit='10000K'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='10000KB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='10000kb'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='10000 kilobytes'
|
||||
|
||||
# B = byte
|
||||
statement ok
|
||||
PRAGMA memory_limit='100000B'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='100000b'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='100000 bytes'
|
||||
|
||||
# T and TB = terabyte
|
||||
statement ok
|
||||
PRAGMA memory_limit='0.01T'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='0.01TB'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='0.01tb'
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='0.01 terabytes'
|
||||
|
||||
# no unit or unknown units fail
|
||||
statement error
|
||||
PRAGMA memory_limit=100
|
||||
----
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit='0.01BG'
|
||||
----
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit='0.01BLA'
|
||||
----
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit='0.01PP'
|
||||
----
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit='0.01TEST'
|
||||
----
|
||||
|
||||
# we can't invoke it like this either
|
||||
statement error
|
||||
PRAGMA memory_limit
|
||||
----
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit()
|
||||
----
|
||||
Parser Error: syntax error at or near ")"
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit(1, 2)
|
||||
----
|
||||
|
||||
statement error
|
||||
PRAGMA memory_limit='blabla'
|
||||
----
|
||||
37
external/duckdb/test/sql/pragma/test_metadata_info.test
vendored
Normal file
37
external/duckdb/test/sql/pragma/test_metadata_info.test
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# name: test/sql/pragma/test_metadata_info.test
|
||||
# description: Test metadata info
|
||||
# group: [pragma]
|
||||
|
||||
load __TEST_DIR__/test_metadata_info.db
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER, j INTEGER)
|
||||
|
||||
statement ok
|
||||
CHECKPOINT
|
||||
|
||||
statement ok
|
||||
PRAGMA metadata_info;
|
||||
|
||||
statement ok
|
||||
FROM pragma_metadata_info();
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/test_metadata_info_attach.db' AS db1
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.integers(i INTEGER, j INTEGER)
|
||||
|
||||
statement ok
|
||||
CHECKPOINT db1
|
||||
|
||||
statement ok
|
||||
FROM pragma_metadata_info('db1');
|
||||
|
||||
statement error
|
||||
FROM pragma_metadata_info(NULL)
|
||||
----
|
||||
cannot be NULL
|
||||
24
external/duckdb/test/sql/pragma/test_pragma_database_list.test
vendored
Normal file
24
external/duckdb/test/sql/pragma/test_pragma_database_list.test
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# name: test/sql/pragma/test_pragma_database_list.test
|
||||
# description: Test PRAGMA database_list
|
||||
# group: [pragma]
|
||||
|
||||
require skip_reload
|
||||
|
||||
# explicitly load an in-memory database
|
||||
load
|
||||
|
||||
query III nosort dblist
|
||||
PRAGMA database_list
|
||||
|
||||
query III nosort dblist
|
||||
SELECT * FROM pragma_database_list
|
||||
|
||||
query II
|
||||
SELECT name, file FROM pragma_database_list
|
||||
----
|
||||
memory NULL
|
||||
|
||||
statement error
|
||||
PRAGMA database_list()
|
||||
----
|
||||
<REGEX>:.*Parser Error.*syntax error.*
|
||||
34
external/duckdb/test/sql/pragma/test_pragma_database_size.test
vendored
Normal file
34
external/duckdb/test/sql/pragma/test_pragma_database_size.test
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# name: test/sql/pragma/test_pragma_database_size.test
|
||||
# description: Test PRAGMA database_size
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
PRAGMA database_size;
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/db_size.db' AS db1
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.integers AS FROM range(1000000);
|
||||
|
||||
statement ok
|
||||
DROP TABLE db1.integers
|
||||
|
||||
statement ok
|
||||
CHECKPOINT db1
|
||||
|
||||
query I
|
||||
SELECT free_blocks>0 FROM pragma_database_size() WHERE database_name='db1';
|
||||
----
|
||||
true
|
||||
|
||||
statement ok
|
||||
DETACH db1
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/db_size.db' AS db1 (READ_ONLY)
|
||||
|
||||
query I
|
||||
SELECT free_blocks>0 FROM pragma_database_size() WHERE database_name='db1';
|
||||
----
|
||||
true
|
||||
6
external/duckdb/test/sql/pragma/test_pragma_functions.test
vendored
Normal file
6
external/duckdb/test/sql/pragma/test_pragma_functions.test
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# name: test/sql/pragma/test_pragma_functions.test
|
||||
# description: Test PRAGMA functions
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
PRAGMA functions
|
||||
37
external/duckdb/test/sql/pragma/test_pragma_parsing.test
vendored
Normal file
37
external/duckdb/test/sql/pragma/test_pragma_parsing.test
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# name: test/sql/pragma/test_pragma_parsing.test
|
||||
# description: Test PRAGMA parsing
|
||||
# group: [pragma]
|
||||
|
||||
# Almost pragma but not quite
|
||||
statement error
|
||||
PRAG
|
||||
----
|
||||
Parser Error: syntax error at or near "PRAG"
|
||||
|
||||
# Pragma without a keyword
|
||||
statement error
|
||||
PRAGMA
|
||||
----
|
||||
<REGEX>:.*Parser Error.*syntax error at end of input.*
|
||||
|
||||
# Unknown pragma error
|
||||
statement error
|
||||
PRAGMA random_unknown_pragma
|
||||
----
|
||||
|
||||
# Call pragma in wrong way
|
||||
statement error
|
||||
PRAGMA table_info = 3
|
||||
----
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER)
|
||||
|
||||
# Now it should work
|
||||
statement ok
|
||||
PRAGMA table_info('integers');
|
||||
|
||||
# Parsing also works with extra spaces
|
||||
statement ok
|
||||
PRAGMA table_info ('integers');
|
||||
|
||||
29
external/duckdb/test/sql/pragma/test_pragma_version.test
vendored
Normal file
29
external/duckdb/test/sql/pragma/test_pragma_version.test
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# name: test/sql/pragma/test_pragma_version.test
|
||||
# description: Test version pragma
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
PRAGMA version;
|
||||
|
||||
statement ok
|
||||
select * from pragma_version();
|
||||
|
||||
statement ok
|
||||
select library_version from pragma_version();
|
||||
|
||||
statement ok
|
||||
PRAGMA platform;
|
||||
|
||||
statement ok
|
||||
select * from pragma_platform();
|
||||
|
||||
statement ok
|
||||
select platform from pragma_platform();
|
||||
|
||||
query I
|
||||
SELECT count(*) FROM pragma_version() WHERE library_version LIKE 'v%';
|
||||
----
|
||||
1
|
||||
|
||||
statement ok
|
||||
pragma extension_versions;
|
||||
32
external/duckdb/test/sql/pragma/test_query_log.test
vendored
Normal file
32
external/duckdb/test/sql/pragma/test_query_log.test
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# name: test/sql/pragma/test_query_log.test
|
||||
# description: Test query logging
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
SELECT CURRENT_SETTING('log_query_path')
|
||||
|
||||
statement ok
|
||||
PRAGMA log_query_path='__TEST_DIR__/query_log.txt'
|
||||
|
||||
query I
|
||||
SELECT 42
|
||||
----
|
||||
42
|
||||
|
||||
statement ok
|
||||
SELECT 100;SELECT 200
|
||||
|
||||
statement ok
|
||||
SELECT CURRENT_SETTING('log_query_path')
|
||||
|
||||
statement ok
|
||||
PRAGMA log_query_path=''
|
||||
|
||||
query I
|
||||
SELECT * FROM read_csv('__TEST_DIR__/query_log.txt', columns={'sql': 'VARCHAR'}, auto_detect=false)
|
||||
----
|
||||
SELECT 42
|
||||
SELECT 100
|
||||
SELECT 200
|
||||
SELECT CURRENT_SETTING('log_query_path')
|
||||
PRAGMA log_query_path=''
|
||||
136
external/duckdb/test/sql/pragma/test_show_tables.test
vendored
Normal file
136
external/duckdb/test/sql/pragma/test_show_tables.test
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
# 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
|
||||
116
external/duckdb/test/sql/pragma/test_show_tables_from.test
vendored
Normal file
116
external/duckdb/test/sql/pragma/test_show_tables_from.test
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
# name: test/sql/pragma/test_show_tables_from.test
|
||||
# description: Test SHOW TABLES FROM syntax
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
ATTACH IF NOT EXISTS ':memory:' AS db
|
||||
|
||||
statement ok
|
||||
USE db
|
||||
|
||||
statement ok
|
||||
CREATE TABLE main_table1(i INTEGER)
|
||||
|
||||
statement ok
|
||||
CREATE SCHEMA test_schema
|
||||
|
||||
statement ok
|
||||
CREATE TABLE test_schema.test_schema_table1(k INTEGER)
|
||||
|
||||
statement ok
|
||||
ATTACH DATABASE ':memory:' AS db1
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.db1_table1(m INTEGER)
|
||||
|
||||
statement ok
|
||||
CREATE SCHEMA db1.db1_schema
|
||||
|
||||
statement ok
|
||||
CREATE TABLE db1.db1_schema.db1_schema_table1(n INTEGER)
|
||||
|
||||
statement ok
|
||||
ATTACH DATABASE ':memory:' AS "db_quo""ted"
|
||||
|
||||
statement ok
|
||||
CREATE SCHEMA "db_quo""ted"."db_quo""ted_schema";
|
||||
|
||||
statement ok
|
||||
CREATE TABLE "db_quo""ted"."db_quo""ted_schema"."db_quo""ted_table1"(m INTEGER)
|
||||
|
||||
# Test basic SHOW TABLES FROM database syntax
|
||||
query I
|
||||
SHOW TABLES FROM db.main
|
||||
----
|
||||
main_table1
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM db1
|
||||
----
|
||||
db1_schema_table1
|
||||
db1_table1
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM test_schema
|
||||
----
|
||||
test_schema_table1
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM db1.main
|
||||
----
|
||||
db1_table1
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM db1.db1_schema
|
||||
----
|
||||
db1_schema_table1
|
||||
|
||||
# Test with case insensitive database/schema names
|
||||
query I
|
||||
SHOW TABLES FROM DB1
|
||||
----
|
||||
db1_schema_table1
|
||||
db1_table1
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM DB1.DB1_SCHEMA
|
||||
----
|
||||
db1_schema_table1
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM db1.DB1_SCHEMA
|
||||
----
|
||||
db1_schema_table1
|
||||
|
||||
# Test with quoted identifiers
|
||||
statement ok
|
||||
CREATE SCHEMA "Quoted Schema"
|
||||
|
||||
statement ok
|
||||
CREATE TABLE "Quoted Schema"."Quoted Table"(r INTEGER)
|
||||
|
||||
query I
|
||||
SHOW TABLES FROM db."Quoted Schema"
|
||||
----
|
||||
Quoted Table
|
||||
|
||||
# Test with quotes in identifiers
|
||||
query I
|
||||
SHOW TABLES FROM "db_quo""ted"."db_quo""ted_schema"
|
||||
----
|
||||
db_quo"ted_table1
|
||||
|
||||
# Errors
|
||||
statement error
|
||||
SHOW TABLES FROM nonexistent_db
|
||||
----
|
||||
Catalog Error: SHOW TABLES FROM: No catalog + schema named "db.nonexistent_db" found
|
||||
|
||||
# Test non-existent schema
|
||||
statement error
|
||||
SHOW TABLES FROM main.nonexistent_schema
|
||||
----
|
||||
Catalog Error: SHOW TABLES FROM: No catalog + schema named "main.nonexistent_schema" found
|
||||
53
external/duckdb/test/sql/pragma/test_show_tables_temp_views.test
vendored
Normal file
53
external/duckdb/test/sql/pragma/test_show_tables_temp_views.test
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# name: test/sql/pragma/test_show_tables_temp_views.test
|
||||
# description: Test SHOW/DESCRIBE tables with views
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
CREATE TEMPORARY VIEW v1 AS SELECT 42 AS a
|
||||
|
||||
query I
|
||||
SHOW TABLES
|
||||
----
|
||||
v1
|
||||
|
||||
query IIIIII
|
||||
SHOW ALL TABLES
|
||||
----
|
||||
temp main v1 [a] [INTEGER] true
|
||||
|
||||
statement ok
|
||||
CREATE VIEW v2 AS SELECT 42 AS b
|
||||
|
||||
statement ok
|
||||
CREATE SCHEMA s1;
|
||||
|
||||
statement ok
|
||||
CREATE VIEW s1.v3 AS SELECT 42 AS c
|
||||
|
||||
query I
|
||||
SHOW TABLES
|
||||
----
|
||||
v1
|
||||
v2
|
||||
|
||||
query IIIIII
|
||||
SHOW ALL TABLES
|
||||
----
|
||||
memory main v2 [b] [INTEGER] false
|
||||
memory s1 v3 [c] [INTEGER] false
|
||||
temp main v1 [a] [INTEGER] true
|
||||
|
||||
statement ok
|
||||
SET schema='s1';
|
||||
|
||||
query I
|
||||
FROM v2
|
||||
----
|
||||
42
|
||||
|
||||
query I
|
||||
SHOW TABLES
|
||||
----
|
||||
v1
|
||||
v2
|
||||
v3
|
||||
51
external/duckdb/test/sql/pragma/test_storage_info.test
vendored
Normal file
51
external/duckdb/test/sql/pragma/test_storage_info.test
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# name: test/sql/pragma/test_storage_info.test
|
||||
# description: Test storage_info pragma
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_verification
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER, j INTEGER)
|
||||
|
||||
statement ok
|
||||
PRAGMA storage_info('integers')
|
||||
|
||||
statement ok
|
||||
INSERT INTO integers VALUES (1, 1), (2, NULL), (3, 3), (4, 5)
|
||||
|
||||
statement ok
|
||||
PRAGMA storage_info('integers')
|
||||
|
||||
# use on view
|
||||
statement ok
|
||||
CREATE VIEW v1 AS SELECT 42
|
||||
|
||||
statement error
|
||||
PRAGMA storage_info('v1')
|
||||
----
|
||||
|
||||
# non-existent table
|
||||
statement error
|
||||
PRAGMA storage_info('bla')
|
||||
----
|
||||
|
||||
# different types
|
||||
statement ok
|
||||
CREATE TABLE different_types(i INTEGER, j VARCHAR, k STRUCT(k INTEGER, l VARCHAR))
|
||||
|
||||
statement ok
|
||||
INSERT INTO different_types VALUES (1, 'hello', {'k': 3, 'l': 'hello'}), (2, 'world', {'k': 3, 'l': 'thisisaverylongstring'})
|
||||
|
||||
statement ok
|
||||
PRAGMA storage_info('different_types')
|
||||
|
||||
# nested lists
|
||||
statement ok
|
||||
CREATE TABLE nested_lists AS SELECT
|
||||
[1, 2, 3] i,
|
||||
[['hello', 'world'], [NULL]] j,
|
||||
[{'a': 3}, {'a': 4}] k;
|
||||
|
||||
statement ok
|
||||
PRAGMA storage_info('nested_lists')
|
||||
111
external/duckdb/test/sql/pragma/test_table_info.test
vendored
Normal file
111
external/duckdb/test/sql/pragma/test_table_info.test
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
# name: test/sql/pragma/test_table_info.test
|
||||
# description: Test table_info pragma
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers(i INTEGER DEFAULT 1+3, j INTEGER)
|
||||
|
||||
# PRAGMA table_info(table) returns information on the table
|
||||
query ITTTTT nosort table_info
|
||||
PRAGMA table_info('integers');
|
||||
----
|
||||
0 i INTEGER 0 1 + 3 0
|
||||
1 j INTEGER 0 NULL 0
|
||||
|
||||
# these are all equivalent
|
||||
query ITTTTT nosort table_info
|
||||
PRAGMA table_info(integers);
|
||||
----
|
||||
|
||||
query ITTTTT nosort table_info
|
||||
PRAGMA table_info='integers';
|
||||
----
|
||||
|
||||
query ITTTTT nosort table_info
|
||||
PRAGMA table_info=integers;
|
||||
----
|
||||
|
||||
# table_info on view also works
|
||||
statement ok
|
||||
CREATE VIEW v1 AS SELECT 42::INTEGER AS a, 'hello' AS b
|
||||
|
||||
query ITTTTT
|
||||
PRAGMA table_info('v1')
|
||||
----
|
||||
0 a INTEGER 0 NULL 0
|
||||
1 b VARCHAR 0 NULL 0
|
||||
|
||||
# view with explicit aliases
|
||||
statement ok
|
||||
CREATE VIEW v2(c) AS SELECT 42::INTEGER AS a, 'hello' AS b
|
||||
|
||||
query ITTTTT
|
||||
PRAGMA table_info('v2')
|
||||
----
|
||||
0 c INTEGER 0 NULL 0
|
||||
1 b VARCHAR 0 NULL 0
|
||||
|
||||
statement ok
|
||||
CREATE VIEW v3(c, d) AS SELECT DATE '1992-01-01', 'hello' AS b
|
||||
|
||||
query ITTTTT
|
||||
PRAGMA table_info('v3')
|
||||
----
|
||||
0 c DATE 0 NULL 0
|
||||
1 d VARCHAR 0 NULL 0
|
||||
|
||||
# test table info with other schemas
|
||||
statement ok
|
||||
CREATE SCHEMA test
|
||||
|
||||
statement ok
|
||||
CREATE VIEW test.v1 AS SELECT 42::INTEGER AS a, 'hello' AS b
|
||||
|
||||
query ITTTTT
|
||||
PRAGMA table_info('test.v1')
|
||||
----
|
||||
0 a INTEGER 0 NULL 0
|
||||
1 b VARCHAR 0 NULL 0
|
||||
|
||||
statement error
|
||||
PRAGMA table_info('nonexistant_table');
|
||||
----
|
||||
|
||||
# handle constraints + default values
|
||||
statement ok
|
||||
create table tconstraint1(i integer primary key default(3), j blob not null);
|
||||
|
||||
query ITTTTT
|
||||
PRAGMA table_info(tconstraint1)
|
||||
----
|
||||
0 i INTEGER 1 3 1
|
||||
1 j BLOB 1 NULL 0
|
||||
|
||||
# multi-column pk
|
||||
statement ok
|
||||
create table tconstraint2(i integer, j integer, k integer, l integer unique, primary key(i, j, k));
|
||||
|
||||
query ITTTTT
|
||||
PRAGMA table_info(tconstraint2)
|
||||
----
|
||||
0 i INTEGER 1 NULL 1
|
||||
1 j INTEGER 1 NULL 1
|
||||
2 k INTEGER 1 NULL 1
|
||||
3 l INTEGER 0 NULL 0
|
||||
|
||||
# incorrect number of parameters
|
||||
statement error
|
||||
PRAGMA table_info(1,2,3);
|
||||
----
|
||||
|
||||
statement ok
|
||||
create table t1 (
|
||||
c1 int,
|
||||
c2 int generated always as (c1 + 1)
|
||||
);
|
||||
|
||||
query IIIIII
|
||||
SELECT * FROM pragma_table_info(t1);
|
||||
----
|
||||
0 c1 INTEGER false NULL false
|
||||
1 c2 INTEGER false CAST((c1 + 1) AS INTEGER) false
|
||||
22
external/duckdb/test/sql/pragma/test_table_info_many_columns.test_slow
vendored
Normal file
22
external/duckdb/test/sql/pragma/test_table_info_many_columns.test_slow
vendored
Normal file
File diff suppressed because one or more lines are too long
43
external/duckdb/test/sql/pragma/test_various_pragmas.test
vendored
Normal file
43
external/duckdb/test/sql/pragma/test_various_pragmas.test
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# name: test/sql/pragma/test_various_pragmas.test
|
||||
# description: Test various PRAGMA functions
|
||||
# group: [pragma]
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA verify_parallelism
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_verify_parallelism
|
||||
|
||||
statement ok
|
||||
PRAGMA explain_output='all'
|
||||
|
||||
statement error
|
||||
PRAGMA explain_output='unknown'
|
||||
----
|
||||
<REGEX>:.*Not implemented Error.*unrecognized value.*
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_progress_bar
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_progress_bar
|
||||
|
||||
statement ok
|
||||
PRAGMA enable_print_progress_bar
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_print_progress_bar
|
||||
|
||||
statement ok
|
||||
PRAGMA debug_checkpoint_abort='none'
|
||||
|
||||
statement error
|
||||
PRAGMA debug_checkpoint_abort='unknown'
|
||||
----
|
||||
<REGEX>:.*Not implemented Error.*unrecognized value.*
|
||||
Reference in New Issue
Block a user