-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: adds more sqlness test for view
- Loading branch information
1 parent
55b1545
commit 2669c3f
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |