以下にサーバ上からの実行例を示します。
データベースpostgresへの接続
psqlコマンドを使用して、データベースpostgresに接続します。
サーバのIPアドレスが“192.0.2.0”、ポート番号が“26500”の場合の例を示します。
psql -d postgres -h 192.0.2.0 -p 26500 psql (9.2.8) Type "help" for help.
秘匿化ポリシーの無効化
秘匿化ポリシーを無効にするために、pgxa_enable_confidential_policyシステム関数を実行します。
postgres=# select pgxa_enable_confidential_policy(table_name := 't1', policy_name := 'p1', enable := 'f'); pgxa_enable_confidential_policy --------------------------------- t (1 行)
表示されるデータの確認
秘匿化ポリシーの無効化により元データが表示されていることを確認します。
postgres=# select * from t1; c1 | c2 ----+--------------- 1 | 012-3456-7890 2 | 012-3456-7891 3 | 012-3456-7892 (3 行)
秘匿化ポリシーの有効化
秘匿化ポリシーを有効にするために、pgxa_enable_confidential_policyシステム関数を実行します。
postgres=# select pgxa_enable_confidential_policy(table_name := 't1', policy_name := 'p1', enable := 't'); pgxa_enable_confidential_policy --------------------------------- t (1 行)
表示されるデータの確認
秘匿化ポリシーの有効化により秘匿化対象のデータが正しく改訂されていることを確認します。
postgres=# select * from t1; c1 | c2 ----+--------------- 0 | 012-****-**** 0 | 012-****-**** 0 | 012-****-**** (3 行)
データベースpostgresとの切断
psqlコマンドを終了するために、“\q”を実行します。
postgres=# \q
参照
pgxa_enable_confidential_policyシステム関数の詳細は、“I.4.15 pgxa_enable_confidential_policy”を参照してください。
psqlコマンドの詳細は、“PostgreSQL 9.2.4文書”の“psql”を参照してください。