vitess.io/vitess@v0.16.2/go/vt/vtgate/planbuilder/testdata/view_cases.json (about) 1 [ 2 { 3 "comment": "Alter View", 4 "query": "alter view user.user_extra as select * from user.user", 5 "plan": { 6 "QueryType": "DDL", 7 "Original": "alter view user.user_extra as select * from user.user", 8 "Instructions": { 9 "OperatorType": "DDL", 10 "Keyspace": { 11 "Name": "user", 12 "Sharded": true 13 }, 14 "Query": "alter view user_extra as select * from `user`.`user`" 15 }, 16 "TablesUsed": [ 17 "user.user_extra" 18 ] 19 } 20 }, 21 { 22 "comment": "create view with different keyspaces", 23 "query": "create view user.view_a as (select id from unsharded union select id from unsharded_auto) union (select id from unsharded_auto union select name from unsharded)", 24 "plan": "VT12001: unsupported: Select query does not belong to the same keyspace as the view statement" 25 }, 26 { 27 "comment": "create view with authoritative columns", 28 "query": "create view user.view_ac as select * from authoritative", 29 "v3-plan": { 30 "QueryType": "DDL", 31 "Original": "create view user.view_ac as select * from authoritative", 32 "Instructions": { 33 "OperatorType": "DDL", 34 "Keyspace": { 35 "Name": "user", 36 "Sharded": true 37 }, 38 "Query": "create view view_ac as select * from authoritative" 39 }, 40 "TablesUsed": [ 41 "user.view_ac" 42 ] 43 }, 44 "gen4-plan": { 45 "QueryType": "DDL", 46 "Original": "create view user.view_ac as select * from authoritative", 47 "Instructions": { 48 "OperatorType": "DDL", 49 "Keyspace": { 50 "Name": "user", 51 "Sharded": true 52 }, 53 "Query": "create view view_ac as select user_id, col1, col2 from authoritative" 54 }, 55 "TablesUsed": [ 56 "user.view_ac" 57 ] 58 } 59 }, 60 { 61 "comment": "Drop view", 62 "query": "drop view main.a", 63 "plan": { 64 "QueryType": "DDL", 65 "Original": "drop view main.a", 66 "Instructions": { 67 "OperatorType": "DDL", 68 "Keyspace": { 69 "Name": "main", 70 "Sharded": false 71 }, 72 "Query": "drop view main.a" 73 }, 74 "TablesUsed": [ 75 "main.a" 76 ] 77 } 78 }, 79 { 80 "comment": "Drop multiple view", 81 "query": "drop view main.a, main.b, main.c", 82 "plan": { 83 "QueryType": "DDL", 84 "Original": "drop view main.a, main.b, main.c", 85 "Instructions": { 86 "OperatorType": "DDL", 87 "Keyspace": { 88 "Name": "main", 89 "Sharded": false 90 }, 91 "Query": "drop view main.a, main.b, main.c" 92 }, 93 "TablesUsed": [ 94 "main.a", 95 "main.b", 96 "main.c" 97 ] 98 } 99 }, 100 { 101 "comment": "Drop mixed keyspace view", 102 "query": "drop view main.a, user.b", 103 "plan": "VT12001: unsupported: cannot drop views from multiple keyspace in a single statement" 104 }, 105 { 106 "comment": "Drop same views", 107 "query": "drop view main.a, main.b, main.a", 108 "plan": "VT03013: not unique table/alias: 'a'" 109 } 110 ]