PostgreSQL 15 New Features
PostgreSQL 15 New Features
WITH EXAMPLES · ENGLISH SOURCE EDITION
Explore the features, SQL examples, and compatibility changes documented by Noriyoshi Shinoda.
Contents
Reference indexes
The opening chapter includes the first numbered table, Table 1. The indexes below collect the book’s other native numbered components.
Tables
- Table 1 — Version
- Table 2 — Examples notation
- Table 3 — Syntax rules
- Table 4 — Function name change
- Table 5 — Added system catalogs and views
- Table 6 — System catalogs/views with additional columns
- Table 7 — System catalogs/views with columns removed
- Table 8 — System catalogs/views with modified output
- Table 9 — Pg_ident_file_mappings catalog
- Table 10 — Pg_parameter_acl catalog
- Table 11 — Pg_publication_namespace catalog
- Table 12 — Pg_stat_recovery_prefetch view
- Table 13 — Pg_stat_subscription_stats view
- Table 14 — Added Wait Events
- Table 15 — Added functions
- Table 16 — Added/changed functions
- Table 17 — Added parameters
- Table 18 — Modified Parameters
- Table 19 — Parameters with default values changed
- Table 20 — Removed parameter
- Table 21 — --Target option settings
- Table 22 — --Compress option settings
- Table 23 — Added options
- Table 24 — Available parameters
- Table 25 — Added column
- Table 26 — Added column
- Table 27 — Provided functions
- Table 28 — Available escape sequences
Examples
- Example 1 — Access privileges to the PUBLIC schema
- Example 2 — Execute online backup
- Example 3 — Behavior of PostgreSQL 14
- Example 4 — Behavior of PostgreSQL 15
- Example 5 — Behavior of PostgreSQL 14
- Example 6 — Behavior of PostgreSQL 15
- Example 7 — Behavior of PostgreSQL 14
- Example 8 — Behavior of PostgreSQL 15
- Example 9 — Python 2 only environment
- Example 10 — Execute date_bin function
- Example 11 — Execute the array_to_tsvector function
- Example 12 — Reference to pg_ident_file_mapping view.
- Example 13 — Reference to pg_publication_namespace catalog
- Example 14 — Reference to pg_stat_subscription_stats view
- Example 15 — Grant pg_read_all_stats role
- Example 16 — Column specific replication
- Example 17 — UPDATE statement failure
- Example 18 — Specify WHERE clause
- Example 19 — WHERE clause without replica identity
- Example 20 — Specify the MUTABLE function
- Example 21 — \d command
- Example 22 — Specify IN SCHEMA clause
- Example 23 — Specify the SKIP clause
- Example 24 — Execute CREATE SUBSCRIPTION statement
- Example 25 — Parallel query for SELECT DISTINCT
- Example 26 — WAL compression settings
- Example 27 — Specify the Archive Library
- Example 28 — Execute initdb command
- Example 29 — Execute CREATE DATABASE statement
- Example 30 — List databases
- Example 31 — Shared memory for Statistics information
- Example 32 — GiST index creation for BOOK type
- Example 33 — Grant pg_checkpoint role
- Example 34 — Check WAL resource manager
- Example 35 — Hook definition (src/include/catalog/objectaccess.h)
- Example 36 — Hook definition (src/include/miscadmin.h)
- Example 37 — Negative number for NUMERIC
- Example 38 — Refresh collation version
- Example 39 — Execute ALTER TABLE statement
- Example 40 — Text Format and Header
- Example 41 — Header check
- Example 42 — Clustering of partition tables
- Example 43 — COLLATION_VERSION の指定
- Example 44 — Specify STRATEGY clause
- Example 45 — Specify OID clause
- Example 46 — ON Specify DELETE SET NULL clause
- Example 47 — Create UNIQUE INDEX with NULLS DISTINCT clause
- Example 48 — UNIQUE constraint
- Example 49 — Create UNLOGGED SEQUENCE
- Example 50 — Security_invoker option
- Example 51 — Output of temporary file I/O time
- Example 52 — Execute GRANT ALTER SYSTEM statement
- Example 53 — Execute MERGE statement
- Example 54 — Execute MERGE statement and WITH clause
- Example 55 — Execute VACUUM VERBOSE statement
- Example 56 — Get Logical Replication information
- Example 57 — Execution of regular expression functions
- Example 58 — Execution of the unnest function
- Example 59 — Execution of the pg_size_pretty function
- Example 60 — Execution of the starts_with function
- Example 61 — Execution of the pg_settings_get_flags function
- Example 62 — Specify 'of', 'tzh', 'tzm'
- Example 63 — Execute the poly_distance function
- Example 64 — Create In place tablespace
- Example 65 — JSON format log file
- Example 66 — Output error
- Example 67 — For Zstandard compression
- Example 68 — Execute the \dconfig command
- Example 69 — Execute the \getenv command
- Example 70 — Output the large object access privilege
- Example 71 — Database name qualification
- Example 72 — Specify the compression method
- Example 73 — Specify --two-phase option
- Example 74 — Specify the --compress option
- Example 75 — Command output
- Example 76 — Sequence checking
- Example 77 — Header match check
- Example 78 — Execute the pg_get_wal_stats function
- Example 79 — Specify application name
- Example 80 — Specify parallel_commit option
- Example 81 — Pushed CASE expression
Figures
Source edition
The source chapter order, wording, examples, and publication credits are retained. PDF page markers link the reading edition to the original document. Source identity and coverage · About the collection
1 About This Document
PDF page 5
1.1 Purpose
The purpose of this document is to provide information about the major new features of open-source RDBMS PostgreSQL 15 (15.0).
1.2 Audience
This document is written for engineers who already know PostgreSQL, such as installation, basic management, etc.
1.3 Scope
This document describes the major difference between PostgreSQL 14 (14.5) and PostgreSQL 15 (15.0). As a general rule, this document examines the features of behavior change. This document does not describe and verify all new features. In particular, the following new features are not included.
Bugfix
Performance improvement by changing internal behavior
Improvement of regression test
Operability improvement by psql command tab input
Improvement of pgbench command
Improvement of documentation, modify typo in the source code
Refactoring without a change in behavior
1.4 Software Version
The contents of this document have been verified for the following versions and platforms.
| Software | Version |
|---|---|
| PostgreSQL | PostgreSQL 14.5 (for comparison) PostgreSQL 15 (15.0) (October 10, 2022 21:01:24) |
| Operating System | Red Hat Enterprise Linux 8 Update 6 (x86-64) |
| Configure option | –with-ssl=openssl –with-python –with-lz4 –with-zstd –with-llvm –with-icu |
PDF page 6
1.5 The Question, comment, and Responsibility
The contents of this document are not an official opinion of Hewlett Packard Enterprise Japan, G.K. The author and affiliation company do not take any responsibility for the problem caused by the mistake of contents. If you have any comments for this document, please contact Noriyoshi Shinoda (noriyoshi.shinoda@hpe.com), Hewlett Packard Enterprise Japan, LLC.
1.6 Notation
This document contains examples of the execution of the command or SQL statement. Execution examples are described according to the following rules:
| Notation | Description |
|---|---|
| # | Shell prompt for Linux root user. |
| $ | Shell prompt for Linux general user. |
| Bold | The user input string. |
| postgres=# | psql command prompt for PostgreSQL administrator. |
| postgres=> | psql command prompt for PostgreSQL general user. |
| Underline | Important output items. |
| Underline «PASSWORD» | Important output items. Replaced by password string. |
| … | Indicates that it is omitted. |
The syntax is described in the following rules:
| Notation | Description |
|---|---|
| Italic | Replaced by the name of the object which users use, or the other syntax. |
| [ ] | Indicate that it can be omitted. |
| { A | B } | Indicate that it is possible to select A or B. |
| … | General syntax. It is the same as the previous version. |
2 New Features Summary
PDF page 7
More than 200 new features have been added to PostgreSQL 15. This chapter provides an overview of typical new features and benefits. Details of the new features will be explained in “3. New Feature Detail”.
2.1 Improvements to adapt to large scale environments
The following features have been added that can be applied to large scale environments:
Parallel Query Improvements
Parallel queries now work for SELECT DISTINCT statements.
Improved Compression Method
LZ4 and Zstandard are now available for compressing WALs and base backups. pg_receivewal command compression method has also been added.
Improvements to utilization statistics
The stats collector process has been deprecated, and performance statistics have been changed from communicating using UDP to using a shared memory area.
2.2 Improve reliability
PostgreSQL 15 implements the following enhancements to improve reliability.
Addition of archive library
Archive logging can now be performed by a shared library. The Contrib module basic_archive has been added as a reference implementation.
Checkpoint log
The default value for the log_checkpoints parameter has changed to “on”. The checkpoint execution log will be output by default.
PDF page 8
2.3 Improved maintainability
The following features that can improve operability have been added.
Improvements in logical Replication
Logical Replication has been greatly enhanced in PostgreSQL 15. Logical Replication can now only replicate tuples that meet certain conditions. The conditions for which tuples can be replicated are specified in the WHERE clause of the CREATE PUBLICATION or ALTER PUBLICATION statement. Replication columns can now be selected by specifying a list of columns in addition to the table in the CREATE PUBLICATION statement. Also, updates to specified LSNs can now be skipped.
Monitoring Enhancements
The pg_stat_subscription_stats view has been added to check the status of errors that occur on the subscription worker in Logical Replication environment. Pg_stat_statements module provides information on temporary file I/O times and JITs. information can now be monitored.
Log File Format
Log files can now be output in JSON format.
2.4 Improved in Programming
Added MERGE statement to SQL syntax. The MERGE statement can execute INSERT / UPDATE / DELETE processing at once depending on whether the join conditions of the tables match or not match.
2.5 Preparing for future new features
PostgreSQL 15 is now ready for features that will be provided in future versions.
Change table access method
Added syntax to modify table access methods in the ALTER TABLE and ALTER MATERIALIZED VIEW statements.
PDF page 9
2.6 Incompatibility
In PostgreSQL 15, the following specifications have been changed from PostgreSQL 14.
2.6.1 Access privileges to the PUBLIC schema
Previously, the public schema had CREATE and USAGE privileges for all users (PUBLIC). In PostgreSQL 15, access to the public schema is limited to the database owner (pg_database_owner role). The owner of the public schema has also changed to pg_database_owner. With this change, it will be in the recommended state after CVE-2018-1058.
2.6.2 Exclusive backup mode
The deprecated exclusive backup mode has been removed. Exclusive backup prohibits multiple simultaneous backups. To start an exclusive backup, set the exclusive parameter of the pg_start_backup function to true (default). The function name used to start/end online backup has changed due to the deletion of exclusive backup mode.
PDF page 10
| Operation | PostgreSQL 14 | PostgreSQL 15 | Note |
|---|---|---|---|
| Start backup | pg_start_backup | pg_backup_start | |
| Stop backup | pg_stop_backup | pg_backup_stop | |
| Backup confirmation | pg_is_in_backup | - | Removed |
| Backup start time | pg_backup_start_time | - | Removed |
2.6.3 Psql
The psql command has the following changes related to compatibility.
Supported version of the connected instance
Connections to servers prior to PostgreSQL 9.2 are no longer supported. A warning message will be output when connecting to a server with PostgreSQL 9.2 or earlier.
PDF page 11
Password change
The behavior of the \password command has been changed. Previously, the password of the user specified at login was changed, but the user is determined based on the result of the execution of the SELECT CURRENT_USER statement. This changes the behavior of the SET SESSION AUTHORIZATION statement. In addition, the name of the user to be changed is now displayed at the prompt. This specification change will be backported to the previous version.
Displaying Multiple Results
In previous versions, the psql command would print only the last result if multiple result sets were returned; PostgreSQL 15 prints all results. To change to the same behavior as in the previous version, execute the command \set SHOW_ALL_RESULTS off.
PDF page 12
–Single-transaction option behavior
If the –single-transaction option is specified and an error occurs with the ON_ERROR_STOP variable defined, a ROLLBACK statement is automatically executed.
2.6.4 Literal
Literal strings that begin with a number were previously split into a number part and a string part, but PostgreSQL 15 causes an error.
PDF page 13
2.6.5 ANALYZE
The ANALYZE statement has been changed to use maintenance_io_concurrency instead of effective_io_concurrency for execution. This specification will be backported to PostgreSQL 14.
2.6.6 Python 2
Python 2 support in PL/Python has been removed due to the expiration of Python 2.7 support; Python 2 is rejected when running the ‘configure’ command. Python 3.2 and above is supported.
2.6.7 Date_bin
Negative values can no longer be specified for the interval of the date_bin function. This specification change will be backported to the previous version.
PDF page 14
2.6.8 Pg_amcheck
The –quiet option (short -q) of the pg_amcheck command has been removed. This fix will also be backported to PostgreSQL 14.
2.6.9 Pgcrypto
The proprietary built-in encryption algorithm has been removed and OpenSSL is now required.
2.6.10 Pg_dump / pg_dumpall
Removed the upgrade feature from versions prior to PostgreSQL 9.2. Also, the –no-synchronizedsnapshots option has been removed.
2.6.11 Pg_upgrade
Removed the upgrade feature from versions prior to PostgreSQL 9.2.
2.6.12 Postmaster
The postmaster startup option –forkboot has been changed to –forkaux.
2.6.13 Array_to_tsvector
Disallow making an empty lexeme via array_to_tsvector function.
PDF page 15
2.6.14 Xml2
The xml_is_well_formed function has been removed from the Contrib module xml2.
2.6.15 Pipeline mode
Removed support for PQsendQuery function in pipeline mode. Use the PQsendQueryParams function instead.
2.6.16 Extension
CREATE OR REPLACE statements for existing objects are disallowed unless they already belong to the extension.
PDF page 16
3 Architecture
PDF page 16
3.1.1 Modified System catalogs
The following catalogs have been changed.
| 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. |
| 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 |
PDF page 17
| Catalog name | Column name | Description |
|---|---|---|
| pg_database | datlastsysoid | Removed because not used |
| 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
This is a view for searching the contents of the pg_ident.conf file from SQL statements.
PDF page 18
| 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 |
Pg_parameter_acl catalog
The catalog records configuration parameters for which privileges have been granted to one or more roles.
| 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
Information is stored when the FOR TABLE IN SCHEMA clause is specified in the CREATE PUBLICATION statement. Provides a mapping between PUBLICATION and SCHEMA.
| Column name | Data type | Description |
|---|---|---|
| oid | oid | Row identifier |
| pnpubid | oid | Reference to PUBLICATION |
| pnnspid | oid | Reference to SCHEMA |
PDF page 19
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.
| 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
The pg_stat_subscription_stats view contains error information about logical replication subscription workers.
PDF page 20
| 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 |
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.
PDF page 21
3.1.2 Logical Replication Enhancements
The following features have been added to Logical Replication.
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.
Row filtered replication
By specifying the WHERE clause in the CREATE PUBLICATION statement or the ALTER
PDF page 22
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.
PDF page 23
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.
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
PDF page 24
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
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.
PDF page 25
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.
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
The SELECT DISTINCT statement can now work with parallel queries.
PDF page 26
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.
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.
PDF page 27
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.
PDF page 28
PDF page 29
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.
PDF page 30
3.1.8 GiST Index
The following enhancements have been implemented to the GiST index:
Index statistics
Access to the SP-GiST index is now counted in the pg_stat_ * views.
BOOL type
It is now possible to create an index for a Boolean type.
3.1.9 Wait Events
The following wait events have been added.
| 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 |
PDF page 31
The wait events PgStatMain, LogicalChangesRead, LogicalChangesWrite, LogicalSubxactRead, and LogicalSubxactWrite have been removed.
3.1.10 Role
The predefined role pg_checkpoint has been added. This role holder can execute the CHECKPOINT statement.
3.1.11 Libpq
The following enhancements have been implemented in the Libpq API:
Environment variable PG_COLORS
It is now possible to specify ’note’ in the color specification item of the terminal output.
PQsslAttribute
The PQsslAttribute(NULL, “library”) function can now be executed to obtain the name of the library in use.
PDF page 32
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
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
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.
3.1.13 Hook
The following hooks have been added.
String object access
Added an access hook for string objects. Executed when accessing the GUC string.
PDF page 33
Shared memory request
It must be specified from within the _PG_init function when the extension module gets the shared memory.
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
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
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
PDF page 34
This specification will also be backported to older versions.
3.1.16 Dynamic Shared Memory
Dynamic Shared Memory (DSM) is now also available in single user mode.
4 SQL Statements
PDF page 35
This section explains new features related to SQL statements.
3.2.1 NUMERIC data type
Negative numbers can now be specified for NUMERIC type scales. If a negative number is specified, it will be rounded to the specified digit. Also, the range of values that can be specified for the scale has been extended from -1,000 to 1,000.
PDF page 36
3.2.2 ALTER DATABASE
The syntax for tracking the version of a collation has been added to the ALTER DATABASE statement. Syntax
Added a new function pg_database_collation_actual_version to get the collation version and a datcollversion column for the version in the pg_database view. If it detects that the collation version of the database is different from the operating system, a warning will be output when connecting to the corresponding database. Below is an example of migration from Red Hat Enterprise Linux 7.8 to Red Hat Enterprise Linux 8.6.
3.2.3 ALTER TABLE
The SET ACCESS METHOD clause can now be specified in ALTER TABLE statements that change the access method for a table; the SET ACCESS METHOD clause can also be specified in ALTER MATERIALIZED VIEW statements.
PDF page 37
Syntax
ALTER TABLE table_name SET ACCESS METHOD method_name
ALTER MATERIALIZED VIEW view_name SET ACCESS METHOD method_name
3.2.4 COPY
The following enhancements have been added to the COPY statement.
COPY TO statement
The format ’text’ and header ’true’ can now be used simultaneously in the COPY TO statement options. At the same time, the file_fdw extension can now enable headers in text format.
PDF page 38
COPY FROM statement
The HEADER option can now be specified as ‘match’. When this option is specified, COPY FROM checks that the header row and column names match when the COPY FROM statement is executed. In the example below, the first row of the CSV file and the column names in the table are different, resulting in an error.
3.2.5 CLUSTER
The CLUSTER statements can now be executed on partitioned tables.
3.2.6 CREATE DATABASE
The following enhancements have been implemented for the CREATE DATABASE statement
ICU Locale
The CREATE DATABASE statement now includes a LOCALE_PROVIDER clause to specify the locale provider, an ICU_LOCALE clause to specify the ICU locale, and a COLLATION_VERSION clause to specify the collation version.
PDF page 39
STRATEGY clause
The STRATEGY clause has been added to the CREATE DATABASE statement to specify how the database should be created; specifying WAL_LOG in the STRATEGY clause will cause the new database to be copied from the template block by block, with information for each block output to WAL. This is an effective method when the template is small and is the default value. Specify FILE_COPY to perform the behavior of the previous version.
OID clause
The object ID (OID) of the database to be created can now be specified; the OID can be any free number greater than 16384.
3.2.7 CREATE TABLE
Column lists can now be specified in the ON DELETE SET NULL and SET DEFAULT clauses of foreign key definitions in CREATE TABLE and ALTER TABLE statements. In the previous version, it was not possible to specify columns. The confdelsetcols column has been added to the pg_constraint catalog.
PDF page 40
3.2.8 CREATE UNIQUE INDEX
It is now possible to specify NULLS DISTINCT and NULLS NOT DISTINCT for the unique index attribute. Multiple null values can be stored in a unique index with the NULLS DISTINCT clause. If nothing is specified, the NULLS DISTINCT specification is the default. An index with the NULLS NOT DISTINCT clause cannot contain multiple null values. An indnullsnotdistinct column has been added to the pg_index catalog to indicate this attribute. Syntax
CREATE UNIQUE INDEX index_name ON … NULLS [NOT] DISTINCT
CONSTRAINT constraint_name NULLS [NOT] DISTINCT
PDF page 41
3.2.9 CREATE SEQUENCE
The UNLOGGED clause can now be specified in the CREATE SEQUENCE statement to suppress WAL output. The sequence created by the CREATE UNLOGGED SEQUENCE statement has the repersistence column in the pg_class catalog as ‘u’. The attributes of the sequence can be changed with the ALTER SEQUENCE SET LOGGED statement or the ALTER SEQUENCE SET UNLOGGED statement.
PDF page 42
3.2.10 CREATE VIEW
The security_invoker option has been added to the CREATE VIEW statement. By default, access to the table from which the view is based is enforced with the privileges of the view owner. When the security_invoker option is set to True for a view, access to the table is subject to the privileges of the user accessing the view. This option can also be specified in the ALTER VIEW statement. Syntax
CREATE VIEW view_name WITH (security_invoker = true|false) AS sql_clause
ALTER VIEW view_name SET (security_invoker = true|false)
ALTER VIEW view_name RESET (security_invoker)
PDF page 43
3.2.11 EXPLAIN
I/O time for temporary files is now output when BUFFERS and VERBOSE are specified in JSON format.
3.2.12 GRANT
Roles can now be granted permission to change specific parameters through the ALTER SYSTEM statement. Syntax
PDF page 44
3.2.13 MERGE
The MERGE statement that simultaneously executes INSERT / DELETE / UPDATE statements on a table from a join condition is now supported. Tuples matching the join condition can be specified in the WHEN MATCHED clause to update (UPDATE) or delete (DELETE) or do nothing (DO NOTHING). Additional conditions may be specified. The behavior of tuples that do not match the condition is specified in the WHEN NOT MATCHED clause. Syntax
PDF page 45
3.2.14 VACUUM
The execution log of the VACUUM VERBOSE statement has changed significantly. Average read rate, buffer usage, WAL output information, etc. have been added. Details on how pg_class.relfrozenxid and pg_class.relminmxid have progressed are also now reported.
PDF page 46
3.2.15 Functions
The following functions have been added/extended.
MAX / MIN
MAX function and MIN function for xid8 type have been implemented.
Replication related functions
The following function to get replication information has been added. These functions can be executed by a user with the SUPERUSER attribute or the pg_monitor role.
| Function name | Description |
|---|---|
| pg_ls_logicalmapdir | Returns information in the pg_logical/mappings directory |
| pg_ls_logicalsnapdir | Returns information in the pg_logical/snapshots directory |
| pg_ls_replslotdir | Returns information in the pg_replslot/SLOTNAMEdirectory |
PDF page 47
Pg_log_backend_memory_contexts
The check for SUPERUSER permission has been removed, and it can now be used by general users by granting permission using the GRANT statement.
Regular expression functions
The regexp_count, regexp_instr, and regexp_substr have been added as functions that handle regular expressions. Parameters that can be specified have been added to the regexp_replace function.
PDF page 48
| Function name | Description |
|---|---|
| regexp_count | Returns the number of times the pattern is matched. |
| regexp_instr | Returns the location that matches the pattern. |
| regexp_like | Returns whether it matches the pattern. |
| regexp_replace | Replace the part that matches the pattern. Added start and flags options. |
| regexp_substr | Returns the part that matches the pattern. |
Syntax
- integer REGEXP_COUNT (string text, pattern text [, start integer [, flags
- integer REGEXP_INSTR (string text, pattern text [, start integer [, N integer
boolean REGEXP_LIKE (string text, pattern text [, flags text ])
text REGEXP_REPLACE (string text, pattern text, replace text start integer,
- text REGEXP_SUBSTR (string text, pattern text [, start integer [, N intger
PDF page 49
Unnest
The MULTIRANGE type can now be specified for UNNEST functions. Syntax
PDF page 50
Pg_size_bytes / pg_size_pretty
It now supports up to petabytes.
Starts_with
The starts_with function can now use BTREE indexes. At the same time, the ^@ operator will do the same.
Pg_settings_get_flags
Attribute information of GUC is returned as an array of text. If a non-existent GUC name is specified, NULL is returned.
PDF page 51
Time specified character string
OF, TZH and TZM can now be used in lowercase.
Poly_distance
The poly_distance function has been implemented. This function existed in previous versions, but when executed it returned an ERRCODE_FEATURE_NOT_SUPPORTED error.
5 Configuration Parameters
PDF page 52
In PostgreSQL 15 the following parameters have been changed.
3.3.1 Added parameters
The following parameters have been added.
| Parameter name | Description (context) | Default value |
|---|---|---|
| allow_in_place_tablespaces | Developer parameters to create a tablespace in the pg_tblspc directory (superuser) | off |
| archive_library | WAL archive library name (sighup) | - |
| log_startup_progress_interval | Time before startup process outputs log if the long-running process occurs (sighup) | 10s |
| recovery_prefetch | Whether WAL prefetching is performed during recovery (sighup) | try |
| recursive_worktable_factor | Multiplier to determine work table size for recursive queries (user) | 10 |
| shared_memory_size | The calculated size of main shared memory (internal) | - |
| shared_memory_size_in_huge_pages | Number of Huge Pages pages used for shared memory (internal) | - |
| stats_fetch_consistency | Determines the behavior when cumulative statistics are accessed multiple times (user) | cache |
| wal_decode_buffer_size | Buffer size for WAL decoding (postmaster) | 512kB |
allow_in_place_tablespaces
Tablespaces can be created in a database cluster by setting this parameter to on and specifying an empty string (’’) in the LOCATION clause of the CREATE TABLESPACE statement.
PDF page 53
3.3.2 Modified Parameters
The following parameters have been changed in terms of setting range and choices.
| Parameter name | Changes |
|---|---|
| compute_query_id | Regress can now be specified as a configuration value. This is used to facilitate regression testing. |
| dynamic_shared_memory_type The default value on Solaris has changed to “sysv”. | dynamic_shared_memory_type The default value on Solaris has changed to “sysv”. |
| log_destination | Jsonlog can now be specified as a configuration value to output logs in JSON format. This change will also be backported to PostgreSQL 14.3 and later. |
| wal_compression | Pglz, lz4, and zstd compression methods can now be specified. The configuration value on is assumed to be pglz. |
| shared_preload_libraries | Now also processed in single user mode. |
JSON format log file
If jsonlog is specified for the parameter log_destination, the log file will be output in JSON format. The file extension is .json. A file with a .log extension is also created that outputs only some information.
PDF page 54
3.3.3 Parameters with default values changed
The following parameters have changed default values.
| Parametername | PostgreSQL14 | PostgreSQL15 | Note |
|---|---|---|---|
| hash_mem_multiplier | 1.0 | 2.0 | |
| log_autovacuum_min_durationlog_checkpoints | -1 | 10min | |
| off | on | ||
| server_version | 14.5 | 15.0 | |
| server_version_num | 140005 | 150000 |
3.3.4 Removed parameter
The following parameter have been removed.
PDF page 55
| Parameter name | Reason |
|---|---|
| stats_temp_directory | It was removed due to the shared memory of statistics. |
3.3.5 Error when changing parameters
Some extension modules (auto_explain, pg_prewarm, pg_stat_statements, plperl, plpgsql) now generate errors when attempting to set parameters that do not exist after loading the module.
6 Utilities
PDF page 56
Describes the major enhancements of utility commands.
3.4.1 Configure
Added –with-zstd option to support Zstandard compression method. Zstandard 1.4.0 and above are supported.
3.4.2 Psql
The following enhancements have been implemented in the psql command.
Environment variable PSQL_WATCH_PAGER
The environment variable PSQL_WATCH_PAGER, which specifies the pager to be displayed when the \watch command is executed, is now available.
\Dconfig command
The \dconfig command can display the parameter settings of the instance. If no option is specified, a list of parameters that have changed from the default values is displayed. If a parameter name is specified, the specific parameter setting value can be checked. Wildcards can be used for parameter names. Syntax
PDF page 57
\Getenv command
Added the \getenv command to get environment variables. Specify the psql variable name and environment variable name to store the variable value. Specifying an environment variable name that does not exist does not cause an error. Syntax
PDF page 58
Comments in SQL statements
Comments with two hyphen (-) in SQL statements are now sent to the backend. Previously it was removed before sending to the backend.
Large Object output
Access privileges are now output to the \dl+ command and \lo_list+ command.
PDF page 59
Specifying a database name
When specifying a table name with the \d command, etc., use “database_name.schema_name.table_name” format is allowed. However, the “database_name” part is valid only for the currently connected database. If other database names are specified, an error message will be displayed.
Output of multiple SQL
PostgreSQL 15 displays all results if the server returns multiple result sets. This behavior can be changed with the “\set SHOW_ALL_RESULTS off” command.
3.4.3 Pg_amcheck
The –install-missing option has been added. If this option is specified, the amcheck extension will be installed automatically if it is not installed.
3.4.4 Pg_basebackup
The following options have been added / extended to the pg_basebackup command.
–Target option
The –target option to specify the output destination has been added. This option uses a new data transfer protocol (BASE_BACKUP TARGET). The following formats can be specified Specifying
PDF page 60
server as the output destination allows base backups to be output to a server running a PostgreSQL instance. Server-side backups can be performed by a user with the SUPERUSER or pg_write_server_files roles.
| blackhole | Nothing is output. Test options |
|---|---|
| server:/path | Output to the specified directory on the server. Currently, the output format is tar (output to /path in the example on the left). |
| shell[:DETAIL] | Execute a shell command. |
Target Description
The –wal-method option must be set to “fetch” or “none” to make this specification. When “shell” is specified in the –target option, it is necessary to set the Contrib module basebackup_to_shell.
–Compress option
The –compress option can now specify the compression method and compression level, whereas the previous version specified the compression level. The compression level is specified by specifying “level=number” after a colon (:); for Zstandard compression, the “workers=number” option for parallel processing can also be set. The same notation as in previous versions is also available for compatibility. If server-side compression (server-gzip) is specified for plain format (-Fp), only the transferred data will be compressed and decompressed and stored on the client side. This setting is useful when network bandwidth is small.
| Setting | Description | Note |
|---|---|---|
| none | Do not compress | |
| gzip | Gzip compression on the client if not targeted | |
| lz4 | LZ4 compression on the client if not targeted | |
| zstd | Zstandard compression on the client if not targeted | |
| client-gzip | Gzip compression on the client side | |
| server-gzip | Gzip compression on the server side | |
| client-lz4 | LZ4 compression on the client side | |
| server-lz4 | LZ4 compression on the server side | |
| client-zstd | Zstandard compression on the client side | |
| server-zstd | Zstandard compression on the server side |
PDF page 61
3.4.5 Pg_dump
The following enhancements have been implemented for the pg_dump command.
–No-table-access-method option
The –no-table-access-method option can now be specified to remove table access methods from the output DDL. This option is ignored if the dump file is output in non-text format. The same option can also be specified for the pg_dumpall and pg_restore commands.
Consideration of TOAST data volume
The pg_dump command takes into account the table size when running in parallel mode; PostgreSQL 15 now also takes into account the amount of TOAST data.
3.4.6 Pg_recvlogical
The –two-phase (or -t) option has been added to the pg_recvlogical command to support the addition of the TWO_PHASE option to the CREATE_REPILICATION_SLOT command for the replication protocol.
3.4.7 Pg_receivewal
The –compress option, which specifies how to compress the logs, has changed. Compression method, level, etc. can be specified.
PDF page 62
Syntax
Valid values for compression are gzip, lz4 or none. An optional compression level (level) can be specified. The range of compression levels is 1-9.
3.4.8 Pg_resetwal
The –oldest-transaction-id option (short form -u) has been added to specify the oldest transaction ID.
3.4.9 Pg_rewind
Added the –config-file option to specify the path to the server configuration file (postgresql.conf). This option is useful when the configuration file is outside the data directory.
3.4.10 Pg_upgrade
The following enhancements have been implemented for the pg_upgrade command
PDF page 63
–No-sync option
The –no-sync option (short form -N) has been added. When this option is specified, it does not wait for the completion of file writing. This is not to be used in a production environment.
Temporary Directories
Temporary files created during the upgrade will be created in the pg_upgrade_output.d directory of the new database cluster.
3.4.11 Pg_waldump
Options
The following options have been added Multiple –rmgr options can now be specified.
| Option name | Short option | Description |
|---|---|---|
| –block=N | -B | Show the block of relations specified by the –relation option |
| –fork=N | -F | Show only forks with matching numbers |
| –relation=tblspc/db/rel | -R | Show only information about the relevant relationship |
| –fullpage | -w | Show only Full page write information |
Signal
When the SIGINT signal is received and the process ends, summary information is output.
Addition of output information
The remote_apply information of transaction commit and the replication origin information of PREPARE TRANSACTION are added to the command output.
PDF page 64
7 Contrib Modules
PDF page 65
Describes new features related to the Contrib modules.
3.5.1 Amcheck
A sequence checking is now supported.
3.5.2 Basebackup_to_shell
This module is used when “shell” is specified as the target of the base backup. When using this module, specify basebackup_to_shell in the parameter shared_preload_libraries or local_preload_libraries. The following parameters can be specified:
| Parameter name | Description |
|---|---|
| basebackup_to_shell.command | Command path to be executed |
| basebackup_to_shell.required_role | Roles required for execution |
3.5.3 File_fdw
The MATCH value can now be specified in the HEADER option of the CREATE FOREIGN TABLE statement. This option checks for a match between the header line and column name in the text file.
PDF page 66
3.5.4 Pg_stat_statements
The pg_stat_statements view has additional items that can be monitored.
I/O information for temporary files
Read/write times for temporary files can now be monitored. The following columns have been added to the pg_stat_statements view.
| Column name | Data type | Description |
|---|---|---|
| temp_blk_read_time | double precision | Temporary block read time |
| temp_blk_write_time | double precision | Temporary block write time |
Addition of JIT-related information
JIT-related information can now be monitored; the following columns have been added to the pg_stat_statements view.
PDF page 67
| Column name | Data type | Description |
|---|---|---|
| jit_functions | bigint | Number of JIT-compiled function executions |
| jit_generation_time | double precision | JIT code generation time (milliseconds) |
| jit_inlining_count | bigint | Number of executions of inlined function |
| jit_inlining_time | double precision | Execution time of inlined function (milliseconds) |
| jit_optimization_count | bigint | Optimized statement execution count |
| jit_optimization_time | double precision | Optimized statement execution time (milliseconds) |
| jit_emission_count | bigint | Number of times the code was issued |
| jit_emission_time | double precision | Time (milliseconds) the code was used to issue |
3.5.5 Pg_walinspect
The pg_walinspect module is a module for executing processing similar to the pg_waldump command with SQL statements. The following functions are provided. These functions can only be executed by users with the SUPERUSER attribute or the pg_read_server_files role.
| Function name | Description |
|---|---|
| pg_get_wal_record_info | Return WAL information for the specified LSN |
| pg_get_wal_records_info | Return WAL information between specified LSNs |
| pg_get_wal_records_info_till_end_of_wal | Return WAL information from the specified LSN to the end |
| pg_get_wal_stats | Return WAL statistics between specified LSNs |
| pg_get_wal_stats_till_end_of_wal | Return WAL statistics from the specified LSN to the end |
PDF page 68
3.5.6 Postgres_fdw
The following enhancements have been implemented in postgres_fdw:
Specifying the application name
It is now possible to specify application_name for a remote connection. Change the postgres_fdw.application_name parameter.
PDF page 69
| Escape sequence | Description | Note |
|---|---|---|
| %a | Local application name | |
| %c | Session ID | |
| %C | Cluster name (cluster_name) | |
| %d | Local database name | |
| %p | Backend process ID | |
| %u | Local user name | |
| %% | % character |
Parallel_commit option
Added the parallel_commit option to control how remote transaction commits are executed. Setting this option to ‘on’ allows remote transaction commits in parallel. The default value is off, which causes commits to be executed serially.
CASE expression
CASE expressions are now pushed to remote instances.
PDF page 70
3.5.7 Sepgsql
The permissive/enforcing state has been added to the log, with permissive=0 or permissive=1 output at the end of the line.
8 URL List
The links in this chapter are preserved from the source PDF’s URL list.
PDF page 71
9 Change History
This chapter preserves the source document’s revision history and publication credits.
PDF page 72
Change history
| Version | Date | Author | Description |
|---|---|---|---|
| 0.1 | Apr 25, 2022 | Noriyoshi Shinoda | Create an internal review version. Reviewers: Tomoo Takahashi Akiko Takeshima (Hewlett Packard Enterprise Japan) |
| 1.0 | May 24, 2022 | Noriyoshi Shinoda | Modification completed according to PostgreSQL 15 Beta 1. |
| 1.1 | Oct 14, 2022 | Noriyoshi Shinoda | Fixed for PostgreSQL 15 GA |