Skip to content

3 Architecture

Architecture, catalogs, replication, execution, I/O, roles, and server internals.
GASource pages: PDF 14-37Original PDF on GitHub

PDF page 14

3.1.1 Modified catalogs

The following catalogs have been changed.

View nameDescription
pg_backend_memory_contextsDisplays all the memory contexts of the server process attached to the current session.
pg_stat_progress_copyOutputs the execution status of the COPY statement.
pg_stat_replication_slotsOutputs the usage status of the replication slot.
pg_stat_walOutputs the WAL data output status.
pg_stats_ext_exprsProvides information about all expressions included in extended statistics objects
Table 5 Added system catalogs and views
View nameDescription
routine_column_usageIdentifies the column used by the function or procedure. Currently not tracked.
routine_routine_usageIdentifies the function used by the function or procedure. Currently, some are not tracked.
routine_sequence_usageIdentifies the sequence used by a function or procedure. Currently, some are not tracked.
routine_table_usageIdentifies the table used by the function or procedure. Currently not tracked.
Table 6 Added views in the information schema (information_schema)

PDF page 15

View nameAdded columnData typeDescription
pg_attributeattcompressioncharCurrent compression method of the column.
pg_inheritsinhdetachpendin gbooleanTrue for a partition that is in the process of being detached
pg_lockswaitstarttimestamp with time zoneTime when the server process time started waiting for this lock.
pg_prepared_statementspg_prepared_statementsgeneric_plansbigintNumber of times generic plan was chosen.
custom_plansbigintNumber of times custom plan was chosen
pg_procprosqlbodypg_node_tre ePre-parsed SQL function body.
pg_rangerngmultitypidoidOID of the multirange type.
pg_replication_slotstwo_phasebooleanEnabled for decoding prepared transactions.
pg_stat_activityquery_idbigintIdentifier of this backend’s most recent query.
pg_stat_databasesession_timedouble precisionTime spent by database sessions in this database.
active_timedouble precisionTime spent executing SQL statements in this database.
idle_in_transactidoubleTime spent idling while in a
on_timeprecisiontransaction in this database.
sessionsbigintTotal number of sessions.
sessions_abandonedbigintNumber of lost sessions.
sessions_fatalbigintNumber of sessions caused by fatal error.
sessions_killedbigintNumber of sessions terminated by the operator.
pg_stats_extexprstext[]Expression to get extended statistics
pg_statistic_extstxexprspg_node_tre eExpression trees for statistics object attributes.
pg_statistic_ext_datastxdexprpg_statistic []A list of any expressions covered by this statistics object.
pg_subscriptionsubbinarybooleanPublisher send data in binary format.
substreambooleanStreaming of in-progress transactions.
pg_typetypsubscriptregprocSubscripting handler function’s OID.
Table 7 System catalogs/views with additional columns

PDF page 16

Catalog nameColumn nameDescription
pg_stat_sslcompressionIt was deleted because compression was disabled.
Table 8 System catalogs/views with columns removed
View nameDescription
pg_attributeThe column definition order has changed.
pg_classThe initial value of the reltuples column has been changed to -1.
pg_settingspending_restart column shows as true when a pertinent entry in postgresql.conf is removed.
pg_statistic_extExtended statistics with the ’e’= expression may be output in the stxkind column.
pg_stat_activityInformation of the archiver process and the walsender process will be output. walsender now show their latest replication command. This feature is backported to older versions.
pg_subscription_rel‘f’ = finished table copy may be output in the srsubstate column.
pg_typeThe typtype column may output ’m’ to indicate a multi-range type.
Table 9 System catalogs/views with modified output

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

PDF page 17

Pg_backend_memory_contexts

The pg_backend_memory_contexts view provides a view of the memory context usage of the server process corresponding to the current session. This view can only be viewed by users with the SUPERUSER attribute.

Column nameData typeDescription
nametextName of the memory context.
identtextIdentification information of the memory context.
parenttextName of the parent of this memory context.
levelintegerDistance from TopMemoryContext.
total_bytesbigintTotal bytes allocated for this memory context.
total_nblocksbigintTotal number of blocks allocated for this memory context.
free_bytesbigintFree space in bytes.
free_chunksbigintTotal number of free chunks.
used_bytesbigintUsed space in bytes.
Table 10 Pg_backend_memory_contexts view
Example 9 Query pg_backend_memory_contexts view
postgres=# SELECT name, parent, level, total_bytes FROM
 pg_backend_memory_contexts ;
           name           |       parent       | level | total_bytes
--------------------------+--------------------+-------+------------
TopMemoryContext         |                    |     0 |       68704
 TopTransactionContext    | TopMemoryContext   |     1 |        8192
 Record information cache | TopMemoryContext   |     1 |        8192
 TableSpace cache         | TopMemoryContext   |     1 |        8192
 Type information cache   | TopMemoryContext   |     1 |       24376
 Operator lookup cache    | TopMemoryContext   |     1 |       24576
 RowDescriptionContext    | TopMemoryContext   |     1 |        8192
 MessageContext           | TopMemoryContext   |     1 |       32768
 Operator class cache     | TopMemoryContext   |     1 |        8192
…
Pg_stat_progress_copy

This view will output the execution status of the COPY statement.

PDF page 18

Column nameData typeDescription
pidintegerProcess ID of backend.
datidoidOID of the database
datnamenameName of the database
relidoidOID of the table on which the COPY command is executed.
commandtextCommand name, COPY FROM or COPY TO.
typetextThe IO types.
bytes_processedbigintNumber of bytes already processed.
bytes_totalbigintSize of source file for COPY FROM command.
tuples_processedbigintNumber of tuples already processed.
tuples_excludedbigintNumber of tuples not processed because they were excluded.
Table 11 Pg_stat_progress_copy view
Example 10 Query pg_stat_progress_copy view
postgres=> SELECT * FROM pg_stat_progress_copy ;
-[ RECORD 1 ]---+----------
pid              | 83409
datid            | 13887
datname          | postgres
relid            | 16385
command          | COPY FROM
type             | FILE
bytes_processed  | 22806528
bytes_total      | 138888897
tuples_processed | 1703999
tuples_excluded  | 0
Pg_stat_replication_slots

This view outputs the state of the logical replication slot. To reset the contents of the view, run the pg_stat_reset_replication_slot function.

PDF page 19

Column nameData typeDescription
slot_nametextIdentifier for the replication slot.
spill_txnsbigintNumber of transactions spilled to disk.
spill_countbigintNumber of times transactions were spilled to disk.
spill_bytesbigintAmount of decoded transaction data spilled to disk.
stream_txnsbigintNumber of in-progress transactions streamed.
stream_countbigintNumber of times in-progress transactions.
stream_bytesbigintAmount of decoded in-progress transaction data streamed.
total_txnsbigintNumber of decoded transactions.
total_bytesbigintAmount of decoded transactions data.
stats_resettimestamp with time zonetimestamp with Time at which these statistics were last reset
Table 12 Pg_stat_replication_slots view
Example 11 Query pg_stat_replication_slots view
postgres=> SELECT * FROM pg_stat_replication_slots ;
-[ RECORD 1 ]+----------
slot_name    | sub1
spill_txns   | 3
spill_count  | 9
spill_bytes  | 416939406
stream_txns  | 0
stream_count | 0
stream_bytes | 0
total_txns   | 0
total_bytes  | 0
stats_reset  |
Pg_stat_wal

Only one tuple of WAL output status is output to the pg_stat_wal view. The value of this view can be reset by pg_stat_reset_shared function with ‘wal’ specified. The values of the wal_write_time and wal_sync_time columns are output only when the track_wal_io_timing parameter to ‘on’.

PDF page 20

Column nameData typeDescription
wal_recordsbigintTotal number of WAL records.
wal_fpibigintTotal number of WAL full page images.
wal_bytesnumericTotal amount of WAL generated.
wal_buffers_fullbigintNumber of times WAL data was written to disk because WAL buffers became full
wal_writebigintNumber of times WAL buffers were written.
wal_syncbigintNumber of times WAL files were synced to disk.
wal_write_timedouble precisionTotal amount of time spent writing WAL buffers
wal_sync_timedouble precisionTotal amount of time spent syncing WAL files.
stats_resettimestamp with time zonewith Time at which these statistics were last reset.
Table 13 Pg_stat_wal view
Example 12 Query pg_stat_wal view
postgres=> SELECT * FROM pg_stat_wal ;
-[ RECORD 1 ]----+------------------------------
wal_records      | 52417581
wal_fpi          | 98
wal_bytes        | 4139801371
wal_buffers_full | 341903
wal_write        | 342723
wal_sync         | 876
wal_write_time   | 0
wal_sync_time    | 0
stats_reset      | 2021-10-01 10:21:41.173493+09

3.1.2 Logical Replication

The following features have been added to Logical Replication.

Logical Streaming Replication

Traditional logical replication transfers updates to the subscription instance on every transaction commit. PostgreSQL 14 offers a logical streaming replication feature that transfers data without waiting for the transaction to be committed. For logical streaming replication, set the streaming

PDF page 21

attribute to ‘on’ when creating or modifying SUBSCRIPTION. The default value for the STREAMING attribute is ‘off’.

Example 13 Streaming replication setting
postgres=# CREATE SUBSCRIPTION sub1 CONNECTION 'host=remhost1
dbname=postgres user=postgres password=<<PASSWORD>>'
PUBLICATION pub1 WITH (streaming = on) ;
CREATE SUBSCRIPTION
postgres=# SELECT subname, substream  FROM pg_subscription
WHERE subname = 'sub1' ;
subname | substream
---------+-----------
 sub1    | t
(1 row)
Binary transfer

Traditional logical replication has converted data into text and transfers it. Binary transfer is possible by setting the attribute binary of SUBSCRIPTION to ‘on’. This can be expected to reduce the amount of network transfer. If no attribute is specified, it will be transferred in text format as before.

Example 14 Binary transfer setting
postgres=# CREATE SUBSCRIPTION sub2 CONNECTION 'host=remhost1
dbname=postgres user=postgres password=<<PASSWORD>>'
PUBLICATION pub2 WITH (binary = on) ;
CREATE SUBSCRIPTION
postgres=# SELECT subname, subbinary  FROM pg_subscription
WHERE subname = 'sub2' ;
subname | subbinary
---------+-----------
 sub2    | t
(1 row)

PDF page 22

Separation of initial synchronization and differential update

Data initial synchronization and update information transactions have been separated. This eliminates the need to start over from the initial data synchronization when an error occurs. An additional temporary logical replication slot is required when migrating initial data. The name of this replication slot is “pg_%u_sync_%u_%llu” (SUBSCRIPTION oid, table relid, System ID).

Wait Events

The following wait events can now be confirmed.

Wait Event nameDescription
LogicalChangesReadWaiting for reading from a logical change file.
LogicalChangesWriteWaiting for writing to the logical change file.
LogicalSubxactReadWaiting for a read from a logical sub-transaction file.
LogicalSubxactWriteWaiting to write to a logical sub-transaction file.
Table 14 Added Wait Events
Add Messages

The output plugin accepts a new parameter ‘Messages’ that controls if logical decoding messages are written into the replication stream.

3.1.3 Parallel Query

SELECT part of the REFRESH MATERIALIZED VIEW statement can now be executed in parallel. The example below is a log of the auto_explain module when the REFRESH MATERIALIZED VIEW statement is executed.

Example 15 Execution plan log
LOG:  duration: 6649.485 ms  plan:
        Query Text: REFRESH MATERIALIZED VIEW mview1;
        Gather  (cost=0.00..95721.67 rows=10000000 width=12)
          Workers Planned: 2
          ->  Parallel Seq Scan on data1  (cost=0.00..95721.67
rows=4166667 width=12)

PDF page 23

3.1.4 LZ4 compression of TOAST columns

It is now possible to specify LZ4 as the compression method for TOAST column data. In order to perform LZ4 compression, PostgreSQL with –with-lz4 specified in the option of the ‘configure’ command is required. To specify the compression method for TOAST columns in the CREATE TABLE statement, specify pglz or lz4 in the COMPRESSION clause of the column attribute. The default value is determined by default_toast_compression. In the ALTER TABLE statement (or ALTER MATERIALIZED VIEW statement), the SET COMPRESSION clause can be specified in the column definition change syntax. Changing the compression method with the ALTER TABLE statement does not change the existing tuple.

Example 16 LZ4 compression
postgres=> CREATE TABLE compress1(c1 INT, c2 TEXT COMPRESSION lz4) ;
CREATE TABLE
postgres=> \d+ compress1
                                        Table "public.compress1"
 Column |  Type   | Collation | Nullable | Default | Storage  | Compression | …
--------+---------+-----------+----------+---------+----------+-------------+ …
 c1     | integer |           |          |         | plain    |             | …
 c2     | text    |           |          |         | extended | lz4         | …
Access method: heap
postgres=> ALTER TABLE compress1 ALTER COLUMN c2 SET COMPRESSION pglz ;
ALTER TABLE
postgres=> \d+ compress1
                                        Table "public.compress1"
 Column |  Type   | Collation | Nullable | Default | Storage  | Compression | …
--------+---------+-----------+----------+---------+----------+-------------+ …
 c1     | integer |           |          |         | plain    |             | …
 c2     | text    |           |          |         | extended | pglz        | …
Access method: heap
In the CREATE TABLE (LIKE) statement, specify the "LIKE table name INCLUDING
COMPRESSION" clause to copy the table definition up to the compressed definition. Compression
attribute of each column can be found in the attcompression column of pg_attribute catalog. 'p' is pglz
compression and 'l' is LZ4 compression. To check the compression method of the column, execute the
pg_column_compression function with the column name.

PDF page 24

Example 17 Pg_column_compression function
postgres=> SELECT c1, pg_column_compression(c2) FROM compress1 ;
 c1  | pg_column_compression
-----+-----------------------
 100 | pglz
 200 | lz4
(2 rows)

3.1.5 Execution Plan

The following enhancements have been implemented to the SQL statement execution plan creation feature.

Asynchronous execution

Asynchronous processing can now be executed in ForeignScan processing. Improve performance by running ForeignScan in parallel when accessing data on remote servers. To use this feature, set the async_capable option to ‘on’ in the postgres_fdw module (default value is ‘off’).

Example 18 Asynchronous execution setting
postgres=# CREATE SERVER remsvr1 FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'remhost1', port '5432', dbname 'postgres',
async_capable 'on') ;
CREATE SERVER
It is displayed as Async Foreign Scan in the execution plan. In the example below, the partitions
part1v1 and part1v2 contained in the partition table part1 are implemented as FOREIGN TABLE
respectively.

PDF page 25

Example 19 Execution plan for asynchronous execution
postgres=> EXPLAIN SELECT * FROM part1 ;
                                      QUERY PLAN
---------------------------------------------------------------------------
 Append  (cost=100.00..306.87 rows=2482 width=42)
   ->  Async Foreign Scan on part1v1 part1_1  (cost=100.00..147.23 rows=1241
width=42)
   ->  Async Foreign Scan on part1v2 part1_2  (cost=100.00..147.23 rows=1241
width=42)
(3 rows)
Memoize

The new executor node type named Memoize has been added. The planner can include this node type in the plan to have the executor cache the results from inside the parameterized nested loop join. The use of this execution plan can be controlled by the parameter enable_memoize. The default value is ‘on’. Currently, this execution plan is considered for regular joins and LATERAL type joins.

Example 20 Memoize node
postgres=> EXPLAIN SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1 INNER JOIN
tenk1 t2 ON t1.unique1 = t2.twenty WHERE t2.unique1 < 1000 ;
                                             QUERY PLAN
---------------------------------------------------------------------------
Aggregate  (cost=450.10..450.11 rows=1 width=40)
   ->  Nested Loop  (cost=24.33..445.10 rows=1000 width=4)
         ->  Bitmap Heap Scan on tenk1 t2  (cost=24.04..381.54 …
               Recheck Cond: (unique1 < 1000)
               ->  Bitmap Index Scan on tenk1_unique1  (cost=0.00..23.79 …
                     Index Cond: (unique1 < 1000)
         ->  Memoize  (cost=0.30..1.85 rows=1 width=4)
               Cache Key: t2.twenty
               ->  Index Only Scan using tenk1_unique1 on tenk1 t1  (cost=…
                     Index Cond: (unique1 = t2.twenty)
(10 rows)

PDF page 26

3.1.6 Extended Statistics

It is now possible to define extended statistics on expressions. The pg_stats_ext_exprs system view has been added to reference extended statistics with expressions.

Example 21 Extended statistics using expressions
postgres=> CREATE STATISTICS extstat1_data1 ON MOD(c1, 10),
MOD(c2, 10) FROM data1 ;
CREATE STATISTICS
postgres=> ANALYZE data1 ;
ANALYZE
postgres=> SELECT * FROM pg_stats_ext_exprs ;
-[ RECORD 1 ]----------+-----------------------------------------
schemaname             | public
tablename              | data1
statistics_schemaname  | public
statistics_name        | extstat1_data1
statistics_owner       | demo
expr                   | mod(c1, 10)
null_frac              | 0
avg_width              | 4
…

3.1.7 Data types

The following data types have been added / extended.

Maximum / minimum value of numeric data type

Infinity and -Infinity, which indicate the maximum and minimum values, can now be specified for numeric and float types. The value obtained by dividing a non-zero floating point number by the Infinity value, or the return value of zero when -Infinity is specified for the exp function and power function.

PDF page 27

Example 22 Infinity/-Infinity value
postgres=> CREATE TABLE numeric1(c1 NUMERIC, c2 float) ;
CREATE TABLE
postgres=> INSERT INTO numeric1 VALUES ('Infinity', '-Infinity') ;
INSERT 0 1
postgres=> SELECT * FROM numeric1 WHERE c1='Infinity' ;
    c1    |    c2
----------+-----------
 Infinity | -Infinity
(1 row)
postgres=> SELECT 0.1 / '-Infinity', exp('-Infinity'),
power(2, '-Infinity') ;
 ?column? | exp | power
----------+-----+-------
        0 |   0 |     0
(1 row)
Multirange type

A data type has been provided that indicates multiple ranges that do not overlap. The specific data types are as follows.

Data type nameDescription
datemultirangeDate type range
int4multirangeInt type range
int8multirangeBigint type range
nummultirangeNumeric type range
tsmultirangeTimestamp type range
tstzmultirangeTimestamp with time zone type range
anymultirangeMulti-range pseudo data type
anycompatiblemutirangeAny pseudo-type multiple range type
Table 15 Added data types

The following is an example of range specification by bigint type.

PDF page 28

Example 23 Using multirange type
postgres=> SELECT '{[1, 5), (10, 20]}'::int8multirange ;
int8multirange
-----------------
 {[1,5),[11,21)}
(1 row)
postgres=> SELECT nummultirange( numrange(1, 10, '()'),
numrange(15, 20, '[]')) ;
  nummultirange
------------------
 {(1,10),[15,20]}
(1 row)
Jsonb type

The access method by subscript for jsonb type has been enhanced.

Example 24 Enhancement of jsonb type
postgres=> SELECT ('[1, "2", null]'::jsonb)[1] ;
 jsonb
-------
 "2"
(1 row)
postgres=> SELECT ('{"age": 25}'::jsonb)['age'] ;
 jsonb
-------
 25
(1 row)
postgres=> SELECT ('{"email":"pgsql-hackers@postgresql.org",
"phone":"+3012345678"}'::jsonb) ['phone'] ;
     jsonb
----------------
 "+3012345678"
(1 row)

PDF page 29

Pg_lsn type

It is now possible to perform addition / subtraction calculations using the numeric type for values of the pg_lsn type.

Example 25 Calculation of pg_lsn type
postgres=> SELECT pg_current_wal_lsn(), pg_current_wal_lsn()
+ 256 ;
 pg_current_wal_lsn | ?column?
--------------------+-----------
 0/15D1F88          | 0/15D2088
(1 row)
Point type

The operators («|, »|) that get strictly below/above can now be used for point types.

3.1.8 BRIN indexes

The following operator classes are now available for BRIN indexes.

Bloom Filter

The operator classes “{data type}_bloom_ops” that use Bloom filters have been added. The following attributes can be specified for this operator class.

Attribute nameDescription
n_distinct_per_rangeSpecifies the estimated number of non-null values in the block range. The default value is -0.1.
false_positive_rateSpecifies the desired false positive rate used by the index. The default value is 0.01.
Table 16 Added attributes
Example 26 Using the Bloom filter in the BRIN index
postgres=> CREATE INDEX idx1_data1 ON data1 USING brin
(c1 numeric_bloom_ops (false_positive_rate = 0.05,
 n_distinct_per_range = 100)) ;
CREATE INDEX

PDF page 30

Min/Max-Multi Index

The operator classes “{data type}_minmax_multi_ops” have been added to store multiple minimum and maximum values. The following attributes can be specified for this operator class.

Attribute nameDescription
values_per_rangeSpecifies the maximum number of values to be stored by the index. The default value is 32, and values from 8 to 32 can be specified.
Table 17 Added attribute

3.1.9 Wait Events

The following wait events have been added.

Wait Event nameTypeDescription
AppendReadyIPCWaiting for subplan node preparation.
BaseBackupReadIOWaiting for base backup file to be read.
BufferIOIPCWaiting for buffer I/O to complete.
BufFileTruncateIOWaiting for buffer file truncation.
LogicalChangesReadIOWaiting to read the logical change file.
LogicalChangesWriteIOWaiting to write a logical change file.
LogicalSubxactReadIOWaiting to load a logical subtransaction.
LogicalSubxactWriteIOWaiting for a logical subtransaction to write.
WalReceiverExitIPCWaiting for the WAL receiver process to finish.
Table 18 Added Wait Events

The following wait events have been retyped.

Wait Event nameBeforeAfterNote
WalReceiverWaitStartClientIPC
Table 19 Wait event with changed type

3.1.10 Stored Procedure

The following functions have been added.

PDF page 31

SPI_execute_extended

This API replaces the deprecated SPI_execute_plan_with_paramlist. It is possible to specify the reowner used to fix the execution plan. Syntax

int SPI_execute_extended(const char *src, const SPIExecuteOptions
*options)
SPI_cursor_parse_open

Set up a cursor using a query string and parameters. Syntax

Portal SPI_cursor_parse_open(const char *name, const char *src,
const SPIParseOpenOptions *options)
SPI_scroll_cursor_fetch

Fetch some rows from a cursor Syntax

void SPI_scroll_cursor_fetch(Portal portal, FetchDirection
 direction, long count)

3.1.11 Pg_hba.conf file

By adding a backslash () at the end of a line, a single setting can now be described across multiple lines. The backslash must be the last character on the line.

Example 27 Line breaks in the pg_hba.conf file
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    postgres       postgres       192.168.1.219/32        \
                                                                md5

PDF page 32

3.1.12 LIBPQ library

The following extensions have been implemented in the libpq library.

Connection string target_session_attrs

The following values have been added to the settings of the target_session_attrs parameter.

ValueDescription
read-onlyThe destination database cannot be updated. The opposite of read-write.
primaryConnect to the primary instance of streaming replication.
standbyConnect to a standby instance of streaming replication.
prefer-standbyConnect if a standby instance exists. If the standby instance does not exist, connect to the primary instance.
Table 20 Added setting values
Connection string sslcrldir

It is now possible to set the sslcrldir to specify the CRL storage directory for SSL connections. It can also be specified by the environment variable PGSSLCRLDIR.

Connection string sslsni

Configure Server Name Indication (SNI) for SSL connections. It can also be specified by the environment variable PGSSLSNI.

Pipeline mode

The libpq pipeline mode allows applications to avoid FE/BE protocol synchronization messages implicitly included in the old libpq API after each query. The following functions have been added.

Function nameDescription
PQpipelineStatusReturns the status of the current pipeline mode.
PQenterPipelineModeEnter pipeline mode.
PQexitPipelineModeExit pipeline mode.
PQpipelineSyncRequest pipeline synchronization.
Table 21 Added functions for pipeline mode
Debug log

The PQsetTraceFlags function has been added.

PDF page 33

Sync message

The PQsendFlushRequest function has been added.

3.1.13 ECPG

DECLARE STATEMENT statement can now be specified for ECPG.

Example 28 DECLARE STATEMENT statement
EXEC SQL BEGIN DECLARE SECTION;
    char *selectStr = "SELECT c1 FROM data1";
    long f1;
EXEC SQL END DECLARE SECTION;
int main()
{
    EXEC SQL CONNECT TO postgres USER postgres;
    EXEC SQL DECLARE stmt1 STATEMENT;
    EXEC SQL PREPARE stmt1 FROM :selectStr;
    EXEC SQL DECLARE cur1 CURSOR FOR stmt1;
    EXEC SQL OPEN cur1;
    …
}

3.1.14 Roles

The following roles have been added.

Pg_database_owner

The pg_database_owner role has been added. Members of this role implicitly consist of the database owner. It is usually expected to be used in a template database.

Pg_read_all_data / pg_write_all_data

Added pg_read_all_data role, which allows reading all objects in the database, and pg_write_all_data role, which allows writing.

PDF page 34

3.1.15 Logfile

Additional information is now output to the log file.

Log_autovacuum_min_duration

Detailed information for each index is now output to the automatic VACUUM log (log_autovacuum_min_duration).

Example 29 Index information for automatic VACUUM log
LOG:  automatic vacuum of table "postgres.public.data1": index
scans: 1
        pages: 0 removed, 5406 remain, 0 skipped due to pins, 0
skipped frozen
        tuples: 500000 removed, 500000 remain, 0 are dead but not
yet removable, oldest xmin: 566
        buffer usage: 21775 hits, 0 misses, 1 dirtied
        index scan needed: 5406 pages from table (100.00% of total)
had 500000 dead item identifiers removed
        index "idx1_data1": pages: 2745 in total, 0 newly deleted,
0 currently deleted, 0 reusable
        index "idx2_data1": pages: 2745 in total, 0 newly deleted,
0 currently deleted, 0 reusable
        avg read rate: 20.330 MB/s, avg write rate: 20.239 MB/s
…
Log_connection

Additional information about authentication is output to the connection log (log_connection).

Example 30 Authentication information log at the time of connection
LOG:  connection received: host=192.168.1.219 port=51524
LOG:
connection
authenticated:
identity="demo"
method=md5
(/usr/local/pgsql/data/pg_hba.conf:91)
LOG:
connection
authorized:
user=demo
database=postgres
application_name=psql

PDF page 35

3.1.16 Process name

The information is appended to some process names in the instance.

WAL Receiver

The status is now output to the process name of the wal receiver process.

Example 31 Process name of WAL receiver
$ ps -ef|grep receiver | grep -v grep
postgres  93255  93249  0 14:34 ?        00:00:01 postgres:
walreceiver streaming 0/5D744F8
$
WAL sender

The replication command name is now output to the process name of the WAL sender process for logical replication.

Example 32 Process name of WAL sender
$ ps -ef|grep sender | grep -v grep
postgres  92995  92944  0 14:28 ?        00:00:00 postgres:
walsender postgres [local] START_REPLICATION
$

3.1.17 Regular Expression

The complement-class escapes \D, \S, \W are now allowed within bracket expressions. Also, ‘word’ has been added as a character class. This is the equivalent of \w.

Example 33 &#x27;Word&#x27; character class
postgres=> SELECT 'abc def' ~ '[[:word:]] [[:word:]]' ;
 ?column?
----------
 t
(1 row)

PDF page 36

The languages for text search have been increased. The following languages have been added to PostgreSQL 14.

Language nameDescription
armenianArmenian language
basqueBasque language
catalanCatalan language
hindiHindi language
serbianSerbian language
yiddishYiddish language
Table 22 Added languages

3.1.19 Test module

The PL/Sample module, which can be used as a template for procedure languages, has been added.

PDF page 37

Example 34 PL/Sample module
$ cd src/test/modules/plsample
$ ls -l
total 24
drwxrwxr-x. 2 postgres postgres   26 Sep 28 06:00 expected
-rw-r--r--. 1 postgres postgres  440 Sep 28 05:57 Makefile
-rw-r--r--. 1 postgres postgres  469 Sep 28 05:57 plsample--1.0.sql
-rw-r--r--. 1 postgres postgres 5046 Sep 28 05:57 plsample.c
-rw-r--r--. 1 postgres postgres  177 Sep 28 05:57 plsample.control
-rw-r--r--. 1 postgres postgres  228 Sep 28 05:57 README
drwxrwxr-x. 2 postgres postgres   26 Sep 28 06:00 sql

3.1.20 Maximum password length

The maximum length limit for password strings used for client authentication has been removed.

3.1.21 LLVM

Now supports LLVM 12.