0

我正在为 openproject 使用 postgresql 数据库。我在前端网页中添加了两个自定义列,即。实际开始日期和实际结束日期。我需要记录项目实际日期的开始和结束。我不知道这两个列都创建了哪个表并存储了记录。我的数据库有 110 个表,我很难逐个搜索每个表。能否请您帮忙并给我一个查询以找到这两列。提前致谢。

4

1 回答 1

0

这为您提供了模式名称以及特定列的表名称。

select t.table_schema,
       t.table_name,
       c.column_name 
from information_schema.tables t
inner join information_schema.columns c on c.table_name = t.table_name 
                                and c.table_schema = t.table_schema
where c.column_name = 'column_name'
      and t.table_schema not in ('information_schema', 'pg_catalog')
      and t.table_type = 'BASE TABLE'
order by t.table_schema;

显然,“column_name”是您必须为列传递的名称。

于 2020-02-12T10:28:57.017 回答