Files
greptimedb/tests/cases/standalone/common/view/create.sql
Ning Sun 11cf9c827e feat: dbeaver mysql compatibility, use statement and information_schema.tables (#4218)
* feat: add more placeholder field in information_schema.tables

* feat: make schema modifiable for use statement

* chore: add todo items

* fix: resolve lint issues after data type changes

* chore: update sqlness results

* refactor: patch for select database is no longer needed

* test: align tests and data types

* Apply suggestions from code review

Co-authored-by: dennis zhuang <killme2008@gmail.com>

* fix: use canonicalize_identifier for database name

* feat: add all columns for information_schema.tables

* test: remove vairables from sqlness results

* feat: add to_string impl for table options

---------

Co-authored-by: dennis zhuang <killme2008@gmail.com>
2024-07-03 01:31:13 +00:00

53 lines
1.3 KiB
SQL

--- test CREATE VIEW ---
CREATE DATABASE schema_for_view_test;
USE schema_for_view_test;
CREATE TABLE test_table(a STRING, ts TIMESTAMP TIME INDEX);
CREATE VIEW test_view;
CREATE VIEW test_view as DELETE FROM public.numbers;
--- Table already exists ---
CREATE VIEW test_table as SELECT * FROM public.numbers;
--- Table already exists even when create_if_not_exists ---
CREATE VIEW IF NOT EXISTS test_table as SELECT * FROM public.numbers;
--- Table already exists even when or_replace ---
CREATE OR REPLACE VIEW test_table as SELECT * FROM public.numbers;
CREATE VIEW test_view as SELECT * FROM public.numbers;
--- View already exists ----
CREATE VIEW test_view as SELECT * FROM public.numbers;
CREATE VIEW IF NOT EXISTS test_view as SELECT * FROM public.numbers;
CREATE OR REPLACE VIEW test_view as SELECT * FROM public.numbers;
SHOW TABLES;
SHOW FULL TABLES;
-- SQLNESS REPLACE (\s\d+\s) ID
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
SELECT * FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME, TABLE_TYPE;
-- SQLNESS REPLACE (\s\d+\s) ID
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'VIEW';
SHOW COLUMNS FROM test_view;
SHOW FULL COLUMNS FROM test_view;
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'test_view';
SELECT * FROM test_view LIMIT 10;
USE public;
DROP DATABASE schema_for_view_test;