mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Bug#28266 IS_UPDATABLE field on VIEWS table in I_S database is wrong
IS_UPDATABLE flag is set to 'yes' when the view has at least one updatable column and the algorithm is not 'temporary'. mysql-test/r/information_schema.result: test result mysql-test/r/view.result: test result mysql-test/t/information_schema.test: test case mysql-test/t/view.test: test case sql/sql_show.cc: IS_UPDATABLE flag is set to 'yes' when the view has at least one updatable column and the algorithm is not 'temporary'.
This commit is contained in:
@ -1315,3 +1315,14 @@ TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1
|
||||
TRIGGERS information_schema.TRIGGERS 1
|
||||
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
|
||||
VIEWS information_schema.VIEWS 1
|
||||
create table t1(f1 int);
|
||||
create view v1 as select f1+1 as a from t1;
|
||||
create table t2 (f1 int, f2 int);
|
||||
create view v2 as select f1+1 as a, f2 as b from t2;
|
||||
select table_name, is_updatable from information_schema.views;
|
||||
table_name is_updatable
|
||||
v1 NO
|
||||
v2 YES
|
||||
delete from v1;
|
||||
drop view v1,v2;
|
||||
drop table t1,t2;
|
||||
|
@ -23,6 +23,9 @@ c
|
||||
5
|
||||
6
|
||||
11
|
||||
select is_updatable from information_schema.views where table_name='v1';
|
||||
is_updatable
|
||||
NO
|
||||
create temporary table t1 (a int, b int);
|
||||
select * from t1;
|
||||
a b
|
||||
@ -322,6 +325,12 @@ create table t1 (a int, b int, primary key(a));
|
||||
insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
|
||||
create view v1 (a,c) as select a, b+1 from t1;
|
||||
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
|
||||
select is_updatable from information_schema.views where table_name='v2';
|
||||
is_updatable
|
||||
NO
|
||||
select is_updatable from information_schema.views where table_name='v1';
|
||||
is_updatable
|
||||
YES
|
||||
update v1 set c=a+c;
|
||||
ERROR HY000: Column 'c' is not updatable
|
||||
update v2 set a=a+c;
|
||||
@ -604,6 +613,10 @@ insert into t1 values(5,'Hello, world of views');
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from v1;
|
||||
update v2 set col2='Hello, view world';
|
||||
select is_updatable from information_schema.views;
|
||||
is_updatable
|
||||
YES
|
||||
YES
|
||||
select * from t1;
|
||||
col1 col2
|
||||
5 Hello, view world
|
||||
|
Reference in New Issue
Block a user