diff --git a/tests/cases/standalone/common/view/view.result b/tests/cases/standalone/common/view/view.result new file mode 100644 index 000000000000..132ec48033b1 --- /dev/null +++ b/tests/cases/standalone/common/view/view.result @@ -0,0 +1,62 @@ +-- From: https://github.com/duckdb/duckdb/blob/main/test/sql/catalog/view/test_view.test -- +CREATE DATABASE schema_for_view_test; + +Affected Rows: 1 + +USE schema_for_view_test; + +Affected Rows: 0 + +CREATE TABLE t1(i TIMESTAMP TIME INDEX); + +Affected Rows: 0 + +INSERT INTO t1 VALUES (41), (42), (43); + +Affected Rows: 3 + +CREATE VIEW v1 AS SELECT + i AS j +FROM t1 WHERE i < 43; + +Affected Rows: 0 + +SELECT * FROM v1; + ++-------------------------+ +| i | ++-------------------------+ +| 1970-01-01T00:00:00.041 | +| 1970-01-01T00:00:00.042 | ++-------------------------+ + +-- CREATE VIEW v1 AS SELECT 'whatever'; -- +SELECT j FROM v1 WHERE j > 41; + +Error: 3000(PlanQuery), Failed to plan SQL: No field named j. Valid fields are v1.i. + +-- FIXME(dennis):: name alias in view, not supported yet -- +--SELECT x FROM v1 t1(x) WHERE x > 41 -- +-- FIXME(dennis): DROP VIEW not supported yet-- +-- DROP VIEW v1 -- +-- SELECT j FROM v1 WHERE j > 41 -- +-- CREATE VIEW v1 AS SELECT 'whatever'; -- +-- SELECT * FROM v1; -- +-- CREATE OR REPLACE VIEW v1 AS SELECT 42; -- +-- SELECT * FROM v1; -- +INSERT INTO v1 VALUES (1); + +Error: 1004(InvalidArguments), Invalid SQL, error: column count mismatch, columns: 0, values: 1 + +CREATE VIEW v1 AS SELECT * FROM dontexist; + +Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Table not found: greptime.schema_for_view_test.dontexist + +USE public; + +Affected Rows: 0 + +DROP DATABASE schema_for_view_test; + +Affected Rows: 0 + diff --git a/tests/cases/standalone/common/view/view.sql b/tests/cases/standalone/common/view/view.sql new file mode 100644 index 000000000000..3ca4cd7a7426 --- /dev/null +++ b/tests/cases/standalone/common/view/view.sql @@ -0,0 +1,45 @@ +-- From: https://github.com/duckdb/duckdb/blob/main/test/sql/catalog/view/test_view.test -- + +CREATE DATABASE schema_for_view_test; + +USE schema_for_view_test; + +CREATE TABLE t1(i TIMESTAMP TIME INDEX); + +INSERT INTO t1 VALUES (41), (42), (43); + +CREATE VIEW v1 AS SELECT + i AS j +FROM t1 WHERE i < 43; + +SELECT * FROM v1; + +-- CREATE VIEW v1 AS SELECT 'whatever'; -- + +SELECT j FROM v1 WHERE j > 41; + + +-- FIXME(dennis):: name alias in view, not supported yet -- +--SELECT x FROM v1 t1(x) WHERE x > 41 -- + +-- FIXME(dennis): DROP VIEW not supported yet-- +-- DROP VIEW v1 -- + +-- SELECT j FROM v1 WHERE j > 41 -- + +-- CREATE VIEW v1 AS SELECT 'whatever'; -- + +-- SELECT * FROM v1; -- + + +-- CREATE OR REPLACE VIEW v1 AS SELECT 42; -- + +-- SELECT * FROM v1; -- + +INSERT INTO v1 VALUES (1); + +CREATE VIEW v1 AS SELECT * FROM dontexist; + +USE public; + +DROP DATABASE schema_for_view_test;