+ The above items are explained in more detail in the sections below.
+
+
+
+
+
+
+ Migration to Version 13
+
+
+ A dump/restore using or use of
+ linkend="pgupgrade"/> or logical replication is required for those
+ wishing to migrate data from any previous release. See
+ linkend="upgrading"/> for general information on migrating to new major
+ releases.
+
+
+
+ Version 13 contains a number of changes that may affect compatibility
+ with previous releases. Observe the following incompatibilities:
+
+
+
+
+
+
+
+
+Change SIMILAR TO ... ESCAPE NULL to return NULL (Tom Lane)
+
+
+
+This new behavior matches the SQL specification. Previously this caused the escape to be set to the default backslash character. The previous behavior has been retained in old views by keeping the
+original function unchanged. This also applies to substring(text FROM pattern ESCAPE text).
+In ltree, when using adjacent asterisks with braces, e.g. "*{2}.*{3}", properly interpret that as "*{5}" (Nikita Glukhov)
+
+
+
+
+
+
+
+
+Change the way non-default effective_io_concurrency values affect concurrency (Thomas Munro)
+
+
+
+Previously, this value was adjusted before effecting the number of concurrent requests. This value is now used directly. Conversion of old values to new ones can be done using:
+
+
+
+ SELECT round(sum(OLD / n::float)) FROM generate_series(1, OLD) s(n);
+
+
+
+
+
+
+
+
+Prevent display of auxiliary processes in pg_stat_ssl and pg_stat_gssapi system views (Euler Taveira)
+
+
+
+Queries that join these views to pg_stat_activity and wish to see auxiliary processes will need to use left joins.
+
+
+
+
+
+
+
+
+Fix pageinspect's bt_metap() to return more appropriate data types that are less likely to overflow (Peter Geoghegan)
+
+
+
+
+
+
+
+
+Rename some recovery-related wait events (Fujii Masao)
+
+
+
+Rename RecoveryWalAll to RecoveryWalStream and RecoveryWalStream to RecoveryRetrieveRetryInterval.
+
+
+
+
+
+
+
+
+Fix ALTER FOREIGN TABLE ... RENAME COLUMN to return a more appropriate command tag (Fujii Masao)
+
+
+
+Previously it returned "ALTER TABLE", but now returns "ALTER FOREIGN TABLE".
+
+
+
+
+
+
+
+
+Fix ALTER MATERIALIZED VIEW ... RENAME COLUMN to return a more appropriate command tag (Fujii Masao)
+
+
+
+Previously it returned "ALTER TABLE", but now returns "ALTER MATERIALIZED VIEW".
+
+
+
+
+
+
+
+
+Remove support for defining operator classes using pre-Postgres 8.0 syntax (Daniel Gustafsson)
+
+
+
+
+
+
+
+
+Remove support for defining foreign key constraints using pre-Postgres 7.3 syntax (Daniel Gustafsson)
+
+
+
+
+
+
+
+
+Remove support for "opaque" pseudo-types used by pre-Postgres 7.3 servers (Daniel Gustafsson)
+
+
+
+
+
+
+
+
+
+ Changes
+
+
+ Below you will find a detailed account of the changes between
+ PostgreSQL 13 and the previous
+ major release.
+
+
+
+ Server
+
+
+ Partitioning
+
+
+
+
+
+
+
+Improve cases where pruning of partitions can happen (Amit Langote, Yuzuko Hosoya, Álvaro Herrera)
+
+
+
+
+
+
+
+
+Allow partitionwise joins to happen in more cases (Ashutosh Bapat, Etsuro Fujita, Amit Langote)
+
+
+
+
+
+
+
+
+Allow BEFORE row-level triggers on partitioned tables (Alvaro Herrera)
+
+
+
+These triggers cannot change the destination partition.
+
+
+
+
+
+
+
+
+Allow logical replication to replicate partitioned tables (Amit Langote)
+
+
+
+
+
+
+
+
+Allow partitioned tables to be added to replicated publications (Amit Langote)
+
+
+
+Partition additions/removals are replicated as well. Previously, partitions had to be replicated individually. HOW IS THIS DIFFERENT FROM THE ITEM ABOVE?
+
+
+
+
+
+
+
+
+Allow CREATE PUBLICATION to control whether partitioned tables are published as themselves or their ancestors (Amit Langote)
+
+
+
+The option is publish_via_partition_root.
+
+
+
+
+
+
+
+
+Allow ROW values to be used as partitioning expressions (Amit Langote)
+
+
+
+
+
+
+
+
+
+ Indexes
+
+
+
+
+
+
+
+More efficiently store duplicates in btree indexes (Anastasia Lubennikova, Peter Geoghegan)
+
+
+
+
+
+
+
+
+Allow GiST and SP-GiST indexes for box/point distance lookups (Nikita Glukhov)
+
+
+
+
+
+
+
+
+Allow index operator classes to take parameters (Nikita Glukhov)
+
+
+
+
+
+
+
+
+Allow CREATE INDEX to specify the GiST signature length and maximum number of integer ranges (Nikita Glukhov)
+
+
+
+
+
+
+
+
+Prevent indexes that use non-default collations from being added as a table's unique or primary key constraint (Tom Lane)
+
+
+
+The index and column collations must now match so the index's uniqueness matches the column's uniqueness.
+
+
+
+
+
+
+
+
+
+
+ Optimizer
+
+
+
+
+
+
+
+Improve the optimizer's selectivity estimation for containment/match operators (Tom Lane)
+
+
+
+
+
+
+
+
+Allow setting statistics target for extended statistics (Tomas Vondra)
+
+
+
+This is controlled with the new command option ALTER STATISTICS ... SET STATISTICS. Previously this was computed based on more general statistics target settings.
+
+
+
+
+
+
+
+
+Allow use of multiple extended statistics objects in a single query (Tomas Vondra)
+
+
+
+
+
+
+
+
+Allow use of extended statistics objects for OR clauses and IN/ANY constant lists (Pierre Ducroquet, Tomas Vondra)
+
+
+
+
+
+
+
+
+Allow functions in FROM clauses to be moved to their reference sites if they evaluate to constants (Alexander Kuzmenkov, Aleksandr Parfenov)
+
+
+
+
+
+
+
+
+
+
+ General Performance
+
+
+
+
+
+
+
+Allow incremental sorting (James Coleman, Alexander Korotkov)
+
+
+
+If a result is already sorted by several keys, this allows for batch sorting of additional trailing keys because the previous keys are already equal. This is controlled by enable_incrementalsort.
+
+
+
+
+
+
+
+
+Improve the performance of sorting inet values (Brandur Leach)
+
+
+
+
+
+
+
+
+Allow hash aggregation to use disk storage for large aggregation result sets (Jeff Davis)
+
+
+
+Previously, hash aggregation was not used if it was expected to use more than work_mem memory. This is controlled by enable_hashagg_disk.
+
+
+
+
+
+
+
+
+Allow grouping sets to use hash aggregation with disk storage for large grouping set results (Jeff Davis)
+
+
+
+Previously, hash aggregation was not used if it was expected to use more than work_mem memory. This is controlled by enable_hashagg_disk.
+WHAT USED TO HAPPEN?
+
+
+
+
+
+
+
+
+Allow inserts to trigger autovacuum activity (Laurenz Albe, Darafei Praliaskouski)
+
+
+
+This new behavior sets pages as all-visible, allowing for index-only scans, and reduces the work necessary when the table needs to be frozen.
+
+
+
+
+
+
+
+
+Add maintenance_io_concurrency to control I/O concurrency for maintenance operations (Thomas Munro)
+
+
+
+
+
+
+
+
+Allow skipping of WAL for new tables and indexes if wal_level is 'minimal' (Noah Misch)
+
+
+
+This is controlled by GUC wal_skip_threshold.
+
+
+
+
+
+
+
+
+Enable Unix-domain sockets support on Windows (Andrew Dunstan)
+
+
+
+
+
+
+
+
+Improve the performance of replay of DROP DATABASE commands that use many tablespaces (Fujii Masao)
+
+
+
+
+
+
+
+
+Improve performance for truncation of very larger relations (Kirk Jamison)
+
+
+
+
+
+
+
+
+Improve retrieving of only the leading bytes of TOAST values (Binguo Bao)
+
+
+
+Previously, TOAST values were fully fetched and only the requested leading bytes were decompressed and returned. Now, only the requested bytes are fetched.
+
+
+
+
+
+
+
+
+Improve performance of LISTEN/NOTIFY (Martijn van Oosterhout)
+
+
+
+
+
+
+
+
+Improve the efficiency of removing duplicate NOTIFY events (Tom Lane)
+
+
+
+
+
+
+
+
+Use lookup tables to speed up integer to text conversion (David Fetter)
+
+
+
+
+
+
+
+
+Reduce memory usage for query strings that contain multiple SQL statements (Amit Langote)
+
+
+
+
+
+
+
+
+
+
+ Monitoring
+
+
+
+
+
+
+
+Allow EXPLAIN, auto_explain, autovacuum, and pg_stat_statements to track WAL usage statistics (Kirill Bychik, Julien Rouhaud)
+
+
+
+
+
+
+
+
+Allow a sample of statements to be logged (Adrien Nayrat)
+
+
+
+A log_statement_sample_rate ratio of statements taking over log_min_duration_sample duration will be logged.
+
+
+
+
+
+
+
+
+Add the backend type to csvlog and optionally log_line_prefix log output (Peter Eisentraut)
+
+
+
+
+
+
+
+
+Improve control of prepared statement parameter logging (Alexey Bashtanov, Álvaro Herrera)
+
+
+
+The GUC setting log_parameter_max_length controls the maximum length of parameter values output during statement logging, and log_parameter_max_length_on_error allows parameters to be output on
+This combines existing options LC_COLLATE and LC_CTYPE into a single option.
+
+
+
+
+
+
+
+
+Allow DROP DATABASE to disconnect users so drop succeeds (Pavel Stehule, Amit Kapila)
+
+
+
+This is enabled by WITH FORCE.
+
+
+
+
+
+
+
+
+Add C structure member tg_updatedcols to record updated columns to C triggers (Peter Eisentraut)
+
+
+
+
+
+
+
+
+Add FOREIGN to ALTER statements, if appropriate (Luis Carril)
+
+
+
+WHAT IS THIS ABOUT?
+
+
+
+
+
+
+
+
+
+ Data Types
+
+
+
+
+
+
+
+Add SQL data type xid8 to expose FullTransactionId (Thomas Munro)
+
+
+
+The xid data type is only four bytes so does not show the transaction epoch.
+
+
+
+
+
+
+
+
+Add data type regcollation and helper functions for system collations (Julien Rouhaud)
+
+
+
+
+
+
+
+
+Use the glibc version as the collation version (Thomas Munro)
+
+
+
+If the glibc version changes, a warning will be issued when a mismatching collation is used.
+
+
+
+
+
+
+
+
+Add support for collation versions on Windows (Juan José Santamaría Flecha)
+
+
+
+
+
+
+
+
+Allow ROW values to have their members extracted with suffix notation (Tom Lane)
+
+
+
+For example, (ROW(4, 5.0)).f1 returns 4.
+
+
+
+
+
+
+
+
+
+
+ Functions
+
+
+
+
+
+
+
+Add alternate version of jsonb_set with special NULL handling (Andrew Dunstan)
+
+
+
+The new function, jsonb_set_lax(), allows null new values to either set the specified key to JSON null, delete the key, raise exception, or ignore operation.
+This allows json values to be converted to timestamps, which can then be processed in jsonpath expressions. This also adds jsonpath functions that support time zone-aware output.
+
+
+
+
+
+
+
+
+Add SQL functions NORMALIZE() to normalize Unicode strings, and IS NORMALIZED to check for normalization (Peter Eisentraut)
+
+
+
+
+
+
+
+
+Allow UTF-8 escapes, e.g., E'\u####', in clients that don't use UTF-8 encoding (Tom Lane)
+
+
+
+The UTF-8 characters must be available in the server encoding.
+
+
+
+
+
+
+
+
+Allow to_date() and to_timestamp() to recognize non-English month/day names (Juan José Santamaría Flecha)
+
+
+
+The names recognized are the same as those output by to_char() with the same format codes.
+
+
+
+
+
+
+
+
+Add format specifications FF1-FF6 to control display of 1-6 subsecond digits (Alexander Korotkov, Nikita Glukhov, Teodor Sigaev, Oleg Bartunov)
+
+
+
+These patterns can be used by to_char(), to_timestamp(), and jsonpath's .datetime().
+
+
+
+
+
+
+
+
+Add SSSSS time format specification as an SQL standard alias for SSSS (Nikita Glukhov, Alexander Korotkov)
+
+
+
+
+
+
+
+
+Add function gen_random_uuid to generate version 4 UUIDs (Fabien COELHO)
+
+
+
+Previously UUID generation functions were only available external modules uuid-ossp or pgcrypto were installed.
+
+
+
+
+
+
+
+
+Add greatest-common-denominator (gcd) and least-common-multiple (lcm) functions (Vik Fearing)
+
+
+
+
+
+
+
+
+Improve the performance and accuracy of square root and natural log (ln) output (Dean Rasheed)
+
+
+
+
+
+
+
+
+Add function min_scale() that returns the number of digits to the right the decimal point that is required to represent the numeric value with full precision (Pavel Stehule)
+
+
+
+
+
+
+
+
+Add function trim_scale() to reduce the scale of a number by removing trailing zeros (Pavel Stehule)
+
+
+
+
+
+
+
+
+Add commutators of distance operators (Nikita Glukhov)
+
+
+
+For example, previously only point <-> line was supported, now line <-> point works too.
+
+
+
+
+
+
+
+
+Update all transaction id functions to support xid8 (Thomas Munro)
+
+
+
+They use the same names as the xid data type versions.
+
+
+
+
+
+
+
+
+Allow get_bit() and set_bit() to set bits beyond 256MB of bytea data (Movead Li)
+
+
+
+
+
+
+
+
+Allow advisory-lock functions to be used in some parallel operations (Tom Lane)
+
+
+
+
+
+
+
+
+Add the ability to remove a function's dependency on an extension (Alvaro Herrera)
+
+
+
+The syntax is ALTER FUNCTION .. NO DEPENDS ON.
+
+
+
+
+
+
+
+
+
+
+ PL/pgSQL
+
+
+
+
+
+
+
+Improve performance of simple PL/pgSQL expressions (Tom Lane, Amit Langote)
+
+
+
+
+
+
+
+
+Improve the performance of PL/pgSQL functions that use immutable expressions (Konstantin Knizhnik)
+
+
+
+
+
+
+
+
+
+
+ Client Interfaces
+
+
+
+
+
+
+
+Allow libpq clients to require channel binding (Jeff Davis)
+
+
+
+Using the libpq connection parameter 'channel_binding' forces the other end of the TLS connection to prove it knows the user's password. This prevents man-in-the-middle attacks.
+
+
+
+
+
+
+
+
+Add libpq connection parameters to control the min/max TLS version (Daniel Gustafsson)
+
+
+
+The settings are min_protocol_version and max_protocol_version.
+
+
+
+
+
+
+
+
+Tighten line length and comment detection in .pgpass files (Fujii Masao)
+
+
+
+
+
+
+
+
+Allow specification of passwords to unlock client certificates (Craig Ringer, Andrew Dunstan)
+
+
+
+This is specified by the sslpassword connection option.
+
+
+
+
+
+
+
+
+Allow DER-encoded client certificates (Craig Ringer, Andrew Dunstan)
+
+
+
+
+
+
+
+
+
+
+ Client Applications
+
+
+
+
+
+
+
+
+
+
+Add the transaction status (%x) to the default psql prompts (Vik Fearing)
+
+
+
+
+
+
+
+
+Allow the secondary psql prompt to be same number of spaces as the primary prompt (Thomas Munro)
+
+
+
+This is accomplished by setting PROMPT2 to %w.
+
+
+
+
+
+
+
+
+Allow \g and \gx to change any pset output options for a single command (Tom Lane)
+
+
+
+This makes \gx equivalent to \g (expanded=on).
+
+
+
+
+
+
+
+
+Add psql commands to report operator classes and operator families (Sergey Cherkashin, Nikita Glukhov, Alexander Korotkov)
+
+
+
+
+
+
+
+
+Show table persistence in psql's \dt+ and related commands (David Fetter)
+
+
+
+In verbose mode, the table/index/view shows if the object is permanent, temporary, or unlogged.
+
+
+
+
+
+
+
+
+Improve output of psql \d for TOAST tables (Justin Pryzby)
+
+
+
+
+
+
+
+
+Adjust display of psql's \e query (Tom Lane)
+
+
+
+When exiting the editor, if the query doesn't end with a semicolon or \g, the query buffer contents will now be displayed.
+
+
+
+
+
+
+
+
+Add \warn command to psql (David Fetter)
+
+
+
+This is like \echo except that the text is sent to stderr instead of stdout.
+
+
+
+
+
+
+
+
+Add the PostgreSQL home page to command-line --help output (Peter Eisentraut)
+
+
+
+
+
+
+
+
+
+ pgbench
+
+
+
+
+
+
+
+Allow pgbench to partition its 'accounts' table (Fabien COELHO)
+
+
+
+This allows performance testing of partitioning.
+
+
+
+
+
+
+
+
+Add pgbench command \aset, which behaves like \gset, but for multiple queries (Fabien Coelho)
+
+
+
+
+
+
+
+
+Allow pgbench to generate its data server-side, rather than client side (Fabien Coelho)
+
+
+
+DOCUMENT THE DEFAULT GENERATION METHOD
+
+
+
+
+
+
+
+
+
+
+
+ Server Applications
+
+
+
+
+
+
+
+Generate backup manifests for base backups, and verify them (Robert Haas)
+
+
+
+A new tool pg_verifybackup can verify backups.
+
+
+
+
+
+
+
+
+Have pg_basebackup estimate the total backup size by default (Fujii Masao)
+
+
+
+This computation allows pg_stat_progress_basebackup to show progress, and can be disabled by using the --no-estimate-size option. Previously, this computation happened only if --progress was used.
+
+
+
+
+
+
+
+
+Add pg_rewind option to configure standbys (Paul Guo, Jimmy Yih, Ashwin Agrawal)
+This was needed for previously supported version-zero functions.
+
+
+
+
+
+
+
+
+Add the query string to planner hook functions (Pascal Legrand, Julien Rouhaud)
+
+
+
+
+
+
+
+
+Add TRUNCATE command hook (Yuli Khodorkovskiy)
+
+
+
+
+
+
+
+
+Add TLS init hook (Andrew Dunstan)
+
+
+
+
+
+
+
+
+Allow building with no predefined Unix-domain socket directory (Peter Eisentraut)
+
+
+
+
+
+
+
+
+Reduce the probability of SysV resource key collision on Unix platforms (Tom Lane)
+
+
+
+
+
+
+
+
+Use operating system functions to cleanly erase memory that contains sensitive information (Peter Eisentraut)
+
+
+
+For example, this is used for clearing passwords stored in memory.
+
+
+
+
+
+
+
+
+Add "headerscheck" script to test C header-file compatibility (Tom Lane)
+
+
+
+
+
+
+
+
+Implement internal lists as arrays, rather than a chain of structures (Tom Lane)
+
+
+
+This improves performance for queries that access many object. The internal List API has also been improved.
+
+
+
+
+
+
+
+
+Update Windows build scripts to use the modern --with-uuid flag for UUID libraries (Kyotaro Horiguchi)
+
+
+
+
+
+
+
+
+
+ Additional Modules
+
+
+
+
+
+
+
+Allow extensions to be specified as trusted (Tom Lane)
+
+
+
+Such extensions can be installed in a database by users with creation rights, even if they are not super users. This change also removes the pg_pltemplate system catalog.
+
+
+
+
+
+
+
+
+Remove support for upgrading "unpackaged" extensions (Tom Lane)
+
+
+
+
+
+
+
+
+Allow non-super users to connect to postgres_fdw foreign servers without using a password (Craig Ringer)
+
+
+
+Specifically, allow ALTER USER MAPPING to set password_required to false. Care must still be taken to avoid non-super users from using super user credentials to connect to the foreign server.
+
+
+
+
+
+
+
+
+Allow postgres_fdw to use certificate authentication (Craig Ringer)
+
+
+
+Different users can use different certificates.
+
+
+
+
+
+
+
+
+Allow sepgsql to control access to the TRUNCATE command (Yuli Khodorkovskiy)