1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Add system view pg_ident_file_mappings

This view is similar to pg_hba_file_rules view, except that it is
associated with the parsing of pg_ident.conf.  Similarly to its cousin,
this view is useful to check via SQL if changes planned in pg_ident.conf
would work upon reload or restart, or to diagnose a previous failure.

Bumps catalog version.

Author: Julien Rouhaud
Reviewed-by: Aleksander Alekseev, Michael Paquier
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud
This commit is contained in:
Michael Paquier
2022-03-29 10:15:48 +09:00
parent 091a971bb5
commit a2c84990be
12 changed files with 305 additions and 17 deletions

View File

@@ -9591,6 +9591,11 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<entry>summary of client authentication configuration file contents</entry>
</row>
<row>
<entry><link linkend="view-pg-ident-file-mappings"><structname>pg_ident_file_mappings</structname></link></entry>
<entry>summary of client user name mapping configuration file contents</entry>
</row>
<row>
<entry><link linkend="view-pg-indexes"><structname>pg_indexes</structname></link></entry>
<entry>indexes</entry>
@@ -10589,6 +10594,108 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
</para>
</sect1>
<sect1 id="view-pg-ident-file-mappings">
<title><structname>pg_ident_file_mappings</structname></title>
<indexterm zone="view-pg-ident-file-mappings">
<primary>pg_ident_file_mappings</primary>
</indexterm>
<para>
The view <structname>pg_ident_file_mappings</structname> provides a summary
of the contents of the client user name mapping configuration file,
<link linkend="auth-username-maps"><filename>pg_ident.conf</filename></link>.
A row appears in this view for each non-empty, non-comment line in the file,
with annotations indicating whether the rule could be applied successfully.
</para>
<para>
This view can be helpful for checking whether planned changes in the
authentication configuration file will work, or for diagnosing a previous
failure. Note that this view reports on the <emphasis>current</emphasis>
contents of the file, not on what was last loaded by the server.
</para>
<para>
By default, the <structname>pg_ident_file_mappings</structname> view can be
read only by superusers.
</para>
<table>
<title><structname>pg_ident_file_mappings</structname> Columns</title> <tgroup
cols="1">
<thead>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
Column Type
</para>
<para>
Description
</para></entry>
</row>
</thead>
<tbody>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>line_number</structfield> <type>int4</type>
</para>
<para>
Line number of this rule in <filename>pg_ident.conf</filename>
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>map_name</structfield> <type>text</type>
</para>
<para>
Name of the map
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>sys_name</structfield> <type>text</type>
</para>
<para>
Detected user name of the client
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>pg_username</structfield> <type>text</type>
</para>
<para>
Requested PostgreSQL user name
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>error</structfield> <type>text</type>
</para>
<para>
If not <literal>NULL</literal>, an error message indicating why this
line could not be processed
</para></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Usually, a row reflecting an incorrect entry will have values for only
the <structfield>line_number</structfield> and <structfield>error</structfield> fields.
</para>
<para>
See <xref linkend="client-authentication"/> for more information about
client authentication configuration.
</para>
</sect1>
<sect1 id="view-pg-indexes">
<title><structname>pg_indexes</structname></title>

View File

@@ -896,6 +896,16 @@ mymap /^(.*)@otherdomain\.com$ guest
-HUP</literal>) to make it re-read the file.
</para>
<para>
The system view
<link linkend="view-pg-ident-file-mappings"><structname>pg_ident_file_mappings</structname></link>
can be helpful for pre-testing changes to the
<filename>pg_ident.conf</filename> file, or for diagnosing problems if
loading of the file did not have the desired effects. Rows in the view with
non-null <structfield>error</structfield> fields indicate problems in the
corresponding lines of the file.
</para>
<para>
A <filename>pg_ident.conf</filename> file that could be used in
conjunction with the <filename>pg_hba.conf</filename> file in <xref

View File

@@ -25475,8 +25475,9 @@ SELECT collation for ('foo' COLLATE "de_DE");
sending a <systemitem>SIGHUP</systemitem> signal to the postmaster
process, which in turn sends <systemitem>SIGHUP</systemitem> to each
of its children.) You can use the
<link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link> and
<link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link> views
<link linkend="view-pg-file-settings"><structname>pg_file_settings</structname></link>,
<link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link> and
<link linkend="view-pg-hba-file-rules"><structname>pg_ident_file_mappings</structname></link> views
to check the configuration files for possible errors, before reloading.
</para></entry>
</row>