【样例】查询本地pg数据库中pt_dxsl_4413020001_12298这个表的约束条件有哪些?
SELECT
tc.constraint_name, tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name,
tc.is_deferrable,tc.initially_deferred
FROM
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name
WHERE tc.table_name = 'pt_dxsl_4413020001_12298';
上面SQL语句的查询结果.png
编写于 2024-03-11
网友评论