简体   繁体   English

如何使用postgresql检查表UNLOGGED?

[英]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_classrelpersistence ;

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM