4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PostgreSQL 12がやってくる!(4) - システムカタログの差分を調べてみる

Posted at

はじめに

今回は、PostgreSQL 11とPostgreSQL 12のシステムカタログの差分を調べてみる。
これもまだβ版リリース前なので、今後変わっていく可能性が大きいけど、現時点の版で調査をしてみた。
普段、PostgreSQLを使っているときにはシステムカタログを意識することはそれほどないのだが、システムカタログの変更は、DDL系コマンドの変更にも密接に関連しているので、調べてみるといろいろなことが分かって面白い。

調査方法

PostgreSQL 11.2とPostgreSQL 121それぞれについて、initdbによるデータベースクラスタ生成直後に、postgresデータベースにpsqlでログインして、psqlのメタコマンド

\d pg_catalog.*

を実行し、そのログをdiffで比較した。

テーブル/ビュー単位での変更まとめ

今回の変更では全体に共通した変更が多く入っているので、それらは1つの列にしてまとめてみた。以下、注意点と凡例を示す。

  • 後述するように、\dメタコマンドの仕様変更(隠し属性oidも表示する)による差分はこちらの表にはリストアップしない。
  • 「Collaration変更列あり」というのは、システムカタログ内の列のうち、PostgreSQL 11ではCollaration列が空値になっていたものがCに変更された列があるかどうかを示す。システムカタログによっては複数の列が対象になっていることもある。
  • 「インデックス定義変更あり」というのは、インデックス対象の列の中に、PostgreSQL 11ではオペレータを指定しているものがあったが、PostgreSQL 12ではその指定がなくなった。この変更があったインデックスを含むリレーションの場合は●をつけている。
リレーション名 kind 変更種別 Collaration
変更列あり
インデックス定義
変更あり
その他修正
pg_aggregate 変更
pg_attrdef 変更 addsrc列の削除
pg_attribute 変更 attgenerated列の追加
pg_authid 変更
pg_class 変更 relhasoids列の削除
pg_collation 変更 collisdeterministic列の追加
pg_constraint 変更 consrc列の削除
pg_db_role_setting 変更
pg_default_ac 変更
pg_depend 変更
pg_event_trigger 変更
pg_extension 変更
pg_foreign_data_wrapper 変更
pg_foreign_server 変更
pg_index 変更
pg_partitioned_table 変更
pg_pltemplate 変更
pg_policies 変更
pg_policy 変更
pg_prepared_statements ビュー 変更
pg_proc 変更
pg_replication_origin 変更
pg_rewrite 変更
pg_roles ビュー 変更
pg_rules ビュー 変更
pg_seclabel 変更
pg_seclabels ビュー 変更
pg_shadow ビュー 変更 valuntil列の型変更(abstime→timestamp with time zone)
pg_shdescription 変更
pg_stat_database ビュー 変更 checksum_failures列の追加
pg_stat_gssapi ビュー 追加
pg_stat_progress_cluster ビュー 追加
pg_stat_progress_create_index ビュー 追加
pg_stat_replication ビュー 変更 reply_time列の追加
pg_stat_ssl ビュー 変更 列名の変更(clientdn→client_dn)
client_serial列の追加
issuer_dn列の追加
pg_statistic 変更 stacoll1~stacoll5列の追加
pg_statistic_ext 変更 stxmcv列の追加
pg_subscription 変更
pg_tablespace 変更
pg_trigger 変更
pg_ts_dict 変更
pg_type 変更
pg_user ビュー 変更
pg_user_mapping 変更
pg_user_mappings ビュー 変更

列単位での変更内容

もう少し細かい違いを見てみる。
diffを取ってみると、oid列の差分が表示されるようになったが、これはカタログそのものの違いではなく、psqlの\dメタコマンドが(これまでは隠し属性扱いであった)oidを表示するようになったために出てきた差分であると思われる。

リレーション名 kind 列名 変更種別 内容
pg_aggregate agginitval 変更 Collationの値が空値からCに変更
pg_aggregate aggminitval 変更 Collationの値が空値からCに変更
pg_am oid 追加
pg_amop oid 追加
pg_amproc oid 追加
pg_attrdef oid 追加
pg_attrdef addbin 変更 Collationの値が空値からCに変更, not null制約追加
pg_attrdef addsrc 削除
pg_attribute attgenerated 追加 生成列かどうかを示す情報が追加?
pg_attribute attoptions 変更 Collationの値が空値からCに変更
pg_attribute attfdwoptions 変更 Collationの値が空値からCに変更
pg_authid oid 追加
pg_authid rolpassword 変更 Collationの値が空値からCに変更
pg_global installed_version 変更 Collationの値が空値からCに変更
pg_cast oid 追加
pg_class oid 追加
pg_class relhasoids 削除
pg_class reloptions 変更 Collationの値が空値からCに変更
pg_class relpartbound 変更 Collationの値が空値からCに変更
pg_collation oid 追加
pg_collation collisdeterministic 追加 この変更は何の改造によるもの?
pg_collation collversion 変更 ollationの値が空値からCに変更
pg_constraint oid 追加
pg_constraint conbin 変更 Collationの値が空値からCに変更
pg_constraint consrc 削除
pg_conversion oid 追加
pg_database oid 追加
pg_db_role_setting setconfig 変更 Collationの値が空値からCに変更
pg_default_ac oid 追加
pg_default_ac aclitem 変更 not null制約の追加
pg_depend description 変更 Collationの値が空値からCに変更
pg_enum oid 追加
pg_event_trigger oid 追加
pg_event_trigger evttags 変更 Collationの値が空値からCに変更
pg_extension oid 追加
pg_extension extversion 変更 Collationの値が空値からCに変更
pg_extension extcondition 変更 Collationの値が空値からCに変更
pg_foreign_data_wrapper oid 追加
pg_foreign_data_wrapper fdwoptions 変更 Collationの値が空値からCに変更
pg_foreign_server oid 追加
pg_foreign_server srvtype 変更 Collationの値が空値からCに変更
pg_foreign_server srvversion 変更 Collationの値が空値からCに変更
pg_foreign_server srvoptions 変更 Collationの値が空値からCに変更
pg_foreign_table ftoptions 変更 Collationの値が空値からCに変更
pg_index indexprs 変更 Collationの値が空値からCに変更
pg_index indpred 変更 Collationの値が空値からCに変更
pg_language oid 追加
pg_largeobject_metadata oid 追加
pg_namespace oid 追加
pg_opclass oid 追加
pg_operator oid 追加
pg_opfamily oid 追加
pg_partitioned_table partexprs 変更 Collationの値が空値からCに変更
pg_pltemplate tmplhandler 変更 Collationの値が空値からCに変更
pg_pltemplate tmplinline 変更 Collationの値が空値からCに変更
pg_pltemplate tmplvalidator 変更 Collationの値が空値からCに変更
pg_pltemplate tmpllibrary 変更 Collationの値が空値からCに変更
pg_policies qual 変更 Collationの値が空値からCに変更
pg_policies with_check 変更 Collationの値が空値からCに変更
pg_policy oid 追加
pg_policy polroles 変更 Collationの値が空値からCに変更
pg_policy polqual 変更 Collationの値が空値からCに変更
pg_policy polwithcheck 変更 Collationの値が空値からCに変更
pg_prepared_statements ビュー protransform 削除
pg_prepared_statements ビュー prosupport 追加
pg_proc oid 追加
pg_proc proargnames 変更 Collationの値が空値からCに変更
pg_proc proargdefaults 変更 Collationの値が空値からCに変更
pg_proc prosrc 変更 Collationの値が空値からCに変更
pg_proc probin 変更 Collationの値が空値からCに変更
pg_proc proconfig 変更 Collationの値が空値からCに変更
pg_publication oid 追加
pg_publication_rel oid 追加
pg_replication_origin roname 変更 Collationの値が空値からCに変更
pg_replication_origin pg_replication_origin_roname_index 変更 インデックス定義時のtext_pattern_ops指定がなくなった
pg_rewrite oid 追加
pg_rewrite ev_qual 変更 Collationの値が空値からCに変更, not null制約追加
pg_rewrite ev_action 変更 Collationの値が空値からCに変更, not null制約追加
pg_roles ビュー rolconfig 変更 Collationの値が空値からCに変更
pg_rules ビュー provider 変更 Collationの値が空値からCに変更
pg_rules ビュー label 変更 Collationの値が空値からCに変更
pg_seclabel pg_seclabel_object_index 変更 インデックス定義時のtext_pattern_ops指定がなくなった
pg_seclabels ビュー objname 変更 Collationの値が空値からCに変更
pg_seclabels ビュー provider 変更 Collationの値が空値からCに変更
pg_seclabels ビュー label 変更 Collationの値が空値からCに変更
pg_shadow ビュー passwd 変更 Collationの値が空値からCに変更
pg_shadow ビュー valuntil 変更 型がabstimeからtimestamp with time zoneに変更
pg_shadow ビュー useconfig 変更 Collationの値が空値からCに変更
pg_shdescription description 変更 Collationの値が空値からCに変更
pg_shdescription provider 変更 Collationの値が空値からCに変更
pg_shdescription label 変更 Collationの値が空値からCに変更
pg_shdescription "pg_shseclabel_object_index" 変更 インデックス定義時のtext_pattern_ops指定がなくなった
pg_stat_database ビュー checksum_failures 追加
pg_stat_gssapi ビュー pid 追加
pg_stat_gssapi ビュー gss_authenticated 追加
pg_stat_gssapi ビュー principal 追加
pg_stat_gssapi ビュー encrypted 追加
pg_stat_progress_cluster ビュー pid 追加
pg_stat_progress_cluster ビュー datid 追加
pg_stat_progress_cluster ビュー datname 追加
pg_stat_progress_cluster ビュー relid 追加
pg_stat_progress_cluster ビュー command 追加
pg_stat_progress_cluster ビュー phase 追加
pg_stat_progress_cluster ビュー cluster_index_relid 追加
pg_stat_progress_cluster ビュー heap_tuples_scanned 追加
pg_stat_progress_cluster ビュー heap_tuples_written 追加
pg_stat_progress_cluster ビュー heap_blks_total 追加
pg_stat_progress_cluster ビュー heap_blks_scanned 追加
pg_stat_progress_cluster ビュー index_rebuild_count 追加
pg_stat_progress_create_index ビュー pid 追加
pg_stat_progress_create_index ビュー datid 追加
pg_stat_progress_create_index ビュー datname 追加
pg_stat_progress_create_index ビュー relid 追加
pg_stat_progress_create_index ビュー phase 追加
pg_stat_progress_create_index ビュー lockers_total 追加
pg_stat_progress_create_index ビュー lockers_done 追加
pg_stat_progress_create_index ビュー current_locker_pid 追加
pg_stat_progress_create_index ビュー blocks_total 追加
pg_stat_progress_create_index ビュー blocks_done 追加
pg_stat_progress_create_index ビュー tuples_total 追加
pg_stat_progress_create_index ビュー tuples_done 追加
pg_stat_progress_create_index ビュー partitions_total 追加
pg_stat_progress_create_index ビュー partitions_done 追加
pg_stat_replication ビュー reply_time 追加
pg_stat_ssl ビュー client_dn 変更 カラム名の変更(clientdn→client_dn)
pg_stat_ssl ビュー client_serial 追加
pg_stat_ssl ビュー issuer_dn 追加
pg_statistic stacoll1 追加
pg_statistic stacoll2 追加
pg_statistic stacoll3 追加
pg_statistic stacoll4 追加
pg_statistic stacoll5 追加
pg_statistic_ext oid 追加
pg_statistic_ext stxndistinct 変更 Collationの値が空値からCに変更
pg_statistic_ext stxdependencies 変更 Collationの値が空値からCに変更
pg_statistic_ext stxmcv 追加
pg_subscription oid 追加
pg_subscription subconninfo 変更 Collationの値が空値からCに変更
pg_subscription subsynccommit 変更 Collationの値が空値からCに変更
pg_subscription subpublications 変更 Collationの値が空値からCに変更
pg_tablespace oid 追加
pg_tablespace spcoptions 変更 Collationの値が空値からCに変更
pg_transform oid 追加
pg_trigger oid 追加
pg_trigger tgqual 変更 Collationの値が空値からCに変更
pg_ts_config oid 追加
pg_ts_dict oid 追加
pg_ts_dict dictinitoption 変更 Collationの値が空値からCに変更
pg_ts_parser oid 追加
pg_ts_template oid 追加
pg_type oid 追加
pg_type typdefaultbin 変更 Collationの値が空値からCに変更
pg_type typdefault 変更 Collationの値が空値からCに変更
pg_user ビュー valuntil 変更 Collationの値が空値からCに変更
pg_user ビュー useconfig 変更 Collationの値が空値からCに変更
pg_user_mapping oid 追加
pg_user_mapping umoptions 変更 Collationの値が空値からCに変更
pg_user_mappings ビュー umoptions 変更 Collationの値が空値からCに変更

おわりに

今回は、やたらとシステムカタログの差分が多くなってしまったが、実効的な差分の量は意外と少ない。
今後、新たな機能がcommitされれば差分もまた増えていくと思うので、これも今後開発フェーズが進んだら、また再調査しておきたい。

  1. 今回調査対象としたのは、4/7時点の版(commit 9e360f0e8327bcf4b7c5ce957024fdff8f95f7de)。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?