找出Postgresql 中Primary key的欄位

  • 1709
  • 0

摘要:找出Postgresql 中Primary key的欄位

 


select c.* 
from information_schema.constraint_column_usage as c, information_schema.table_constraints as t 
where c.constraint_name = t.constraint_name and t.constraint_type = 'PRIMARY KEY';