system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

sql create database if not exists test
sql use test
sql create table t1 (ts timestamp, c2 int)
sql insert into t1 values(now, 1)

sql delete from t1 where ts is null
sql delete from t1 where ts < now
sql select ts from t1 order by ts asc

print ----------rows:  $rows
if $rows != 0 then
  return -1
endi

sql select ts from t1 order by ts desc
print ----------rows:  $rows
if $rows != 0 then
  return -1
endi

