alter_column.sim 1.2 KB
Newer Older
D
dapan1121 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 100
sql connect

$dbPrefix = m_alt_db
$tbPrefix = m_alt_tb
$mtPrefix = m_alt_mt
$tbNum = 10
$rowNum = 5
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== alter.sim
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i

sql drop database if exists $db
sql create database $db
sql use $db
##### alter table test, simeplest case
sql create table tb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10))
sql insert into tb values (now, 1, "1", "1")
sql alter table tb alter column length c2 20;
if $rows != 0 then
  return -1
endi
sql alter table tb alter column length c3 20;
if $rows != 0 then
  return -1
endi

37 38 39 40 41 42 43 44 45

sql create stable stb (ts timestamp, c1 int, c2 binary(10), c3 nchar(10)) tags(id int)
sql create table tb1 using stb tags(1)
sql insert into tb1 values (now, 1, "1", "1")
sql alter table stb alter column length c2 20;
if $rows != 0 then
  return -1
endi

D
dapan1121 已提交
46 47 48 49
##### ILLEGAL OPERATIONS

# try dropping columns that are defined in metric
sql_error alter table tb alter column length c1 10;
50
sql_error alter table tb1 alter column length c2 10;
D
dapan1121 已提交
51 52 53


system sh/exec.sh -n dnode1 -s stop -x SIGINT