github.com/matrixorigin/matrixone@v1.2.0/test/distributed/cases/query_result/query_result_cloud.sql (about)

     1  set global save_query_result = on;
     2  drop table if exists tt;
     3  create table tt (a int);
     4  insert into tt values(1), (2);
     5  /* cloud_user */select * from tt;
     6  select * from result_scan(last_query_id()) as u;
     7  /* cloud_user */select * from tt;
     8  select count(*) from meta_scan(last_query_id()) as u;
     9  set global save_query_result = off;
    10  
    11  select * from tt;
    12  -- @bvt:issue#9886
    13  select * from result_scan(last_query_id()) as u;
    14  -- @bvt:issue
    15  set global save_query_result = on;
    16  drop table if exists t2;
    17  create table t2 (a int, b int, c int);
    18  insert into t2 values(1, 2, 3), (1, 2, 3);
    19  /* cloud_user */select c from tt, t2 where tt.a = t2.a;
    20  select * from result_scan(last_query_id()) as u;
    21  /* cloud_user */select c from tt, t2 where tt.a = t2.a;
    22  /* cloud_user */select t2.b from result_scan(last_query_id()) as u, t2 where u.c = t2.c;
    23  select * from result_scan(last_query_id()) as u;
    24  /* cloud_user */select c from tt, t2 where tt.a = t2.a;
    25  select * from result_scan(last_query_id()) as u, result_scan(last_query_id()) as v limit 1;
    26  set global save_query_result = off;
    27  
    28  set global save_query_result = on;
    29  /* cloud_user */select tt.a from tt, t2;
    30  select tables from meta_scan(last_query_id()) as u;
    31  set global query_result_maxsize = 0;
    32  /* cloud_user */select tt.a from tt, t2;
    33  select char_length(result_path) from meta_scan(last_query_id()) as u;
    34  /* cloud_user */select tt.a from tt, t2;
    35  select result_size = 0 from meta_scan(last_query_id()) as u;
    36  set global save_query_result = off;
    37  
    38  set global save_query_result = on;
    39  set global query_result_maxsize = 100;
    40  create role rrrqqq;
    41  grant rrrqqq to dump;
    42  /* cloud_user */select * from tt;
    43  set role rrrqqq;
    44  select * from meta_scan(last_query_id(-2)) as u;
    45  set role moadmin;
    46  create database db111;
    47  create table db111.tt1 (a int);
    48  insert into db111.tt1 values(1), (2);
    49  create table db111.tt2 (a int);
    50  insert into db111.tt2 values(1), (2);
    51  grant select on table db111.tt1 to rrrqqq;
    52  /* cloud_user */select * from db111.tt1;
    53  /* cloud_user */select * from db111.tt2;
    54  set role rrrqqq;
    55  select * from result_scan(last_query_id(-3)) as u;
    56  select * from meta_scan(last_query_id(-3)) as u;
    57  set role moadmin;
    58  drop role rrrqqq;
    59  select * from result_scan('d8fb97e7-e30e-11ed-8d80-d6aeb943c8b4') as u;
    60  --need to clean database db111
    61  drop database if exists db111;
    62  set global save_query_result = off;
    63  
    64  create account abc ADMIN_NAME 'admin' IDENTIFIED BY '123456';
    65  -- @session:id=2&user=abc:admin&password=123456
    66  set global save_query_result = on;
    67  create database test;
    68  /* cloud_user */show databases;
    69  select * from result_scan(last_query_id()) as u;
    70  use test;
    71  drop table if exists tt;
    72  create table tt (a int);
    73  insert into tt values(1), (2);
    74  /* cloud_user */select * from tt;
    75  select * from result_scan(last_query_id()) as u;
    76  /* cloud_user */select * from tt;
    77  select count(*) from meta_scan(last_query_id()) as u;
    78  /* cloud_user */show tables;
    79  select * from result_scan(last_query_id()) as u;
    80  -- @bvt:issue#12083
    81  /* cloud_user */show variables like 'tx_isolation';
    82  select * from result_scan(last_query_id()) as u;
    83  -- @bvt:issue
    84  /* cloud_user */show columns from tt;
    85  select * from result_scan(last_query_id()) as u;
    86  /* cloud_user */show grants;
    87  select * from result_scan(last_query_id()) as u;
    88  /* cloud_user */show create table tt;
    89  select * from result_scan(last_query_id()) as u;
    90  alter table tt add unique index id(a);
    91  /* cloud_user */show index from tt;
    92  select * from result_scan(last_query_id()) as u;
    93  -- @bvt:issue#12083
    94  /* cloud_user */show node list;
    95  select * from result_scan(last_query_id()) as u;
    96  -- @bvt:issue
    97  create sequence seq_an_03  increment 10 start with 1 no cycle;
    98  /* cloud_user */show sequences;
    99  select * from result_scan(last_query_id()) as u;
   100  CREATE TABLE t1 (S1 INT);
   101  CREATE TABLE t2 (S1 INT);
   102  INSERT INTO t1 VALUES (1),(3),(4),(6);
   103  INSERT INTO t2 VALUES (2),(4),(5);
   104  /* cloud_user */SELECT * FROM t1 JOIN t2 on t1.S1=t2.S1;
   105  select * from result_scan(last_query_id()) as u;
   106  /* cloud_user */select t2.S1 from t2 left join t1 on t1.S1 =t2.S1;
   107  select * from result_scan(last_query_id()) as u;
   108  /* cloud_user */select t2.S1 from t2 right join t1 on t1.S1 =t2.S1;
   109  select * from result_scan(last_query_id()) as u;
   110  /* cloud_user */(select s1 from t1 union select s1 from t2) order by s1 desc;
   111  select * from result_scan(last_query_id()) as u;
   112  /* cloud_user */(select s1 from t1 union all select s1 from t2) order by s1 desc;
   113  select * from result_scan(last_query_id()) as u;
   114  /* cloud_user */select * from t1 where t1.s1 > (select t2.s1 from t2 where s1<3);
   115  select * from result_scan(last_query_id()) as u;
   116  /* cloud_user */select * from t1 where s1 <> any (select s1 from t2);
   117  select * from result_scan(last_query_id()) as u;
   118  /* cloud_user */select * from t1 where s1 = some (select s1 from t2);
   119  select * from result_scan(last_query_id()) as u;
   120  --/* cloud_user */explain select * from t1;
   121  --select * from result_scan(last_query_id()) as u;
   122  --/* cloud_user */explain select * from t1 where t1.s1 > (select t2.s1 from t2 where s1<3);
   123  --select * from result_scan(last_query_id()) as u;
   124  drop table if exists time_window01;
   125  create table time_window01 (ts timestamp primary key, col2 int);
   126  insert into time_window01 values ('2021-01-12 00:00:00.000', 12);
   127  insert into time_window01 values ('2020-01-12 12:00:12.000', 24);
   128  insert into time_window01 values ('2021-01-12 01:00:00.000', 34);
   129  insert into time_window01 values ('2020-01-12 12:01:12.000', 20);
   130  select * from time_window01;
   131  /* cloud_user */select _wstart, _wend, max(col2), min(col2) from time_window01 where ts > '2020-01-11 12:00:12.000' and ts < '2021-01-13 00:00:00.000' interval(ts, 100, day) fill(prev);
   132  select * from result_scan(last_query_id()) as u;
   133  create view v1 as SELECT 1 IN (SELECT 1);
   134  /* cloud_user */select * from v1;
   135  select * from result_scan(last_query_id()) as u;
   136  drop table time_window01;
   137  set global save_query_result = off;
   138  -- @session
   139  drop account abc;
   140  
   141  create account abc ADMIN_NAME 'admin' IDENTIFIED BY '123456';
   142  -- @session:id=3&user=abc:admin&password=123456
   143  set global save_query_result = off;
   144  create database test;
   145  /* cloud_user */show databases;
   146  select * from result_scan(last_query_id()) as u;
   147  use test;
   148  drop table if exists tt;
   149  create table tt (a int);
   150  insert into tt values(1), (2);
   151  /* cloud_user */select * from tt;
   152  select * from result_scan(last_query_id()) as u;
   153  /* cloud_user */select * from tt;
   154  select count(*) from meta_scan(last_query_id()) as u;
   155  /* cloud_user */show tables;
   156  select * from result_scan(last_query_id()) as u;
   157  /* cloud_user */show variables like 'tx_isolation';
   158  select * from result_scan(last_query_id()) as u;
   159  /* cloud_user */show columns from tt;
   160  select * from result_scan(last_query_id()) as u;
   161  /* cloud_user */show grants;
   162  select * from result_scan(last_query_id()) as u;
   163  /* cloud_user */show create table tt;
   164  select * from result_scan(last_query_id()) as u;
   165  alter table tt add unique index id(a);
   166  /* cloud_user */show index from tt;
   167  select * from result_scan(last_query_id()) as u;
   168  /* cloud_user */show node list;
   169  select * from result_scan(last_query_id()) as u;
   170  create sequence seq_an_03  increment 10 start with 1 no cycle;
   171  /* cloud_user */show sequences;
   172  select * from result_scan(last_query_id()) as u;
   173  CREATE TABLE t1 (S1 INT);
   174  CREATE TABLE t2 (S1 INT);
   175  INSERT INTO t1 VALUES (1),(3),(4),(6);
   176  INSERT INTO t2 VALUES (2),(4),(5);
   177  /* cloud_user */SELECT * FROM t1 JOIN t2 on t1.S1=t2.S1;
   178  select * from result_scan(last_query_id()) as u;
   179  /* cloud_user */select t2.S1 from t2 left join t1 on t1.S1 =t2.S1;
   180  select * from result_scan(last_query_id()) as u;
   181  /* cloud_user */select t2.S1 from t2 right join t1 on t1.S1 =t2.S1;
   182  select * from result_scan(last_query_id()) as u;
   183  /* cloud_user */(select s1 from t1 union select s1 from t2) order by s1 desc;
   184  select * from result_scan(last_query_id()) as u;
   185  /* cloud_user */(select s1 from t1 union all select s1 from t2) order by s1 desc;
   186  select * from result_scan(last_query_id()) as u;
   187  /* cloud_user */select * from t1 where t1.s1 > (select t2.s1 from t2 where s1<3);
   188  select * from result_scan(last_query_id()) as u;
   189  /* cloud_user */select * from t1 where s1 <> any (select s1 from t2);
   190  select * from result_scan(last_query_id()) as u;
   191  /* cloud_user */select * from t1 where s1 = some (select s1 from t2);
   192  select * from result_scan(last_query_id()) as u;
   193  --/* cloud_user */explain select * from t1;
   194  --select * from result_scan(last_query_id()) as u;
   195  --/* cloud_user */explain select * from t1 where t1.s1 > (select t2.s1 from t2 where s1<3);
   196  --select * from result_scan(last_query_id()) as u;
   197  drop table if exists time_window01;
   198  create table time_window01 (ts timestamp primary key, col2 int);
   199  insert into time_window01 values ('2021-01-12 00:00:00.000', 12);
   200  insert into time_window01 values ('2020-01-12 12:00:12.000', 24);
   201  insert into time_window01 values ('2021-01-12 01:00:00.000', 34);
   202  insert into time_window01 values ('2020-01-12 12:01:12.000', 20);
   203  select * from time_window01;
   204  /* cloud_user */select _wstart, _wend, max(col2), min(col2) from time_window01 where ts > '2020-01-11 12:00:12.000' and ts < '2021-01-13 00:00:00.000' interval(ts, 100, day) fill(prev);
   205  select * from result_scan(last_query_id()) as u;
   206  create view v1 as SELECT 1 IN (SELECT 1);
   207  /* cloud_user */select * from v1;
   208  select * from result_scan(last_query_id()) as u;
   209  drop table time_window01;
   210  -- @session
   211  drop account abc;