如何避免在删除 temp table 时删除 static table
How to avoid dropping static table when dropping temp table
在 postgres 中,当我尝试删除临时 table 时如何避免意外删除静态 table。
如果 temp table foo 不存在,下面的查询将在默认架构上删除 table foo。
DROP TABLE IF EXISTS foo;
CREATE TEMP TABLE foo AS
Temp table 是在 pg_temp
架构中隐式创建的。您可以在删除 table 时指定该架构:
drop table if exists pg_temp.foo;
create temp table foo;
在 postgres 中,当我尝试删除临时 table 时如何避免意外删除静态 table。 如果 temp table foo 不存在,下面的查询将在默认架构上删除 table foo。
DROP TABLE IF EXISTS foo;
CREATE TEMP TABLE foo AS
Temp table 是在 pg_temp
架构中隐式创建的。您可以在删除 table 时指定该架构:
drop table if exists pg_temp.foo;
create temp table foo;