https://www.postgresql.org/docs/current/catalog-pg-constraint.html 上的檔案說:
外鍵更新動作代碼:a = 無動作,r = 限制,c = 級聯,n = 設定空值,d = 設定默認值
并且根本沒有提到空格。但它實際上使用了很多空格(ASCII 碼 32):
ddevienne=> select '"'||confdeltype||'"', count(*) from pg_constraint group by confdeltype;
?column? | count
---------- -------
"a" | 242
"c" | 941
" " | 2210
"n" | 201
(4 rows)
Time: 3.968 ms
那么這個空間是什么意思呢?為什么它沒有記錄?
我使用的是 PostgreSQL v12,但在這方面 v12 和 v14 的檔案是相同的。
更新(給出已接受的答案):
僅查看外鍵約束 ( contype = 'f') 確實消除了空格。
ddevienne=> select '"'||confdeltype||'"', count(*) from pg_constraint where contype = 'f' group by confdeltype;
?column? | count
---------- -------
"a" | 242
"c" | 941
"n" | 201
(3 rows)
Time: 4.124 ms
ddevienne=> select '"'||confupdtype||'"', count(*) from pg_constraint where contype = 'f' group by confupdtype;
?column? | count
---------- -------
"a" | 1381
"c" | 2
"n" | 1
(3 rows)
Time: 3.361 ms
uj5u.com熱心網友回復:
confdeltypeis NOT NULL,因此對于外鍵約束以外的約束,它被設定為空白。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/348634.html
標籤:PostgreSQL pg-目录
上一篇:從較小的父表中洗掉較慢
下一篇:是否可以在目錄下創建模式?
