我正在将PostgreSQL数据库用于openproject。 我在前端网页中添加了两个自定义列,即。实际开始日期和实际结束日期。 我需要记录一个项目的实际日期的开始和结束。 我不知道两列都已创建并存储记录在哪个表中。 我的数据库有110个表,这对我来说很难一一搜索每个表。 您能否提供帮助,请给我查询以找到这两列。 预先感谢。
答案 0 :(得分: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”是您必须为列传递的名称。