Release date: 2019-??-?? AS OF 2019-05-09
Major enhancements in PostgreSQL 12 include:
The above items are explained in more detail in the sections below.
Version 12 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities:
Remove the special behavior of OID columns (Andres Freund, John Naylor)
Previously, a normally-invisible
OID column could be specified during table creation using
WITH OIDS; that ability has been removed. Columns can still be explicitly specified as type
OID. Operations on tables that have columns named
OID (created using
WITH OIDS) will need adjustment.
SELECT * will now output those columns for the many system tables which have them. Previously, the columns had to be selected explicitly.
Remove data types
tinterval (Andres Freund)
Remove the timetravel extension (Andres Freund)
recovery.conf settings into
postgresql.conf (Fujii Masao, Simon Riggs, Abhijit Menon-Sen, Sergei Kornilov)
recovery.conf is no longer used, and the server will not start if the file exists. recovery.signal and standby.signal are now used to switch into non-primary mode.
trigger_file has been renamed to promote_trigger_file. The
standby_mode setting has been removed.
Do not allow multiple conflicting
recovery_target* specifications (Peter Eisentraut)
Specifically, only allow one of recovery_target, recovery_target_lsn, recovery_target_name, recovery_target_time, recovery_target_xid. Previously, multiple different instances of the variables above could be specified, and the last one was honored. Now, only one can be specified, though the same one can be specified multiple times and the last specification is honored.
Cause recovery to advance to the latest timeline by default (Peter Eisentraut)
Specifically, recovery_target_timeline now defaults to
latest. Previously, it defaulted to
Refactor geometric functions and operators (Emre Hasegeli)
This could lead to more accurate, but slightly different, results from previous releases.
Restructure geometric types to handle NaN, underflow, overflow and division by zero more consistently (Emre Hasegeli)
Improve behavior and error reporting for the line data type (Emre Hasegeli)
Improve performance by changing the default number of trailing digits output for
DOUBLE PRECISION values (Andrew Gierth)
Previously, float values were output rounded to 6 or 15 decimals by default. Now, only the number of digits required to preserve the exact binary value is output. The previous behavior can be restored by setting extra_float_digits to zero.
Change XML functions like
xpath() to never pretty-print their output (Tom Lane)
Previously, this happened in some rare cases. ACCURATE? HOW TO GET PRETTY PRINT OUTPUT?
Rename command-line tool pg_verify_checksums to pg_checksums (Michaël Paquier)
Require specification of pg_restore
-f - to send the dump contents to stdout (Euler Taveira)
The previous behavior was considered confusing.
\pset format command from using non-unique abbreviations (Daniel Vérité)
\pset format a chose
aligned; it will now error.
The maximum btree index length is now reduced by eight bytes; a REINDEX operation could potentially fail.
Allow data type name to use non-C collations (Tom Lane, Daniel Vérité)
It still uses the "C" collation by default, rather than defaulting to the database collation. Regular expression operations on data type name columns will now use the "C" collation; you will need to override the collation if you want to use locale-specific regular expression patterns, e.g.,
DROP IF EXISTS FUNCTION/
ROUTINE to generate an error if no arguments are supplied and there are multiple matching objects (David Rowley)
Also improve the error message in such cases.
consrc column (Peter Eisentraut)
adsrc column (Peter Eisentraut)
Remove the ability to disable dynamic shared memory (Kyotaro Horiguchi)
Specifically, dynamic_shared_memory_type can no longer be set to
Below you will find a detailed account of the changes between PostgreSQL 12 and the previous major release.
Improve performance of many operations on partitioned tables (Amit Langote, David Rowley, Tom Lane, Álvaro Herrera)
Allow tables with thousands of child partitions to be processed efficiently by operations that only affect a small number of partitions.
Allow foreign keys to reference partitioned tables (Álvaro Herrera)
Improve speed of
COPY into partitioned tables (David Rowley)
Allow partitions bounds to be any expression (Kyotaro Horiguchi, Tom Lane, Amit Langote)
Expressions are evaluated at partitioned table creation time. Previously, only constants were allowed as partitions bounds.
CREATE TABLE's tablespace specification for a partitioned table to affect the tablespace of its children (David Rowley, Álvaro Herrera)
Avoid sorting when partitions are already being scanned in the necessary order (David Rowley)
ATTACH PARTITION is now performed with reduced locking requirements (Robert Haas)
Add partition introspection functions (Michaël Paquier, Álvaro Herrera, Amit Langote)
pg_partition_root() returns the top-most parent of a partition tree,
pg_partition_ancestors() reports all ancestors of a partition, and
pg_partition_tree() displays information about partitions.
Include partitioned indexes in the system view
pg_indexes (Suraj Kharage)
Add psql command
\dP to list partitioned tables and indexes (Pavel Stěhule)
\z display of partitioned tables (Pavel Stěhule, Michaël Paquier, Álvaro Herrera)
Fix bugs that could cause
ALTER TABLE DETACH PARTITION to not drop objects that should be dropped, such as automatically-created child indexes (Tom Lane)
Improve performance and space utilization of btree indexes with many duplicates (Peter Geoghegan, Heikki Linnakangas)
Previously, duplicate index entries were stored unordered within their duplicate groups. This caused overhead during index inserts, wasted space due to excessive page splits, and reduced
VACUUM's ability to recycle entire pages. Duplicate index entries are now sorted in heap-storage order.
Indexes pg_upgraded from previous releases will not have these benefits.
Allow multi-column btree indexes to be smaller (Peter Geoghegan, Heikki Linnakangas)
Internal pages and min/max leaf page indicators now only store index keys until the change key, rather than all indexed keys. This also improves the locality of index access.
Indexes pg_upgraded from previous releases will not have these benefits.
Improve speed of btree index insertions by reducing locking overhead (Alexander Korotkov)
Add support for nearest-neighbor (KNN) searches of SP-GiST indexes (Nikita Glukhov, Alexander Korotkov, Vlad Sterzhanov)
Reduce the WAL write overhead of GiST, GIN and SP-GiST index creation (Anastasia Lubennikova, Andrey V. Lepikhov)
Allow index-only scans to be more efficient on indexes with many columns (Konstantin Knizhnik)
Improve the performance of vacuum scans of GiST indexes (Andrey Borodin, Konstantin Kuznetsov, Heikki Linnakangas)
Delete empty leaf pages during GiST
VACUUM (Andrey Borodin)
Reduce locking requirements for index renaming (Peter Eisentraut)
Allow CREATE STATISTICS to create most-common-value statistics for multiple columns (Tomas Vondra)
This improves optimization for columns with non-uniform distributions that often appear in
Allow common table expressions (CTE) to be inlined in later parts of the query (Andreas Karlsson, Andrew Gierth, David Fetter, Tom Lane)
Specifically, CTEs are inlined if they are not recursive and are referenced only once later in the query. Inlining can be prevented by specifying
MATERIALIZED, and forced by specifying
NOT MATERIALIZED. Previously, CTEs were never inlined and were always evaluated before the rest of the query.
Allow control over when generic plans are used for prepared statements (Pavel Stěhule)
This is controlled by the plan_cache_mode server variable.
Improve optimization of self-joins involving columns of type tid (Tom Lane)
Improve optimization of partition and
UNION ALL queries that have only a single child (David Rowley)
Improve optimizations for domains that have no check constraints (Tom Lane)
Inline calls to
GREATEST to improve optimization (Vik Fearing)
IS NOT NULL with mis-matching types to use partial indexes more frequently (Tom Lane)
Allow IN comparisons with arrays to use
IS NOT NULL partial indexes more frequently (James Coleman)
Store statistics using the collation defined for each column (Tom Lane)
Previously, the default collation was used for all statistics storage. This potentially gives better optimizer behavior for columns with non-default collations.
Improve optimizer estimates for
tid inequality comparisons (Edmund Horner)
Fix the btree leakproof designation of some functions (Tom Lane)
This allows for more complex optimizations.
Enable Just-in-Time (JIT) compilation by default (Andres Freund)
Greatly reduce memory consumption of COPY and function calls (Andres Freund, Tomas Vondra, Tom Lane)
Speed up keyword lookup (John Naylor, Joerg Sonnenberger, Tom Lane)
Improve search performance for multi-byte characters (Heikki Linnakangas)
TOAST values to be minimally decompressed (Paul Ramsey)
This is useful for routines that only look at values at the start of the
ALTER TABLE .. SET NOT NULL to avoid unnecessary checking (Sergei Kornilov)
This can happen if column constraints already prevent nulls.
ALTER TABLE .. SET DATA TYPE
timestamp/timestamptz to avoid a table rewrite when the session time zone is UTC (Noah Misch)
In the UTC time zone, the data types are binary compatible.
Improve speed in converting strings to
int4 integers (Andres Freund)
Allow parallelized queries when in
SERIALIZABLE isolation mode (Thomas Munro)
Previously, parallelism was disabled when in this mode.
pwrite() for random I/O (Oskari Saarenmaa, Thomas Munro)
This reduces the number of system calls required.
Improve the speed of setting the process title on FreeBSD (Thomas Munro)
Allow logging of only a percentage of statements and transactions meeting log_min_duration_statement criteria (Adrien Nayrat)
Report progress of
CREATE INDEX and
REINDEX operations (Álvaro Herrera, Peter Eisentraut)
Progress is reported in the
pg_stat_progress_create_index system view
Add progress reporting to
VACUUM FULL (Tatsuro Yamada)
Progress is reported in the
pg_stat_progress_cluster system view.
Add progress reporting to pg_checksums (Michael Banck, Bernd Helmle)
This is enabled with the option
Add counter of checksum failures to
pg_stat_database (Magnus Hagander)
Add tracking of global objects in system view
pg_stat_database (Julien Rouhaud)
Global objects have a
datoid value of zero.
Add the ability to list the contents of the archive directory (Christoph Moench-Tegeder)
The function is
Add the ability to list the contents of temporary directories (Nathan Bossart)
pg_ls_tmpdir(), optionally allows specification of a tablespace.
Add information about the client certificate to the system view
pg_stat_ssl (Peter Eisentraut)
The new columns are
clientdn has been renamed to
client_dn, for clarity.
Restrict visibility of rows in
pg_stat_ssl by unprivileged users (Peter Eisentraut)
Add the version number to the server startup log message (Christoph Berg)
Prevent logging of empty "incomplete" startup packets (Tom Lane)
Unconditionally include application_name in server log authentication messages (Don Seiler)
Have the walreceiver set its application name to the cluster name, if set (Peter Eisentraut)
Add the timestamp of the last received standby message to
pg_stat_replication (Lim MyungKyu)
Add wait event for fsync of WAL segments (Konstantin Knizhnik)
Allow more use of indexes for text comparisons with
information_schema columns (Tom Lane)
Use "C" collation for
information_schema and the system tables (Tom Lane)
This will produce more consistent behavior in databases with different collations, but will also cause these tables to produce results in "C" collation ordering, rather than the default collation for the database.
information_schema outputs to honor the system-defined maximum 63-byte identifier length (Tom Lane)
Add GSSAPI client and server-side encryption support (Robbie Harwood, Stephen Frost)
pg_hba.conf option to check that the database user name matches the certificate common name (Julian Markwort, Marius Timmer)
The new check is enabled with
Allow discovery of the LDAP server using DNS SRV records (Thomas Munro)
This avoids the requirement of specifying
ldapserver, and is only supported if PostgreSQL is compiled with OpenLDAP.
Prevent TRUNCATE from requesting a lock on tables for which the user lacks permission (Michaël Paquier)
This prevents unauthorized locking, which could interfere with user queries.
ANALYZE from requesting a lock on tables for which it lacks permission (Michaël Paquier)
This prevents unauthorized locking, which could interfere with user queries.
Add ability to enable/disable cluster checksums using pg_checksums (Michael Banck, Michaël Paquier)
The cluster must be offline for these operations.
Reduce the default value of autovacuum_vacuum_cost_delay to 2ms (Tom Lane)
Allow vacuum_cost_delay to specify sub-millisecond delays (Tom Lane)
Floating-point values can also now be specified.
Allow time-based server variables to use micro-seconds (us) (Tom Lane)
Allow fractional input for integer server variables (Tom Lane)
SET work_mem = '30.1GB'.
Allow units to be specified for floating-point server variables (Tom Lane)
This can be beneficial on copy-on-write file systems like ZFS.
Add parameter to control the server TCP timeout (Ryohei Nagaura)
The parameter is tcp_user_timeout.
Allow control of the minimum and maximum SSL> protocol versions (Peter Eisentraut)
Add server variable ssl_library to report the SSL library version used by the server (Peter Eisentraut)
Add server variable to control the type of shared memory to use (Andres Freund)
The variable is shared_memory_type. Its purpose is to allow selection of System V shared memory, if desired.
Allow some recovery parameters to be changed with reload (Peter Eisentraut)
Allow the streaming replication timeout (wal_sender_timeout) to be set per connection (Tsunakawa Takayuki)
Previously, this could only be set cluster-wide.
pg_promote() to promote standbys to primaries (Laurenz Albe, Michaël Paquier)
Previously, this operation was only possible by using pg_ctl or creating a trigger file.
Allow replication slots to be copied (Masahiko Sawada)
The functions are
Add an explicit value of
current for recovery_target_timeline (Peter Eisentraut)
Have recovery fail if a two-phase transaction status file is corrupt (Michaël Paquier)
Previously, only a warning was issued in the logs and recovery continued.
CONCURRENTLY to allow reindexing concurrently (Michaël Paquier, Andreas Karlsson, Peter Eisentraut)
This is also controlled by the reindexdb
Add support for generated columns (Peter Eisentraut)
The content of generated columns are computed from expressions (including references to other columns in the same table) rather than being specified by
WHERE clause to
COPY FROM which controls which rows are output (Surafel Temesgen)
Allow enumerated values to be added in more transaction types (Andrew Dunstan, Tom Lane, Thomas Munro)
ALTER TYPE ... ADD VALUE could only be called in a transaction that created the enumerated type. Now, the only restriction is that the new enumerated value cannot be referenced until the transaction commits.
Add command to end a transaction and start a new one (Peter Eisentraut)
The commands are
COMMIT AND CHAIN and
ROLLBACK AND CHAIN.
Allow the creation of collations that report string equality for strings that are not byte-wise equal (Peter Eisentraut)
This allows case and accent-agnostic equality comparisons using "nondeterministic" collations. This is only supported for ICU collations. MENTION ITS AFFECT ON ORDERING?
Add VACUUM and
CREATE TABLE options to prevent
VACUUM from truncating trailing empty pages (Tsunakawa Takayuki)
The options are
toast.vacuum_truncate. This reduces vacuum locking requirements.
Allow vacuum to avoid index cleanup with the
INDEX_CLEANUP option (Masahiko Sawada)
Add the ability to skip
ANALYZE operations on tables that cannot be immediately locked (Nathan Bossart)
This option is called
ANALYZE to take optional boolean argument specifications (Masahiko Sawada)
Add EXPLAIN option
SETTINGS to output non-default optimizer settings (Tomas Vondra)
This can also be output in auto-explain via auto_explain.
Allow aggregates to be replaced (Andrew Gierth)
The command is
CREATE OR REPLACE AGGREGATE.
Allow modifications of system table options using ALTER TABLE (Peter Eisentraut)
This allows modifications of
reloptions and autovacuum settings.
RECORD to be used as column types in a query's column definition list for a table function that is declared to return
RECORD (Elvis Pranskevichus)
Use all column names when creating default foreign key constraint names (Peter Eisentraut)
Previously, only the first column name was used.
Update Snowball stemmer dictionaries with support for new languages (Arthur Zakirov)
This adds stemming for Arabic, Indonesian, Irish, Lithuanian, Nepali, and Tami to full text search.
Add support for ICU collation customization attributes (Peter Eisentraut)
This allow modification of the collation rules. DETAILS?
Allow data type name to more seamlessly be compared to other text types (Tom Lane)
Add support for the SQL/JSON path language (Nikita Glukhov, Teodor Sigaev, Alexander Korotkov, Oleg Bartunov, Liudmila Mantrova)
This allows execution of complex queries on
JSON values using an SQL-standard language.
Add support for hyperbolic functions (Lætitia Avrot)
log10() as alias for
log(), for standards compliance.
Improve the accuracy of statistical aggregates like
variance() by using more precise algorithms (Dean Rasheed)
date_trunc() to have an additional argument to control the time zone (Vik Fearing, Tom Lane)
This is faster and simpler than using the
AT TIME ZONE clause.
to_date() functions to be more forgiving of template mismatches (Artur Zakirov, Alexander Korotkov, Liudmila Mantrova)
This new behavior more closely matches the Oracle functions of the same name. DETAILS?
Improve node detection and escaping of XML functions (Pavel Stěhule, Markus Winand, Chapman Flack)
XML BY VALUE clause (Chapman Flack)
The clause has no effect.
current_schemas() from being run by parallel workers (Michaël Paquier)
Allow commands and variables with the same name as commands to be used in the same PL/pgSQL function (Tom Lane)
For example, allow a variable called comment to exist in the same function that calls the comment SQL command.
Add new optional warning and error checks to PL/pgSQL (Pavel Stěhule)
The new checks allow for run-time validation of
INTO column counts and single-row results.
Allow ecpg to create variables of data type bytea (Ryo Matsumura)
This allows to interaction with
bytea data directly, rather than using a binary encoding.
DECLARE STATEMENT support to ECPG (Takeshi Ideriha, Hayato Kuroda)
This allows statements to be associated with named connections, so future operations like cursors don't need to re-reference the connection name.
Add parameter to control libpq's TCP timeout (Ryohei Nagaura)
The parameter is libpq_tcp_user_timeout.
Allow libpq to report the
SQLSTATE to output only this value (Didier Gautheron)
Add libpq function to report the memory size of the query result (Lars Kanis, Tom Lane)
The function is
Remove the no-display/debug flag from the libpq
options parameter (Peter Eisentraut)
This allows the option to be used by postgres_fdw.
Allow vacuumdb to select tables for vacuum based on their wraparound horizon (Nathan Bossart)
The options are
Add colorization to the output of command-line utilities (Peter Eisentraut)
This is enabled with by setting environment variable
Add CSV table output mode in psql (Daniel Vérité)
This is controlled by
\pset format csv or the command-line
Show the manual page URL in psql's
\help output (Peter Eisentraut)
Display the IP address in psql's
\conninfo (Fabien Coelho)
Improve tab completion of
CREATE TABLE, CREATE TRIGGER, CREATE EVENT TRIGGER, ANALYZE, EXPLAIN, VACUUM, ALTER TABLE, ALTER INDEX, ALTER DATABASE, ALTER INDEX ALTER COLUMN (Dagfinn Ilmari Mannsåker, Tatsuro Yamada, Michaël Paquier, Tom Lane, Justin Pryzby)
Allow values produced by queries to be assigned to pgbench variables (Fabien Coelho, Álvaro Herrera)
The commands is
Improve precision of pgbench's
--rate option (Tom Lane)
Improve pgbench error reporting with clearer messages and return codes (Peter Eisentraut)
Allow vacuumdb to disable waiting for locks or skipping all-visible pages (Nathan Bossart)
The options are
Allow control of log file rotation via pg_ctl (Kyotaro Horiguchi, Alexander Kuzmenkov, Alexander Korotkov)
Previously, this was only possible via an SQL function or a process signal.
Properly detach the server on pg_ctl start (Paul Guo)
This prevents later shell activity from interfering with the postmaster.
Allow pg_upgrade to use the file system cloning feature (Peter Eisentraut)
--clone option has the advantages of
--link, while preventing the old cluster from being changed after the new cluster has started.
Allow specification of the pg_upgrade socket directory (Daniel Gustafsson)
This is controlled by
--socketdir; the default is the current directory.
Allow pg_checksums to disable fsync operations (Michaël Paquier)
This is controlled by the
Allow pg_rewind to disable fsync operations (Michaël Paquier)
Allow control over the number of rows each pg_dump
INSERT statement uses (Surafel Temesgen, David Rowley)
The option is
--exclude-database option to pg_dumpall (Andrew Dunstan)
Allow pg_dump to emit
INSERT ... ON CONFLICT DO NOTHING (Surafel Temesgen)
This avoids conflict failures during restore. The pg_dump option is
Decouple the order of parallel pg_dump from the order used by pg_restore (Tom Lane)
This allows pg_restore to perform more efficient parallel restores.
Allow the number of float digits to be specified for pg_dump and pg_dumpall (Andrew Dunstan)
This allows the float digit output to match previous dumps.
Add CREATE ACCESS METHOD command to create new table types (Andres Freund, Haribabu Kommi, Álvaro Herrera, Alexander Korotkov, Dmitry Dolgov)
This enables the development of new table access methods, which can optimize storage for different use-cases. The existing
heap access method remains the default.
Add support function capability to improve optimizer estimates, inlining, and indexing for functions (Tom Lane)
This allows extensions to create planner support functions that can provide function-specific selectivity, cost, and row-count estimates that can depend on the function's arguments. Support functions can also supply simplified representations and index conditions, greatly expanding optimization possibilities.
Reserve a range of oids (9000-9999) to be used for external extensions (Andres Freund)
Build Cygwin binaries using dynamic instead of static libraries (Marco Atzeri)
Remove configure switch
--disable-strong-random (Michaël Paquier)
A strong random source is now required.
Properly report Winsock errors on Windows (Tom Lane)
Require a C99-supported compiler, and MSVC 2013 or later on Windows (Andres Freund)
Add images to the PostgreSQL documentation (Jürgen Purtz)
More clearly document the problems of server failure during exclusive base backups (David Steele, Robert Haas)
Document that the
B/bytes units can be specified for server variables (Greg Stark)
Add documentation for
aclitem functions and operators (Fabien Coelho, John Naylor)
Update documentation on the use of NFS (Peter Eisentraut)
ORDER BY sorts and
LIMIT clauses to be pushed to postgres_fdw foreign tables (Etsuro Fujita)
Improve optimizer cost accounting for pushdown of aggregates to postgres_fdw tables (Etsuro Fujita)
This release also improves costing of postgres_fdw target list generation.
WITH CHECK OPTION on views that reference postgres_fdw tables (Etsuro Fujita)
CHECK OPTIONs on postgres_fdw tables are ignored (because the reference is foreign), views on such tables are considered local, so this release enforces
CHECK OPTIONs on them. Previously, only
RETURNING clauses that returned
CHECK OPTION values were validated.
pg_stat_statements_reset() to be more granular (Haribabu Kommi, Amit Kapila)
The function now allows reset of statistics for specific databases, users, and queries.
Allow control of the auto_explain log level (Tom Dunstan, Andrew Dunstan)
The default is
Update unaccent rules with new punctuation and symbols (Hugh Ranalli, Michaël Paquier)
Allow unaccent to handle some accents encoded as combining characters (Hugh Ranalli)
Allow unaccent to remove accents from Greek characters (Tasos Maschalidis)
Add 64-bit hash function to citext (Amul Sul)
citext_hash_extended() also requires a seed value. NO DOCS?
Add 64-bit hash function to hstore (Amul Sul)
hstore_hash_extended() also requires a seed value. NO DOCS?
The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues.