【发布时间】:2020-10-18 08:27:39
【问题描述】:
我在 Postgres 9.4 中运行它来获取特定模式中每个表的行数:
select table_schema, table_name,
(xpath('/row/count/text()', query_to_xml('select count(*) from '||format('%I.%I', table_schema, table_name), true, true, '')))[1]::text::int as row_count
from information_schema.tables
where table_schema = 'pricing'
它在 Postgres 9.4 中有效,但在 Postgres 8.4 中我收到一条错误消息,提示格式函数不存在,postgres 8.4 中是否有类似的函数?
在 postgres 8.4 中我得到了这个:
函数格式(未知,information_schema.sql_identifier, information_schema.sql_identifier) 不存在
谢谢!
【问题讨论】:
标签: postgresql function schema rowcount