Clear table

clear table — empties the table's data but keeps it registered in the catalog.

Table Place

Clear removes every row but leaves the table in place.

SQL

create table T;

insert into T ({x: 1}, {x: 2}, {x: 3});

clear table T;

select * from T;

Result

[]

New Rows

A cleared table is still resolvable and accepts new rows.

SQL

create table T;

insert into T ({x: 1});

clear table T;

insert into T ({x: 9});

select * from T;

Result

[
  { "x": 9 }
]

Clearing An

Clearing an undeclared table is a static error.

SQL

clear table Ghost;

Expected error: static