非互換
Fujitsu Enterprise Postgres 16では、pg_stats_extとpg_stats_ext_exprsエントリの可視性をテーブル所有者に制限しました。
準備(スーパーユーザで実施する):
CREATE USER regress_stats_user1; RESET SESSION AUTHORIZATION; CREATE TABLE stats_ext_tbl (id INT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, col TEXT); INSERT INTO stats_ext_tbl (col) VALUES ('secret'), ('secret'), ('very secret'); CREATE STATISTICS s_col ON id, col FROM stats_ext_tbl; CREATE STATISTICS s_expr ON mod(id, 2), lower(col) FROM stats_ext_tbl; ANALYZE stats_ext_tbl;
テーブル所有者でなくても、pg_stats_extとpg_stats_ext_exprsからテーブルの情報を取得できます。
SET SESSION AUTHORIZATION regress_stats_user1; SELECT statistics_name, most_common_vals FROM pg_stats_ext x WHERE tablename = 'stats_ext_tbl' ORDER BY ROW(x.*); statistics_name | most_common_vals -----------------+------------------------------------------- s_col | {{1,secret},{2,secret},{3,"very secret"}} s_expr | {{0,secret},{1,secret},{1,"very secret"}} (2 rows) SELECT statistics_name, most_common_vals FROM pg_stats_ext_exprs x WHERE tablename = 'stats_ext_tbl' ORDER BY ROW(x.*); statistics_name | most_common_vals -----------------+------------------ s_expr | {secret} s_expr | {1} (2 rows)
テーブル所有者でなければ、pg_stats_extとpg_stats_ext_exprsから他のユーザのテーブルの情報を取得できません。
SET SESSION AUTHORIZATION regress_stats_user1; SELECT statistics_name, most_common_vals FROM pg_stats_ext x WHERE tablename = 'stats_ext_tbl' ORDER BY ROW(x.*); statistics_name | most_common_vals -----------------+------------------ (0 rows) SELECT statistics_name, most_common_vals FROM pg_stats_ext_exprs x WHERE tablename = 'stats_ext_tbl' ORDER BY ROW(x.*); statistics_name | most_common_vals -----------------+------------------ (0 rows)
対処方法
ありません。