mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 21:32:58 +00:00
fix: ensure Create Or Replace and If Not Exist cannot coexist in create view (#5003)
ensure Create Or Replace and If Not Exist cannot coexist in create view statement
This commit is contained in:
@@ -97,26 +97,23 @@ SELECT * FROM v1;
|
||||
--- if not exists with replace, so it changes ---
|
||||
CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT c FROM t1;
|
||||
|
||||
Affected Rows: 0
|
||||
Error: 1004(InvalidArguments), Invalid SQL, error: syntax error Create Or Replace and If Not Exist cannot be used together
|
||||
|
||||
SHOW CREATE VIEW v1;
|
||||
|
||||
+------+-------------------------------------------------------------+
|
||||
| View | Create View |
|
||||
+------+-------------------------------------------------------------+
|
||||
| v1 | CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT c FROM t1 |
|
||||
+------+-------------------------------------------------------------+
|
||||
+------+------------------------------------------------------------------+
|
||||
| View | Create View |
|
||||
+------+------------------------------------------------------------------+
|
||||
| v1 | CREATE OR REPLACE VIEW v1 AS SELECT a, b, c FROM t1 WHERE a > 43 |
|
||||
+------+------------------------------------------------------------------+
|
||||
|
||||
SELECT * FROM v1;
|
||||
|
||||
+-------------------------+
|
||||
| c |
|
||||
+-------------------------+
|
||||
| 1970-01-01T00:00:00.001 |
|
||||
| 1970-01-01T00:00:00.002 |
|
||||
| 1970-01-01T00:00:00.003 |
|
||||
| 1970-01-01T00:00:00.004 |
|
||||
+-------------------------+
|
||||
+----+------------+-------------------------+
|
||||
| a | b | c |
|
||||
+----+------------+-------------------------+
|
||||
| 44 | greptimedb | 1970-01-01T00:00:00.004 |
|
||||
+----+------------+-------------------------+
|
||||
|
||||
DROP VIEW v1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user