# 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 14-34</span><span><a href="https://github.com/nori-shinoda/documents/blob/1773200c5362476c4a549222b7d17fa91f546cae/postgresql13_ga_new_features_en_20200927-1.pdf">Original PDF on GitHub</a></span></div>

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

#### 3.1.1 Modified catalogs {#pg13-3-1-1-modified-catalogs}

The following catalogs have been changed.

**Table 5.** Added system catalogs

| Catalog name | Description |
| --- | --- |
| pg_shmem_allocations | View the breakdown of shared memory. |
| pg_stat_progress_analyze | Tracking the progress of the ANALYZE statement. |
| pg_stat_progress_basebackup | Tracking the progress of the base backup. |
| pg_stat_slru | Tracking SLRU cache statistics. |

**Table 6.** Dropped catalog

| Catalog name | Description |
| --- | --- |
| pg_pltemplate | Procedural language templates. |

**Table 7.** Dropped views in information\_schema schema

| Catalog name | Description |
| --- | --- |
| sql_languages | SQL statement standards compliance levels, options, and dialects. |
| sql_packages | List of standard packages. |
| sql_sizing_profiles | List of defined size information. |

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

**Table 8.** System catalogs with columns added

| Catalog name | Added column | Data type | Description |
| --- | --- | --- | --- |
| pg_available_extension_versions | trusted | boolean | The extension can be installed by nonsuperusers. |
| pg_publication | pubviaroot | boolean | Convert partition updates to route tables. |
| pg_replication_slots | wal_status | text | WAL file status. |
|  | safe_wal_size | bigint | A number of bytes that can be written to WAL for the state "lost". |
| pg_stat_activity | leader_pid | integer | Leader PID for the parallel query. |
| pg_stat_{all\|sys\|user}_tables | n_ins_since_vacuum | bigint | The Number of tuples inserted since the last VACUUM. |
| pg_stat_wal_receiver | written_lsn | pg_lsn | The last WAL location for already received and written to disk, but not flushed. |
|  | flushed_lsn | pg_lsn | The last WAL location already received and flushed to disk. |
| pg_statistic_ext | stxstattarget | integer | SET STATISTIC value. |
| pg_trigger | tgparentid | oid | OID of parent trigger. |

**Table 9.** System catalogs with columns dropped

| Catalog name | Dropped column | Description |
| --- | --- | --- |
| pg_stat_wal_receiver | received_lsn | Split into written_lsn and flushed_lsn. |

**Table 10.** System catalog with changed output tuples

| Catalogname | Description |
| --- | --- |
| pg_locks | The value 'speculative token' output in the locktype column has changed to 'spectoken'. |
| pg_stat_ssl | Process information other than client connection has been removed. |
| pg_stat_gssapi | Process information other than client connection has been removed. |

Catalog name Description

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

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

##### Pg_shmem_allocations catalog {#pg13-p16-pg-shmem-allocations-catalog}

The pg_shmem_allocations catalog allows you to see the breakdown in shared memory. However, it does not include the area of dynamic shared memory. Only users with the SUPERUSER attribute can see this catalog.

**Table 11.** pg\_shmem\_allocations catalog

| Column name | Data type | Description |
| --- | --- | --- |
| name | text | The name of the memory area, 'null' is an unused area. |
| off | bigint | Offset from the start position. |
| size | bigint | Reserved bytes. |
| allocated_size | bigint | Reserved bytes including padding. |

**Example 7.** Refer pg\_shmem\_allocations catalog

```text
postgres=# SELECT * FROM pg_shmem_allocations ;
                name                 |    off    |   size    | allocated_size
-------------------------------------+-----------+-----------+-------------
Buffer IO Locks                     | 140660096 |    524288 |         524288
 Buffer Descriptors                  |   5393792 |   1048576 |        1048576
 Backend SSL Status Buffer           | 146585088 |     42312 |          42368
 Async Queue Control                 | 147119360 |      2492 |           2560
 Wal Sender Ctl                      | 147112832 |      1280 |           1280
 AutoVacuum Data                     | 147104384 |      5368 |           5376
 PROCLOCK hash                       | 143136000 |      2904 |           2944
 FinishedSerializableTransactions    | 146097664 |        16 |            128
 XLOG Ctl                            |     53504 |   4208272 |        4208384
 Shared MultiXact State              |   5392640 |      1028 |           1152
…
```

##### Pg_stat_progress_analyze catalog {#pg13-p16-pg-stat-progress-analyze-catalog}

The pg_stat_progress_analyze catalog allows you to check the execution status of the ANALYZE statement. This catalog can be viewed by ordinary users, but ordinary users cannot see the status of other users' command execution.

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

**Table 12.** pg\_stat\_progress\_analyze catalog

| Column name | Data type | Description |
| --- | --- | --- |
| pid | integer | Backend process ID. |
| datid | oid | OID of the connection database. |
| datname | name | Connection database name. |
| relid | oid | Table OID executing ANALYZE statement. |
| phase | text | Execution phase. |
| sample_blks_total | bigint | Total number of blocks sampled. |
| sample_blks_scanned | bigint | Number of sampled blocks. |
| ext_stats_total | bigint | Extended statistics. |
| ext_stats_computed | bigint | Number of extended statistics computed. |
| child_tables_total | bigint | Number of child tables. |
| child_tables_done | bigint | Number of child tables for ANALYZE are done. |
| current_child_table_relid | oid | ANALYZE executing child table OID. |

**Example 8.** Refer pg\_stat\_progress\_analyze catalog

```text
postgres=# SELECT * FROM pg_stat_progress_analyze ;
-[ RECORD 1 ]-------------+---------------------
pid                       | 30932
datid                     | 13578
datname                   | postgres
relid                     | 16388
phase                     | computing statistics
sample_blks_total         | 54055
sample_blks_scanned       | 54055
ext_stats_total           | 0
ext_stats_computed        | 0
child_tables_total        | 0
child_tables_done         | 0
current_child_table_relid | 0
```

##### Pg_stat_progress_basebackup catalog {#pg13-p17-pg-stat-progress-basebackup-catalog}

The pg_stat_progress_basebackup catalog allows you to check the status of the backups performed by tools such as the pg_basebackup command. This catalog can be viewed by non-superuser users, but only the 'pid' column can be viewed by non-connected users.

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

**Table 13.** pg\_stat\_progress\_basebackup catalog

| Column name | Data type | Description |
| --- | --- | --- |
| pid | integer | WAL sender process ID. |
| phase | text | The string indicating the execution phase. |
| backup_total | bigint | Total backup size. |
| backup_streamed | bigint | Streaming data volume. |
| tablespaces_total | bigint | Number of total tablespaces. |
| tablespaces_streamed | bigint | Number of streaming tablespaces. |

**Example 9.** Refer pg\_stat\_progress\_basebackup catalog

```text
postgres=# SELECT * FROM pg_stat_progress_basebackup ;
-[ RECORD 1 ]--------+-------------------------
pid                  | 31080
phase                | streaming database files
backup_total         | 467913216
backup_streamed      | 302026752
tablespaces_total    | 1
tablespaces_streamed | 0
```

##### Pg_stat_slru catalog {#pg13-p18-pg-stat-slru-catalog}

Pg_stat_slru catalog can check the usage status of the SLRU cache. Displays statistics on accesses to cached pages for each SLRU cache area.

**Table 14.** pg\_stat\_slru catalog

| Column name | Data type | Description |
| --- | --- | --- |
| name | text | SLRU name. |
| blks_zeroed | bigint | Number of blocks initialized to zero. |
| blks_hit | bigint | Number of blocks that hit the cache. |
| blks_read | bigint | Number of blocks read. |
| blks_written | bigint | Number of blocks written. |
| blks_exists | bigint | Number of blocks checked for existence in the cache. |
| flushes | bigint | Number of dirty blocks flushed. |
| truncates | bigint | Number of blocks truncated. |
| stats_reset | timestamp with time zone | Date and time when statistics were reset. |

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

The counter values in this view will persist across instance reboots. Execute pg_stat_reset_slru function2 to reset the counter value.

**Example 10.** Refer pg\_stat\_slru catalog

```text
postgres=# SELECT name, blks_hit, blks_read, blks_written
FROM pg_stat_slru ;
      name       | blks_hit | blks_read | blks_written
-----------------+----------+-----------+--------------
 CommitTs        |        0 |         0 |            0
 MultiXactMember |        0 |         0 |            0
 MultiXactOffset |        0 |         0 |            0
 Notify          |        0 |         0 |            0
 Serial          |        0 |         0 |            0
 Subtrans        |        0 |         0 |            0
 Xact            |       14 |         0 |            0
 other           |        0 |         0 |            0
(8 rows)
```

#### 3.1.2 Data types {#pg13-3-1-2-data-types}

The following data types have been added:

##### Regcollation {#pg13-p19-regcollation}

The regcollation type that indicates the Collation name has been added. A to_regcollation function has been added to convert from text type to regcollation type.

**Example 11.** Execute to\_regcollation function

```text
postgres=> SELECT to_regcollation('"POSIX"') ;
 to_regcollation
-----------------
 "POSIX"
(1 row)
```

```text
2 See 3.2.19 Functions
```

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

##### Xid8 {#pg13-p20-xid8}

The xid8 type that indicates a 64-bit transaction ID has been added. Functions that use the xid8 type have been added. The functions that return the conventional 32-bit transaction ID are kept for compatibility. However, they may be removed in the future.

**Table 15.** Functions that use 64\-bit transaction IDs

| function name | function name |
| --- | --- |
| txid_current | pg_current_xact_id |
| txid_current_if_assigned | pg_current_xact_id_if_assigned |
| txid_current_snapshot | pg_current_snapshot |
| txid_snapshot_xip | pg_snapshot_xip |
| txid_snapshot_xmax | pg_snapshot_xmax |
| txid_snapshot_xmin | pg_snapshot_xmin |
| txid_visible_in_snapshot | pg_visible_in_snapshot |
| txid_status | pg_xact_status |

##### Pg_snapshot {#pg13-p20-pg-snapshot}

The pg_snapshot type stores information about the transaction ID visibility (xmin, xmax, xip_list) at a specific point in time.

##### Other abstract data types {#pg13-p20-other-abstract-data-types}

In addition, the following abstract data types have been added.

**Table 16.** Added abstract data types

| Data type name | Description |
| --- | --- |
| anycompatible | The function accepts any data type and is automatically promoted. |
| anycompatiblearray | The function accepts any array type and is automatically promoted. |
| anycompatiblenonarray | The function accepts an non-array type and is automatically promoted. |
| anycompatiblerange | The function accepts any range type and is automatically promoted. |
| table_am_handler | Table access method handler. |

#### 3.1.3 Disk-based hash aggregation {#pg13-3-1-3-disk-based-hash-aggregation}

A hash table may be created in memory when executing a GROUP BY or DISTINCT clause. PostgreSQL 13 performs storage-based hash aggregation if the hash table cannot be stored in work memory. In previous versions, work memory was created on the assumption that it could be stored in

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

memory, which could lead to unexpected increases in memory usage.

**Example 12.** Disk\-based hash aggregation

```text
postgres=> EXPLAIN ANALYZE SELECT COUNT(*) FROM data1 GROUP BY c1 ;
                               QUERY PLAN
-----------------------------------------------------------------
HashAggregate
(cost=4304055.00..5029055.00
rows=10000000
width=14) (actual time=2703.993..16089.774 rows=10000000 loops=1)
   Group Key: c1
   Planned Partitions: 4  Batches: 87381  Memory Usage: 109kB  Disk
Usage: 268256kB
   ->  Seq Scan on data1  (cost=0.00..154055.00 rows=10000000
width=6) (actual time=0.025..606.455 rows=10000000 loops=1)
 Planning Time: 0.039 ms
 Execution Time: 16407.060 ms
(6 rows)
```

#### 3.1.4 Incremental sort {#pg13-3-1-4-incremental-sort}

Incremental sorting is a way to reduce the resources used for multi-column sorting. It is used when another column needs to be sorted in addition to the already sorted column. This feature can be controlled by the enable_incremental_sort parameter. The default value is 'on'.

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

**Example 13.** Incremental sort

```text
postgres=> EXPLAIN ANALYZE SELECT * FROM (SELECT * FROM data1 ORDER
BY c1) t ORDER BY c1, c2;
                                   QUERY PLAN
-----------------------------------------------------------------
Incremental Sort  (cost=0.49..853808.44 rows=10000000 width=12)
(actual time=0.063..2253.672 rows=10000000 loops=1)
   Sort Key: data1.c1, data1.c2
   Presorted Key: data1.c1
   Full-sort Groups: 312500  Sort Method: quicksort  Average
Memory: 26kB  Peak Memory: 26kB
   ->
Index
Only
Scan
using
idx1_data1
on
data1
(cost=0.43..303808.43
rows=10000000
width=12)
(actual
time=0.045..891.341 rows=10000000 loo
ps=1)
         Heap Fetches: 0
 Planning Time: 0.258 ms
 Execution Time: 2495.751 ms
(8 rows)
```

#### 3.1.5 Backup manifests {#pg13-3-1-5-backup-manifests}

Consistency checks can now be executed on base backups created with the pg_basebackup command, etc. The size and checksum are calculated for each file in the database cluster.

##### Checksum {#pg13-p22-checksum}

The checksum calculation method can be selected from SHA224, SHA256, SHA384, SHA512, and CRC32C. CRC32C is the default value.

##### Manifest file {#pg13-p22-manifest-file}

The backup manifest is stored as backup_manifest in the backup directory. It is a file in JSON format.

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

**Example 14.** backup\_manifest file

```bash
$ pg_basebackup -D back
$ cat back/backup_manifest
{ "PostgreSQL-Backup-Manifest-Version": 1,
"Files": [
{ "Path": "backup_label", "Size": 226, "Last-Modified": "2020-09-
24 06:20:15 GMT", "Checksum-Algorithm": "CRC32C", "Checksum":
"0e45028a" },
{ "Path": "global/1262", "Size": 8192, "Last-Modified": "2020-09-
24 05:50:10 GMT", "Checksum-Algorithm": "CRC32C", "Checksum":
"6a2131f8" },
…
"WAL-Ranges": [
{
"Timeline":
1,
"Start-LSN":
"0/2D000028",
"End-LSN":
"0/2D0001E8" }
],
"Manifest-Checksum":
"8832de70e00fd7612125364088a945ff5cacca3befb4004eea255e2b498a0ca6
"}
```

```text
If the backup is performed in tar format, the manifest file is not included in the tar file.
```

**Example 15.** Manifest file for backup in tar file format

```bash
$ pg_basebackup --format=tar -D back
$ ls back
backup_manifest  base.tar  pg_wal.tar
$
```

##### Check consistency {#pg13-p23-check-consistency}

The pg_verifybackup command is provided to recheck the integrity of the obtained backup. Specify the backup destination directory name to the pg_verifybackup command3.

3 See 3.4.6 pg_verifybackup

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

**Example 16.** pg\_verifybackup command

```bash
$ pg_verifybackup back
backup successfully verified
```

#### 3.1.6 Partitioned table {#pg13-3-1-6-partitioned-table}

The following features have been added to the partitioned table.

##### Logical replication support {#pg13-p24-logical-replication-support}

The partitioned tables can now be added to PUBLICATION in a logical replication environment. In the previous version, the CREATE PUBLICATION statement in the example below failed. In order for replication to succeed, a table with the same structure is required on the SUBSCRIPTION side.

**Example 17.** Add partitioned table to PUBLICATION

```text
postgres=> CREATE TABLE part1(c1 NUMERIC PRIMARY KEY, c2 VARCHAR(10))
PARTITION BY RANGE(c1) ;
CREATE TABLE
postgres=> CREATE TABLE part1v1 PARTITION OF part1 FOR VALUES
FROM (0) TO (100000) ;
CREATE TABLE
postgres=> CREATE TABLE part1v2 PARTITION OF part1 FOR VALUES
FROM (100000) TO (200000) ;
CREATE TABLE
postgres=> CREATE PUBLICATION pub1 FOR TABLE part1 ;
CREATE PUBLICATION
postgres=> \dRp+ pub1
                            Publication pub1
 Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root
-------+------------+---------+---------+---------+-----------+----------
 demo  | f            | t        | t         | t        | t           | f
Tables:
    "public.part1"
```

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

By default, PUBLICATION sends updates to the partition to SUBSCRIPTION without converting them to updates to the partition table. When replicating to a non-partitioned table on the SUBSCRIPTION side, set the PUBLICATION attribute publish_via_partition_root to 'off'.

**Example 18.** Non\-partitioned table on SUBSCRIPTION side

```text
postgres=> ALTER PUBLICATION pub1 SET (publish_via_partition_root = on) ;
ALTER PUBLICATION
postgres=> \dRp+ pub1
                            Publication pub1
 Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root
-------+------------+---------+---------+---------+-----------+----------
 demo  | f            | t         | t        | t        | t           | t
Tables:
    "public.part1"
# SUBSCRIPTION side
postgres=> CREATE TABLE part1(c1 NUMERIC PRIMARY KEY, c2 VARCHAR(10)) ;
CREATE TABLE
postgres=# CREATE SUBSCRIPTION sub1 CONNECTION 'host=remhost1 dbname=postgres
user=postgres password=<<PASSWORD>>' PUBLICATION pub1 ;
NOTICE:  created replication slot "sub1" on publisher
CREATE SUBSCRIPTION
postgres=#
```

##### BEFORE INSERT trigger {#pg13-p25-before-insert-trigger}

ROW level BEFORE INSERT triggers can now be set. However, a tuple is not possible to change the partition to be stored.

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

**Example 19.** CREATE TRIGGER statement for a partitioned table

```text
postgres=> CREATE TABLE part1 (c1 INT, c2 INT, c3 VARCHAR(10))
PARTITION BY LIST(c1) ;
CREATE TABLE
postgres=> CREATE TABLE part1v1 PARTITION OF part1 FOR VALUES IN
(10) ;
CREATE TABLE
postgres=> CREATE OR REPLACE FUNCTION fnc1_part1() RETURNS TRIGGER
LANGUAGE plpgsql AS $$
   BEGIN
     NEW.c3 = 'TRIGGER';
     RETURN NEW;
 END; $$ ;
CREATE FUNCTION
postgres=> CREATE TRIGGER trg1_part1 BEFORE INSERT ON part1
FOR EACH ROW EXECUTE FUNCTION fnc1_part1() ;
CREATE TRIGGER
postgres=> INSERT INTO part1(c1, c2) VALUES (10, 20) ;
INSERT 0 1
postgres=> SELECT * FROM part1 ;
 c1 | c2 |   c3
----+----+---------
 10 | 20 | TRIGGER
(1 row)
```

##### Allow partition wise join in more case {#pg13-p26-allow-partition-wise-join-in-more-case}

Partition-wise join can now be performed even if the partition structures are not the same. This feature does not work with hash partitioned tables.

##### Partitioned column using the entire table {#pg13-p26-partitioned-column-using-the-entire-table}

It is now possible to specify an entire column to the definition of the partitioning columns.

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

**Example 20.** Partitiond column expression

```text
postgres=> CREATE TABLE part2(c1 INT, c2 INT) PARTITION
BY LIST((part2)) ;
CREATE TABLE
postgres=> CREATE TABLE part2v1 PARTITION OF part2 FOR VALUES
IN ('(1, 2)') ;
CREATE TABLE
postgres=> CREATE TABLE part2v2 PARTITION OF part2 FOR VALUES
IN ('(2, 4)') ;
CREATE TABLE
```

#### 3.1.7 Log output for Autovacuum {#pg13-3-1-7-log-output-for-autovacuum}

WAL statistics are now output to the automatic VACUUM log.

**Example 21.** Log output for Autovacuum

```sql
2020-09-24 15:59:21.872 JST [31752] LOG:  automatic vacuum of table
"postgres.public.data1": index scans: 1
        pages: 0 removed, 54055 remain, 0 skipped due to pins, 0
skipped frozen
        tuples: 10000000 removed, 0 remain, 0 are dead but not yet
removable, oldest xmin: 514
        buffer usage: 234548 hits, 119331 misses, 130854 dirtied
        avg read rate: 2.780 MB/s, avg write rate: 3.048 MB/s
        system usage: CPU: user: 3.24 s, system: 4.13 s, elapsed:
335.39 s
        WAL usage: 244232 records, 93518 full page images, 303298890
bytes
```

#### 3.1.8 Wait events {#pg13-3-1-8-wait-events}

Wait events that are output to the wait_event column of the pg_stat_activity catalog had the following changes.

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

**Table 17.** Added wait events

| Wait event name | Description |
| --- | --- |
| BackupWaitWalArchive | Waiting for archive creation. |
| RecoveryConflictSnapshot | Waiting for recovery conflict resolution during VACUUM cleanup. |
| RecoveryConflictTablespace | Waiting for resolution of recovery conflict when deleting table space. |
| RecoveryPause | Waiting for the promotion of standby instance. |
| VacuumDelay | Cost-based VACUUM delay. |
| ProcSignalBarrier | Waiting for a barrier event to be processed by all backends. |

**Table 18.** Wait event that has been renamed

| Wait event name (PostgreSQL 12) | Wait event name (PostgreSQL 13) |
| --- | --- |
| AsyncCtlLock | NotifySLRU |
| AsyncQueueLock | NotifyQueue |
| CLogControlLock | XactSLRU |
| ClogGroupUpdate | XactGroupUpdate |
| CommitTsControlLock | CommitTsSLRU |
| Hash/Batch/Allocating | HashBatchAllocate |
| Hash/Batch/Electing | HashBatchElect |
| Hash/Batch/Loading | HashBatchLoad |
| Hash/Build/Allocating | HashBuildAllocate |
| Hash/Build/Electing | HashBuildElect |
| Hash/Build/HashingInner | HashBuildHashInner |
| Hash/Build/HashingOuter | HashBuildHashOuter |
| Hash/GrowBatches/Allocating | HashGrowBatchesAllocate |
| Hash/GrowBatches/Deciding | HashGrowBatchesDecide |
| Hash/GrowBatches/Electing | HashGrowBatchesElect |
| Hash/GrowBatches/Finishing | HashGrowBatchesFinish |
| Hash/GrowBatches/Repartitioning | HashGrowBatchesRepartition |
| Hash/GrowBuckets/Allocating | HashGrowBucketsAllocate |
| Hash/GrowBuckets/Electing | HashGrowBucketsElect |
| Hash/GrowBuckets/Reinserting | HashGrowBucketsReinsert |
| MultiXactOffsetControlLock | MultiXactOffsetSLRU |
| MultiXactMemberControlLock | MultiXactMemberSLRU |
| OldSerXidLock | SerialSLRU |
| RecoveryWalAll | RecoveryWalStream |
| RecoveryWalStream | RecoveryRetrieveRetryInterval |
| SerializablePredicateLockListLock | SerializablePredicateList |
| SubtransControlLock | SubtransSLRU |
| speculative token | spectoken |

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

There are many event name changes other than the above table, such as deleting 'Lock' from the end of the event name.

#### 3.1.9 libpq connection string {#pg13-3-1-9-libpq-connection-string}

The following libpq connection strings have been added/changed.

##### Channel_binding parameter {#pg13-p29-channel-binding-parameter}

The channel_binding parameter has been added to the client connection string to control channel binding. The values that can be specified are as follows.

**Table 19.** channel\_binding parameter values

| Value | Description |
| --- | --- |
| require | Required. |
| prefer | Client selection. |
| disable | Disable. |

'Prefer' is the default value when SSL is enabled. 'Disable' is the default value if SSL is disabled. The environment variable PGCHANNELBINDING can specify the same value as this parameter.

##### Sslkey parameter {#pg13-p29-sslkey-parameter}

ASN.1 DER format files can now be specified for the sslkey parameter.

##### Ssl_min_protocol_version, ssl_max_protocol_version parameter {#pg13-p29-ssl-min-protocol-version-ssl-max-protocol-version-parameter}

Specify the minimum version (ssl_min_protocol_version) and maximum version (ssl_max_protocol_version) of the SSL / TLS protocol. Possible values are TLSv1, TLSv1.1, TLSv1.2, and TLSv1.3. The default value of ssl_min_protocol_version is TLSv1.2. if the value of ssl_max_protocol_version is not specified, the backend value is used. It is also possible to use the environment variables PGSSLMINPROTOCOLVERSION and PGSSLMAXPROTOCOLVERSION

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

instead of using parameters.

##### Sslpassword parameter {#pg13-p30-sslpassword-parameter}

Specify the password of the private key specified by the sslkey parameter.

#### 3.1.10 libpq functions {#pg13-3-1-10-libpq-functions}

```text
  The following libpq functions have been added.
```

- BufferUsageAccumDiff

- TupleHashTableHash

- LookupTupleHashEntryHash

- PQsetSSLKeyPassHook_OpenSSL

- LogicalTapeSetExtend

#### 3.1.11 Hook {#pg13-3-1-11-hook}

The following hook functions have been provided.

##### TLS initialization hook {#pg13-p30-tls-initialization-hook}

The TLS initialization hook was provided. Specify the callback function in openssl_tls_init_hook.

##### TRUNCATE hook {#pg13-p30-truncate-hook}

The hook is executed to allow mandatory access control (MAC) for the TRUNCATE statement. Contrib module sepgsql can control access to the TRUNCATE statement.

#### 3.1.12 Column trigger {#pg13-3-1-12-column-trigger}

In a logical replication environment, column triggers are now executed on the subscription side.

#### 3.1.13 Local connection key {#pg13-3-1-13-local-connection-key}

Conventionally, the key information of the shared memory used by the instance was determined based on the connection waiting port number (parameter 'port'). PostgreSQL 13 now uses the i-node number of the database cluster.

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

**Example 22.** Shared memory key\-value

```bash
$ ls -lid data
33832487 drwx------. 20 postgres postgres 4096 Sep 24 08:11 data
$ ipcs -m
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x02043e27 196610     postgres   600        56         6
```

```text
In the above example, the i-node number is 33,832,487, which is 0x02043e27 when converted to
hexadecimal.
```

#### 3.1.14 Trusted Extension {#pg13-3-1-14-trusted-extension}

The 'trusted' attribute described in the extension control file ({extension}.control) file has been added. The default value for this attribute is 'off'. Extensions with this attribute value set to 'on' can execute the CREATE EXTENSION statement even if the user does not have the SUPERUSER attribute. Users must have CREATE privilege on the database.

**Example 23.** plpgsql\.control file contents

```bash
$ cat plpgsql.control
# plpgsql extension
comment = 'PL/pgSQL procedural language'
default_version = '1.0'
module_pathname = '$libdir/plpgsql'
relocatable = false
schema = pg_catalog
superuser = true
trusted = true
```

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

**Example 24.** CREATE EXTENSION statement executed by a general user

```text
postgres=# CREATE USER demo PASSWORD '<<PASSWORD>>' ;
CREATE ROLE
postgres=# GRANT CREATE ON DATABASE postgres TO demo ;
GRANT
postgres=# \connect postgres demo
You are now connected to database "postgres" as user "demo".
postgres=> CREATE EXTENSION hstore ;
CREATE EXTENSION
```

```text
The following extensions have the trusted setting set to 'on'.
• bool_plperl
• btree_gin
• btree_gist
• citext
• cube
• dict_int
• fuzzystrmatch
• hstore
• intarray.
• isn
• jsonb_plperl
• lo
• ltree
• pgcrypto
• pg_trgm
• plperl
• plpgsql
• seg
• tablefunc
• tcn
• tsm_system_rows
• tsm_system_time
• unaccent
```

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

#### 3.1.15 Replication slot {#pg13-3-1-15-replication-slot}

If the parameter primary_slot_name is not specified on the standby instance in a streaming replication environment, a temporary replication slot can be created on the primary instance. The standby instance parameter wal_receiver_create_temp_slot must be 'on' (default 'off').

**Example 25.** Information on automatically created replication slots

```text
postgres=# SELECT * FROM pg_replication_slots ;
-[ RECORD 1 ]-------+--------------------
slot_name           | pg_walreceiver_4273
plugin              |
slot_type           | physical
datoid              |
database            |
temporary           | t
active              | t
active_pid          | 4273
xmin                |
catalog_xmin        |
restart_lsn         | 0/390005A0
confirmed_flush_lsn |
wal_status          | reserved
safe_wal_size       |
```

#### 3.1.16 Text search {#pg13-3-1-16-text-search}

Languages for text search have been increased. In PostgreSQL 12, there were 22 languages, but in PostgreSQL 13, Greek has been added.

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

**Example 26.** Text search languages

```text
postgres=> \dF
               List of text search configurations
   Schema   |    Name    |              Description
------------+------------+---------------------------------------
 pg_catalog | arabic     | configuration for arabic language
 pg_catalog | danish     | configuration for danish language
 pg_catalog | dutch      | configuration for dutch language
 pg_catalog | english    | configuration for english language
 pg_catalog | finnish    | configuration for finnish language
 pg_catalog | french     | configuration for french language
 pg_catalog | german     | configuration for german language
 pg_catalog | greek      | configuration for greek language << new
 pg_catalog | hungarian  | configuration for hungarian language
…
```
