pingcap/tidb

ALTER VIEW not supported

Open

#9,815 opened on Mar 19, 2019

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Go (6,186 forks)batch import
help wantedtype/compatibility

Repository metrics

Stars
 (40,090 stars)
PR merge metrics
 (Avg merge 14d 4h) (346 merged PRs in 30d)

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
use test;
DROP VIEW IF EXISTS v1;
CREATE VIEW v1 AS SELECT 1;
SELECT * FROM v1;
ALTER VIEW v1 AS SELECT 2;
SELECT * FROM v1;
  1. What did you expect to see?
mysql [localhost:8015] {msandbox} (test) > use test;
Database changed
mysql [localhost:8015] {msandbox} (test) > DROP VIEW IF EXISTS v1;
Query OK, 0 rows affected (0.01 sec)

mysql [localhost:8015] {msandbox} (test) > CREATE VIEW v1 AS SELECT 1;
Query OK, 0 rows affected (0.01 sec)

mysql [localhost:8015] {msandbox} (test) > SELECT * FROM v1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql [localhost:8015] {msandbox} (test) > ALTER VIEW v1 AS SELECT 2;
Query OK, 0 rows affected (0.01 sec)

mysql [localhost:8015] {msandbox} (test) > SELECT * FROM v1;
+---+
| 2 |
+---+
| 2 |
+---+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> use test;
Database changed
mysql> DROP VIEW IF EXISTS v1;
Query OK, 0 rows affected (0.22 sec)

mysql> CREATE VIEW v1 AS SELECT 1;
Query OK, 0 rows affected (0.09 sec)

mysql> SELECT * FROM v1;
+------+
| 1    |
+------+
|    1 |
+------+
1 row in set (0.00 sec)

mysql> ALTER VIEW v1 AS SELECT 2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 10 near "VIEW v1 AS SELECT 2" 
mysql> SELECT * FROM v1;
+------+
| 1    |
+------+
|    1 |
+------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v3.0.0-beta-239-g1ef9dae1a-dirty
Git Commit Hash: 1ef9dae1ac189bf45123639aee005f6608e7ba82
Git Branch: master
UTC Build Time: 2019-03-19 07:39:53
GoVersion: go version go1.12.1 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
1 row in set (0.00 sec)

Contributor guide