Files
greptimedb/tests/cases/standalone/common/view/view.sql
dennis zhuang 24612f62dd feat: querying from view works (#3952)
* 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>
2024-05-30 21:45:56 +00:00

46 lines
864 B
SQL

-- 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;