2016-11-16 12 views
0

我想在終端中使用psql來查找數據庫中的所有可空列。如果我使用在postgresql表中列出所有非空限制

select * from information_schema.check_constraints; 

我得到的信息,如以下

constraint_catalog | constraint_schema |  constraint_name  |           check_clause           
--------------------+--------------------+------------------------------+---------------------------------------------------------------------------------------------- 
foo    | public    | 12345_67890_1_not_null  | bar IS NOT NULL 

不幸的是,列bar出現在許多表。我可以通過簡單的方式獲得像這樣列出列名和表名的所有public約束列表嗎?

回答

0

您可能只想從columns視圖中檢查is_nullable

相關問題