- 删除当前模式下的数据表。
teledb=# drop table t; DROP TABLE
- 删除某个模式下数据表。
teledb=# \d+ t Table "public.t" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+---------+-----------+----------+---------+----------+--------------+------------- id | integer | | | | plain | | mc | text | | | | extended | | Distribute By: SHARD(id) Location Nodes: ALL DATANODES teledb=# \d+ t_as Table "public.t_as" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+---------+-----------+----------+---------+----------+--------------+------------- id | integer | | | | plain | | mc | text | | | | extended | | Distribute By: SHARD(id) Location Nodes: ALL DATANODES teledb=# drop table public.test; DROP TABLE
- 删除数据表,当表不存在时不执行该操作,也不会报错。
teledb=# drop table IF EXISTS t; NOTICE: table "t" does not exist, skipping DROP TABLE
- 使用CASCADE无条件删除数据表。
teledb=# create view shardview as select * from test_shard; CREATE VIEW teledb=# drop table test_shard; ERROR: cannot drop table test_shard because other objects depend on it DETAIL: view shardview depends on table test_shard HINT: Use DROP ... CASCADE to drop the dependent objects too. teledb=# drop table test_shard cascade; NOTICE: drop cascades to view shardview DROP TABLE