[英]How to check table UNLOGGED with postgresql?
CREATE UNLOGGED TABLE IF NOT EXISTS <tablename>
How can I first check if the desired table is created UNLOGGED
, and if not alter the table accordingly? 如何首先检查是否创建了所需的表
UNLOGGED
,如果没有相应地更改表?
postgres 9.4 postgres 9.4
You can check column relpersistence
of table pg_class
; 您可以检查表
pg_class
列relpersistence
;
postgres=# select relpersistence, relname from pg_class where relname like 'foo%'; ┌────────────────┬─────────┐ │ relpersistence │ relname │ ╞════════════════╪═════════╡ │ p │ foo │ │ p │ foo1 │ │ u │ foo2 │ └────────────────┴─────────┘ (3 rows)
foo2
is unlogged table. foo2
是未记录的表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.