# Architecture

> Architecture, catalogs, replication, execution, I/O, roles, and server internals.

---

LLMS index: [llms.txt](/en/llms.txt)

---

<div class="feature-source-note"><span class="feature-edition-badge">GA</span><span><strong>Source pages:</strong> PDF 16-34</span><span><a href="https://github.com/nori-shinoda/documents/blob/1773200c5362476c4a549222b7d17fa91f546cae/postgresql15_ga_new_features_en_20221014-1.pdf">Original PDF on GitHub</a></span></div>

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-16">PDF page 16</p>

#### 3.1.1 Modified System catalogs {#pg15-3-1-1-modified-system-catalogs}

The following catalogs have been changed.

**Table 5.** Added system catalogs and views

| View name | Description |
| --- | --- |
| pg_ident_file_mappings | Provides a summary of the contents of the client user name mapping configuration file. |
| pg_parameter_acl | Provides ACL information that allows the execution of the ALTER SYSTEM SET statement. |
| pg_publication_namespace | Stores the mapping between the schema and the PUBLICATION. |
| pg_stat_recovery_prefetch | Provides prefetch status during recovery. |
| pg_stat_subscription_stats | Stores initial data synchronization failure information that is performed when the subscription is created. |

**Table 6.** System catalogs\/views with additional columns

| View name | Added column | Data type | Description |
| --- | --- | --- | --- |
| pg_collation | colliculocale | text | ICU Collation name |
| pg_constraint | confdelsetcols | smallint[] | Column with ON DELETE clause for foreign key |
| pg_database | daticulocale | text | ICU Locale name |
|  | datlocprovider | char | ICU Collation Provider name |
|  | datcollversion | boolean | Collation version |
| pg_index | indnullsnotdistinct | boolean | Indicates the nullable setting of the unique index |
| pg_publication_rel | Prqual | pg_node_tree | Tuple conditions for replication |
|  | prattrs | int2vector | Column number to replicate |
| pg_statistic_ext_data | stxdinherit | boolean | If true, the stats include inheritance child columns |
| pg_stats_ext | inherited | boolean | If true, the stats include inheritance child columns |
| pg_stats_ext_exprs | inherited | boolean | If true, the stats include inheritance child columns |
| pg_subscription | subskiplsn | pg_lsn | Skipped LSN |
|  | subtwophasestate | char | Indicates the state of Two-Phase mode |
|  | subdisableonerr | boolean | Disable subscription on error occurs |
| information_schema.table_constraints | nulls_distinct | information s _ chema.yes_or_no | Indicates the nullable setting of the unique index |

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-17">PDF page 17</p>

**Table 7.** System catalogs\/views with columns removed

| Catalog name | Column name | Description |
| --- | --- | --- |
| pg_database | datlastsysoid | Removed because not used |

**Table 8.** System catalogs\/views with modified output

| View name | Description |
| --- | --- |
| pg_type | Added 'Z' to the typcategory column to indicate internal use. |
| pg_collation | The data type of collcollate and collctype columns has changed from 'name' to 'text'. |
| pg_database | The data type of the datcollate and datctype columns has changed from 'name' to 'text'. |
| pg_backend_memory_c | Information on the memory area for statistical data (PgStat *) is now |
| ontexts | output. |
| pg_shmem_allocations | Added Shared Memory Stats, XLOG Recovery Ctl, and XLogPrefetchStats tuples. |

Among the modified system catalogs, the details of the major catalogs are described below.

##### Pg_ident_file_mappings catalog {#pg15-p17-pg-ident-file-mappings-catalog}

This is a view for searching the contents of the pg_ident.conf file from SQL statements.

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-18">PDF page 18</p>

**Table 9.** Pg\_ident\_file\_mappings catalog

| Column name | Data type | Description |
| --- | --- | --- |
| line_number | integer | Line number in the pg_ident.conf file |
| map_name | text | Map name |
| sys_name | text | System name |
| pg_username | text | PostgreSQL user name |
| error | text | Error message |

**Example 12.** Reference to pg\_ident\_file\_mapping view\.

```text
postgres=# SELECT * FROM pg_ident_file_mapping ORDER BY 1 ;
line_number | map_name | sys_name | pg_username | error
-------------+----------+----------+-------------+-------
          43 | map1     | sysname1 | pgname1     |
          44 | map2     | sysname2 | pgname2     |
(2 rows)
```

##### Pg_parameter_acl catalog {#pg15-p18-pg-parameter-acl-catalog}

The catalog records configuration parameters for which privileges have been granted to one or more roles.

**Table 10.** Pg\_parameter\_acl catalog

| Column name | Data type | Description |
| --- | --- | --- |
| oid | oid | Object ID |
| parname | text | The parameter name to allow change |
| paracl | aclitem[] | Role information to allow changes |

##### Pg_publication_namespace {#pg15-p18-pg-publication-namespace}

Information is stored when the FOR TABLE IN SCHEMA clause is specified in the CREATE PUBLICATION statement. Provides a mapping between PUBLICATION and SCHEMA.

**Table 11.** Pg\_publication\_namespace catalog

| Column name | Data type | Description |
| --- | --- | --- |
| oid | oid | Row identifier |
| pnpubid | oid | Reference to PUBLICATION |
| pnnspid | oid | Reference to SCHEMA |

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-19">PDF page 19</p>

**Example 13.** Reference to pg\_publication\_namespace catalog

```text
postgres=> SELECT * FROM pg_publication_namespace ;
  oid  | pnpubid | pnnspid |
-------+---------+---------+
 16411 |   16410 |    2200 |
(1 row)
```

##### Pg_stat_recovery_prefetch view {#pg15-p19-pg-stat-recovery-prefetch-view}

Provides prefetched block statistics during recovery. It is also possible to check the status of replication processing in the standby instance of the streaming replication environment.

**Table 12.** Pg\_stat\_recovery\_prefetch view

| Column name | Data type | Description |
| --- | --- | --- |
| stats_reset | timestamp with time zone | Date time when the view was reset |
| prefetch | bigint | Number of blocks prefetched because they were not in the buffer pool |
| hit | bigint | Number of blocks not prefetched because they were already in the buffer pool |
| skip_init | bigint | Number of blocks not prefetched because they would be zeroinitialized |
| skip_new | bigint | Number of blocks not prefetched because they didn't exist yet |
| skip_fpw | bigint | Number of blocks not prefetched because a full-page image was included in the WAL |
| skip_rep | bigint | Number of blocks not prefetched because they were already recently prefetched |
| wal_distance | integer | How many bytes ahead the prefetcher is looking |
| block_distance | integer | How many blocks ahead the prefetcher is looking |
| io_depth | integer | How many prefetches have been initiated but are not yet known to have been completed |

##### Pg_stat_subscription_stats view {#pg15-p19-pg-stat-subscription-stats-view}

The pg_stat_subscription_stats view contains error information about logical replication subscription workers.

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-20">PDF page 20</p>

**Table 13.** Pg\_stat\_subscription\_stats view

| Column name | Data type | Description |
| --- | --- | --- |
| subid | oid | OID of the subscription |
| subname | name | Name of the subscription |
| apply_error_count | bigint | Number of times an error occurred while applying changes |
| sync_error_count | bigint | Number of times an error occurred during the initial table synchronization |
| stats_reset | timestamp with time zone | Time at which these statistics were last reset |

**Example 14.** Reference to pg\_stat\_subscription\_stats view

```text
postgres=# SELECT * FROM pg_stat_subscription_stats ;
-[ RECORD 1 ]-----+------
subid             | 16395
subname           | sub1
apply_error_count | 0
sync_error_count  | 23
stats_reset       |
```

##### Reference to memory related view {#pg15-p20-reference-to-memory-related-view}

The pg_backend_memory_contexts view and pg_shmem_allocations view can now be referenced not only by users with the SUPERUSER attribute but also by users belonging to the pg_read_all_stats role.

**Example 15.** Grant pg\_read\_all\_stats role

```text
postgres=# GRANT pg_read_all_stats TO demo ;
GRANT ROLE
postgres=# \connect postgres demo
You are now connected to database "postgres" as user "demo".
postgres=> SELECT COUNT(*) FROM pg_backend_memory_contexts ;
 count
-------
   122
(1 row)
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-21">PDF page 21</p>

#### 3.1.2 Logical Replication Enhancements {#pg15-3-1-2-logical-replication-enhancements}

The following features have been added to Logical Replication.

##### Column-specific replication {#pg15-p21-column-specific-replication}

It is now possible to replicate only specific columns in a table. Specify a column list for the table name in the CREATE PUBLICATION or ALTER PUBLICATION statement. The target column number is stored in the prattrs column of the pg_publication_rel catalog.

**Example 16.** Column specific replication

```text
postgres=> CREATE TABLE repl1(c1 INT PRIMARY KEY, c2 INT, c3 VARCHAR(10)) ;
CREATE TABLE
postgres=> CREATE PUBLICATION pub1 FOR TABLE repl1(c1, c2) ;
CREATE PUBLICATION
postgres=> SELECT oid, prpubid, prrelid, prattrs FROM pg_publication_rel ;
-[ RECORD 1 ]--
oid     | 16394
prpubid | 16393
prrelid | 16388
prattrs | 1 2
```

```sql
When executing an UPDATE or DELETE statement, the column specification must include all
replica identities (primary key, etc.). In the example below, the UPDATE statement is in error by
specifying a column that does not include the primary key in the publication.
```

**Example 17.** UPDATE statement failure

```text
postgres=> CREATE TABLE repl2(c1 INT PRIMARY KEY, c2 VARCHAR(10)) ;
CREATE TABLE
postgres=> CREATE PUBLICATION pub2 FOR TABLE repl2(c2) ;
CREATE PUBLICATION
postgres=> UPDATE repl2 SET c2='update' WHERE c1=100 ;
ERROR:  cannot update table "repl2"
DETAIL:  Column list used by the publication does not cover the replica
identity.
```

##### Row filtered replication {#pg15-p21-row-filtered-replication}

By specifying the WHERE clause in the CREATE PUBLICATION statement or the ALTER

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-22">PDF page 22</p>

PUBLICATION statement, the tuples in the table can be limited and replicated. Replication conditions are specified for each table. The WHERE clause description must be enclosed in parentheses.

**Example 18.** Specify WHERE clause

```text
postgres=> ALTER PUBLICATION pub1 SET TABLE repl1 WHERE (c1 < 1000) ;
ALTER PUBLICATION
```

```sql
In order to execute UPDATE or DELETE statements on the table to be replicated, the WHERE clause
must include a part of the replica identity (primary key, etc.).
```

**Example 19.** WHERE clause without replica identity

```text
postgres=> CREATE TABLE repl3(c1 INT PRIMARY KEY, c2 VARCHAR(10)) ;
CREATE TABLE
postgres=> CREATE PUBLICATION pub3 FOR TABLE repl3 WHERE (c2='update') ;
CREATE PUBLICATION
postgres=> UPDATE repl3 SET c2='modify' WHERE c1=1000 ;
ERROR:  cannot update table "repl3"
DETAIL:  Column used in the publication WHERE expression is not part of the
replica identity.
postgres=> DELETE FROM repl3 WHERE c1=1000 ;
ERROR:  cannot delete from table "repl3"
DETAIL:  Column used in the publication WHERE expression is not part of the
replica identity.
```

```text
The conditional statement that can be specified in the WHERE clause must be statically determined.
Therefore, user-defined functions and MUTABLE-specified functions cannot be specified.
```

**Example 20.** Specify the MUTABLE function

```text
postgres=> CREATE PUBLICATION pub4 FOR TABLE repl1 WHERE (c1 = random()) ;
ERROR:  invalid publication WHERE expression
LINE 1: ...EATE PUBLICATION pub4 FOR TABLE repl1 WHERE (c1 = random());
                                                             ^
DETAIL:  User-defined or built-in mutable functions are not allowed.
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-23">PDF page 23</p>

The conditions specified in the WHERE clause are converted and stored in the prqual column of the pg_publication_rel catalog. The psql command can be checked with the \d command or the \dRp+ command.

**Example 21.** \\d command

```text
postgres=> \d repl1
                      Table "public.repl1"
 Column |         Type          | Collation | Nullable | Default
--------+-----------------------+-----------+----------+---------
 c1     | integer               |           | not null |
 c2     | character varying(10) |           |          |
Indexes:
    "repl1_pkey" PRIMARY KEY, btree (c1)
Publications:
    "pub1" WHERE (c1 < 1000)
```

##### Specify all tables in the schema {#pg15-p23-specify-all-tables-in-the-schema}

The syntax is now available to register all tables in a particular schema with a PUBLICATION object. Specify the FOR TABLES IN SCHEMA clause and schema name in the CREATE PUBLICATION statement (or ALTER PUBLICATION statement). This syntax can only be executed by users with the SUPERUSER attribute. In the case of the FOR ALL TABLE clause that was available in the past, tables of all schemas were registered. Syntax

```sql
CREATE PUBLICATION publication_name FOR TABLES IN SCHEMA schema_name
ALTER PUBLICATION publication_name ADD TABLES IN SCHEMA schema_name
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-24">PDF page 24</p>

**Example 22.** Specify IN SCHEMA clause

```text
postgres=# CREATE PUBLICATION pub5 FOR TABLES IN SCHEMA schema1 ;
CREATE PUBLICATION
postgres=# \dRp
                               List of publications
 Name |  Owner   | All tables | Inserts | Updates | Deletes | Truncates | …
------+----------+------------+---------+---------+---------+-----------+-…
pub5 | postgres | f          | t       | t       | t       | t         | f
(1 row)
```

```text
The pg_publication_namespace catalog has been added with this implementation.
```

##### Skip LSN {#pg15-p24-skip-lsn}

It is now possible to specify the SKIP clause in the ALTER SUBSCRIPTION statement. Specify LSN in the SKIP clause. Execution of this statement allows the SUBSCRIPTION side of logical replication to skip transactions that caused synchronization errors. Syntax

```sql
ALTER SUBSCRIPTION subscription_name SKIP (LSN='lsn_value')
```

The skipped LSN can be obtained in the subskiplsn column of the pg_subscription catalog. The psql command added a Skip LSN entry to the output of the \dRs + command.

**Example 23.** Specify the SKIP clause

```text
postgres=# ALTER SUBSCRIPTION sub1 SKIP (LSN = '0/30B51E0') ;
ALTER SUBSCRIPTION
postgres=# SELECT subskiplsn FROM pg_subscription ;
 subskiplsn
------------
 0/30B51E0
(1 row)
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-25">PDF page 25</p>

##### Disable SUBSCRIPTION when an error occurs {#pg15-p25-disable-subscription-when-an-error-occurs}

The option disable_on_error can now be specified to disable SUBSCRIPTION if a replication error occurs. The default is false and no disabling is performed. The column subdisableonerr has been added to the pg_subscription catalog to indicate this option value.

**Example 24.** Execute CREATE SUBSCRIPTION statement

```text
postgres=# CREATE SUBSCRIPTION sub1 CONNECTION 'host=remsvr1, dbname=postgres'
PUBLICATION pub1 WITH (disable_on_error=true, two_phase=true) ;
NOTICE: created replication slot "sub1" on publisher
CREATE SUBSCRIPTION
```

##### TWO_PHASE option {#pg15-p25-two-phase-option}

The replication protocol command CREATE_REPILICATION_SLOT has been expanded and the TWO_PHASE option has been added. This makes it possible to decode PREPARE TRANSACTION, COMMIT PREPARED, ROLLBACK PREPARED, etc.

#### 3.1.3 Parallel Query Enhancements {#pg15-3-1-3-parallel-query-enhancements}

The SELECT DISTINCT statement can now work with parallel queries.

**Example 25.** Parallel query for SELECT DISTINCT

```text
postgres=> EXPLAIN SELECT DISTINCT c2 FROM data1 ;
                                 QUERY PLAN
------------------------------------------------------------------------------
 Unique  (cost=11614.55..11614.56 rows=1 width=6)
   ->  Sort  (cost=11614.55..11614.56 rows=2 width=6)
         Sort Key: c2
         ->  Gather  (cost=11614.33..11614.54 rows=2 width=6)
               Workers Planned: 2
               ->  HashAggregate  (cost=10614.33..10614.34 rows=1 width=6)
                     Group Key: c2
                     ->  Parallel Seq Scan on data1  (cost=0.00..9572.67 ro…
(8 rows)
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-26">PDF page 26</p>

#### 3.1.4 WAL compression {#pg15-3-1-4-wal-compression}

It is now possible to specify LZ4 and Zstandard as the compression method for the full-page image output to WAL. Change the parameter wal_compression to perform WAL compression. The setting value on, which is the conventional compression method, is an alias for the setting value pglz. The default value remains off without any change.

**Example 26.** WAL compression settings

```text
postgres=# SELECT name, setting, vartype, enumvals FROM pg_settings
WHERE name='wal_compression' ;
-[ RECORD 1 ]---------------
name     | wal_compression
setting  | off
vartype  | enum
enumvals | {pglz,lz4,zstd,on,off}
```

```text
To use value lz4 or zstd, it must be compiled with --with-lz4 and --with-zstd specified when executing
'configure' command.
```

#### 3.1.5 Archive Library {#pg15-3-1-5-archive-library}

It is now possible to use a shared library in addition to the traditional command (archive_command parameter) as a way to create an archive of WAL files. The archive_library parameter has been added to specify the archive library name. If archive_library is not set, the archive_command parameter can still be used. The Contrib module basic_archive has been added as a standard archive library. This Contrib module does not require the execution of the CREATE EXTENSION statement. The basic_archive.archive_directory parameter can be specified as the archive destination directory.

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-27">PDF page 27</p>

**Example 27.** Specify the Archive Library

```text
postgres=# SELECT * FROM pg_settings WHERE name LIKE 'archive_library' ;
-[ RECORD 1 ]---+-------------------------------------------------------------
name            | archive_library
setting         | basic_archive
unit            |
category        | Write-Ahead Log / Archiving
short_desc      | Sets the library that will be called to archive a WAL file.
extra_desc     | An empty string indicates that "archive_command" should be
used.
context         | sighup
vartype         | string
source          | configuration file
min_val         |
max_val         |
enumvals        |
boot_val        |
reset_val       | basic_archive
sourcefile      | /home/postgres/data/postgresql.conf
sourceline      | 255
pending_restart | f
postgres=# SHOW basic_archive.archive_directory ;
-[ RECORD 1 ]-------------------+----------------------
basic_archive.archive_directory | /home/postgres/arch
```

```text
If both archive_library and archive_command are specified, archive_library is used.
```

#### 3.1.6 Global Locale Provider {#pg15-3-1-6-global-locale-provider}

It is now possible to specify an ICU as the global locale provider. Allows ICU to be used as the default locale provider for the entire database cluster or database. You must use a binary compiled with the --with-icu option to use this feature. The --locale-provider option that specifies the locale provider name can be specified for the initdb command and createdb command. Specify libc or icu for this option. The --icu-locale option allows you to specify the ICU locale name.

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-28">PDF page 28</p>

**Example 28.** Execute initdb command

```bash
$ initdb --locale-provider=icu --icu-locale=en --encoding=utf8 -D data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with this locale configuration:
  provider:    icu
  ICU locale:  en
  LC_COLLATE:  en_US.utf8
  LC_CTYPE:    en_US.utf8
  LC_MESSAGES: en_US.utf8
  LC_MONETARY: en_US.utf8
  LC_NUMERIC:  en_US.utf8
  LC_TIME:     en_US.utf8
The default text search configuration will be set to "english".
…
```

```sql
Added LOCALE_PROVIDER to specify the locale provider and ICU_LOCALE to specify the locale
name to the options of the CREATE DATABASE statement.
```

**Example 29.** Execute CREATE DATABASE statement

```text
postgres=# CREATE DATABASE icudb1 LOCALE_PROVIDER=icu ICU_LOCALE=en
TEMPLATE=template0 ;
CREATE DATABASE
postgres=# SELECT datname, daticulocale FROM pg_database
WHERE datname='icudb1' ;
 datname | daticulocale
---------+--------------
 icudb1  | en
(1 row)
```

```text
The psql command outputs ICU Locale and Locale Provider in the output of the \l command.
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-29">PDF page 29</p>

**Example 30.** List databases

```text
postgres=> \l
                                                List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    | ICU Locale | Locale Provider…
-----------+----------+----------+------------+------------+------------+--------------- …
postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 | en         | icu             …
template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | en         | icu             …
template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | en         | icu             …
(3 rows)
```

#### 3.1.7 Statistics Information {#pg15-3-1-7-statistics-information}

In previous versions, the stats collector process received UDP protocol packets and periodically wrote them to temporary files. PostgreSQL 15 now stores statistics in shared memory. Information on the shared memory area for statistics can be obtained by searching the pg_shmem_allocations view and pg_backend_memory_contexts view. The stats collector process has been deprecated as a result of this specification change.

**Example 31.** Shared memory for Statistics information

```text
postgres=# SELECT * FROM pg_shmem_allocations WHERE name LIKE 'Shared%Stats' ;
        name         |    off    |  size  | allocated_size
---------------------+-----------+--------+----------------
 Shared Memory Stats | 147331584 | 263312 |         263424
(1 row)
postgres=# SELECT name, total_bytes, free_bytes, used_bytes FROM
pg_backend_memory_contexts WHERE name LIKE 'PgStat%' ;
          name          | total_bytes | free_bytes | used_bytes
------------------------+-------------+------------+------------
 PgStat Shared Ref Hash |        7224 |        680 |       6544
 PgStat Shared Ref      |        4096 |       1432 |       2664
 PgStat Pending         |        4096 |       2168 |       1928
(3 rows)
```

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-30">PDF page 30</p>

#### 3.1.8 GiST Index {#pg15-3-1-8-gist-index}

The following enhancements have been implemented to the GiST index:

##### Index statistics {#pg15-p30-index-statistics}

Access to the SP-GiST index is now counted in the pg_stat_ * views.

##### BOOL type {#pg15-p30-bool-type}

It is now possible to create an index for a Boolean type.

**Example 32.** GiST index creation for BOOK type

```text
postgres=> CREATE EXTENSION btree_gist ;
CREATE EXTENSION
postgres=> CREATE TABLE gist1(c1 INT, c2 BOOL, c3 VARCHAR(10)) ;
CREATE TABLE
postgres=> CREATE INDEX idx1_gist1 ON gist1 USING gist (c2) ;
CREATE INDEX
```

#### 3.1.9 Wait Events {#pg15-3-1-9-wait-events}

The following wait events have been added.

**Table 14.** Added Wait Events

| Wait Event name | Type | Description |
| --- | --- | --- |
| ArchiveCleanupCommand | IPC | Waiting for the archive_cleanup_command command to complete |
| ArchiveCommand | IPC | Waiting for the archive_command command to complete |
| BaseBackupSync | IO | Waiting for storage synchronization of base backup |
| BaseBackupWrite | IO | Waiting for base backup write |
| RecoveryEndCommand | IPC | Waiting for the recovery_end_command command to complete |
| RestoreCommand | IPC | Waiting for the restore_command command to complete |
| VersionFileWrite | IO | Waiting for the version file to be written while creating a database. |
| VacuumTruncate | Timeout | Waiting to acquire an exclusive lock to truncate off any empty pages |

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-31">PDF page 31</p>

The wait events PgStatMain, LogicalChangesRead, LogicalChangesWrite, LogicalSubxactRead, and LogicalSubxactWrite have been removed.

#### 3.1.10 Role {#pg15-3-1-10-role}

The predefined role pg_checkpoint has been added. This role holder can execute the CHECKPOINT statement.

**Example 33.** Grant pg\_checkpoint role

```text
postgres=# CREATE USER check1 PASSWORD 'check1' ;
CREATE ROLE
postgres=# \connect postgres check1
You are now connected to database "postgres" as user "check1".
postgres=> CHECKPOINT ;
ERROR:  must be superuser or have privileges of pg_checkpoint to do CHECKPOINT
postgres=> \connect postgres postgres
You are now connected to database "postgres" as user "postgres".
postgres=# GRANT pg_checkpoint TO check1 ;
GRANT ROLE
postgres=# \connect postgres check1
You are now connected to database "postgres" as user "check1".
postgres=> CHECKPOINT ;
CHECKPOINT
```

#### 3.1.11 Libpq {#pg15-3-1-11-libpq}

The following enhancements have been implemented in the Libpq API:

##### Environment variable PG_COLORS {#pg15-p31-environment-variable-pg-colors}

It is now possible to specify 'note' in the color specification item of the terminal output.

##### PQsslAttribute {#pg15-p31-pqsslattribute}

The PQsslAttribute(NULL, "library") function can now be executed to obtain the name of the library in use.

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-32">PDF page 32</p>

##### PQcancel {#pg15-p32-pqcancel}

The connection string tcp_user_timeout and keepalives are now available for executing the PQcancel API.

##### Allow root-owned SSL private keys in libpq {#pg15-p32-allow-root-owned-ssl-private-keys-in-libpq}

Libpq applies the same private key file ownership and permission checks as used on the backend. The private key can be owned by either the current user or the root

#### 3.1.12 Custom WAL resource manager {#pg15-3-1-12-custom-wal-resource-manager}

The custom WAL resource managers can now be registered for the shared_preload_libraries parameter. The pg_get_wal_resource_managers function has been added to check the current WAL resource managers.

**Example 34.** Check WAL resource manager

```text
postgres=# SELECT * FROM pg_get_wal_resource_managers() ;
 rm_id |      rm_name      | rm_builtin
-------+-------------------+------------
     0 | XLOG              | t
     1 | Transaction       | t
     2 | Storage           | t
     3 | CLOG              | t
…
```

#### 3.1.13 Hook {#pg15-3-1-13-hook}

The following hooks have been added.

##### String object access {#pg15-p32-string-object-access}

Added an access hook for string objects. Executed when accessing the GUC string.

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-33">PDF page 33</p>

**Example 35.** Hook definition \(src\/include\/catalog\/objectaccess\.h\)

```text
typedef void (*object_access_hook_type_str) (ObjectAccessType access,
                                        Oid classId,
                                        const char *objectStr,
                                        int subId,
                                        void *arg);
extern PGDLLIMPORT object_access_hook_type_str object_access_hook_str;
```

##### Shared memory request {#pg15-p33-shared-memory-request}

It must be specified from within the _PG_init function when the extension module gets the shared memory.

**Example 36.** Hook definition \(src\/include\/miscadmin\.h\)

```text
typedef void (*shmem_request_hook_type) (void);
extern PGDLLIMPORT shmem_request_hook_type shmem_request_hook;
extern PGDLLIMPORT bool process_shmem_requests_in_progress;
```

##### Object access hook {#pg15-p33-object-access-hook}

Execution of the ALTER TABLE SET {LOGGED, UNLOGGED, ACCESS METHOD} statement now executes an object access hook.

#### 3.1.14 Custom scan providers {#pg15-3-1-14-custom-scan-providers}

The custom scan providers can now choose to support projection. In previous versions, all custom scan providers needed projection support. Control is performed by the CUSTOMPATH_SUPPORT_PROJECTION macro.

#### 3.1.15 Build target {#pg15-3-1-15-build-target}

The target name of Makefile to be specified when building from source code has been added. The following targets do not build or install documentation.

- world-bin

- install-world-bin

<p class="feature-page-marker" id="pgfeat-15-architecture-pdf-page-34">PDF page 34</p>

This specification will also be backported to older versions.

#### 3.1.16 Dynamic Shared Memory {#pg15-3-1-16-dynamic-shared-memory}

Dynamic Shared Memory (DSM) is now also available in single user mode.
