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 2000
sql connect

print ===============create three type table
sql create database db
sql use db
sql create table meters(ts timestamp, f binary(8)) tags(loc int, zone binary(8))
sql create table t0 using meters tags(1,'ch')
sql create table normalTbl(ts timestamp, zone binary(8))

sql use db
sql show create table meters 
if $rows != 1 then 
  return -1
endi

print ===============check sub table
sql show create table t0
if $rows != 1 then 
  return -1
endi
if $data00 == 't0' then
  return -1
endi

print ===============check normal table

sql show create table normalTbl 
if $rows != 1 then 
  return -1
endi

if $data00 == 'normalTbl' then
  return -1
endi

print ===============check super table
sql show create table meters 
if $rows != 1 then 
  return -1
endi

if $data00 == 'meters' then
  return -1
endi

print ===============check sub table with prefix

sql show create table db.t0
if $rows != 1 then 
  return -1
endi

if $data00 == 't0' then
  return -1
endi

print ===============check normal table with prefix
sql show create table db.normalTbl 
if $rows != 1 then 
  return -1
endi

if $data00 == 'normalTbl' then
  return -1
endi


print ===============check super table with prefix
sql show create table db.meters 
if $rows != 1 then 
  return -1
endi

if $data00 == 'meters' then
  return -1
endi

sql drop database db

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