mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-25 09:20:40 +00:00
* feat: querying from view works * feat: use MemoryCatalogProviderList instead of DummyCatalogList * refactor: revert src/query/src/dummy_catalog.rs * chore: clean code * fix: make clippy happy * fix: toml format * fix: sqlness * fix: forgot files * fix: make sqlness happy * test: table source, serializer and decoder * fix: fail to decode plan because of invalid table names * test: adds more sqlness test for view * chore: remove unused errors * fix: comments * fix: typo * fix: invalidate view info cache after creating view successfully * chore: apply suggestion Co-authored-by: Ruihang Xia <waynestxia@gmail.com> * chore: apply suggestion Co-authored-by: Ruihang Xia <waynestxia@gmail.com> * fix: compile error after rebeasing * chore: style Co-authored-by: Ruihang Xia <waynestxia@gmail.com> * fix: don't export table_name in common-meta * chore: change ViewInfo::new signature * docs: leave a TODO for optimize param --------- Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
63 lines
1.4 KiB
Plaintext
63 lines
1.4 KiB
Plaintext
-- 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
|
|
|