Release 12Release date:2019-??-?? AS OF 2019-05-09Overview
Major enhancements in PostgreSQL 12 include:
big item
The above items are explained in more detail in the sections below.
Migration to Version 12
A dump/restore using , or use of , is required for those wishing to migrate data
from any previous release.
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 abstime, reltime,
and tinterval (Andres Freund)
Remove the timetravel extension
(Andres Freund)
Move 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 . The
standby_mode setting has been removed.
Do not allow multiple conflicting recovery_target*
specifications (Peter Eisentraut)
Specifically, only allow one of , ,
,
, . 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, now
defaults to latest. Previously, it defaulted
to current.
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 REAL
and 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 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 (Michaël Paquier)
Require specification of -f - to send the dump contents to stdout
(Euler Taveira)
The previous behavior was considered confusing.
Disallow psql's \pset
format command from using non-unique abbreviations
(Daniel Vérité)
Previously, \pset format a chose
aligned; it will now error.
The maximum btree index length is now reduced by eight bytes;
a 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., \w.
Cause DROP IF EXISTS
FUNCTION/PROCEDURE/AGGREGATE/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.
Remove obsolete pg_constraint.consrc
column (Peter Eisentraut)
Remove obsolete pg_attrdef.adsrc
column (Peter Eisentraut)
Remove the ability to disable dynamic shared memory (Kyotaro
Horiguchi)
Specifically,
can no longer be set to none.
Changes
Below you will find a detailed account of the changes between
PostgreSQL 12 and the previous
major release.
ServerPartitioning
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.
Allow 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 function pg_partition_root()
to return top-most parent of a partition tree (Michaël Paquier)
Add function pg_partition_ancestors()
to report all ancestors of a partition (Álvaro Herrera)
Add function pg_partition_tree()
to display information about partitions (Amit Langote)
Include partitioned indexes in the system view pg_indexes
(Suraj Kharage)
Add psql command \dP
to list partitioned tables and indexes (Pavel Stěhule)
Improve psql\d
and \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)
Indexes
Improve speed of btree index insertions (Peter Geoghegan,
Alexander Korotkov)
The new code improves the space-efficiency of page splits,
reduces locking overhead, and gives better performance for
UPDATEs and DELETEs on
indexes with many duplicates.
Support INCLUDE columns
in GiST indexes (Andrey Borodin)
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)
Have new btree indexes sort duplicate index entries in heap-storage
order (Peter Geoghegan, Heikki Linnakangas)
Indexes pg_upgraded from previous
releases will not have this ordering.
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)
Optimizer
Allow to create
most-common-value statistics for multiple columns (Tomas Vondra)
This improves optimization for columns with non-uniform
distributions that often appear in WHERE
clauses.
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
server variable.
Improve optimization of self-joins (Tom Lane)
Improve optimizations for domains that have no check
constraints (Tom Lane)
Inline calls to LEAST
and GREATEST to improve optimization (Vik
Fearing)
Allow 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.
General Performance
Enable Just-in-Time
(JIT) compilation by default (Andres Freund)
Greatly reduce memory consumption of
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)
Allow TOAST
values to be minimally decompressed (Paul Ramsey)
This is useful for routines that only look at values at the start
of the TOAST field.
Allow ALTER TABLE .. SET
NOT NULL to avoid unnecessary checking (Sergei
Kornilov)
This can happen if column constraints already prevent nulls.
Allow ALTER TABLE .. SET DATA TYPEtimestamp/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
int2/int4 integers (Andres Freund)
Allow parallelized queries when in SERIALIZABLE
isolation mode (Thomas Munro)
Previously, parallelism was disabled when in this mode.
Use pread() and 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)
Monitoring
Allow logging of only a percentage of statements and transactions
meeting criteria
(Adrien Nayrat)
The parameters
and control this.
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 CLUSTER and
VACUUM FULL (Tatsuro Yamada)
Progress is reported in the pg_stat_progress_cluster
system view.
Add progress reporting to
(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 pg_stat_database.datoid
value of zero.
Add the ability to list the contents of the archive directory
(Christoph Moench-Tegeder)
The function is pg_ls_archive_statusdir().
Add the ability to list the contents of temporary directories
(Nathan Bossart)
The function, 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 client_serial
and issuer_dn. Column
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
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)
Information Schema
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.
Force information_schema outputs to honor
the system-defined maximum 63-byte identifier length (Tom Lane)
Authentication
Add GSSAPI
client and server-side encryption support (Robbie Harwood,
Stephen Frost)
Add pg_hba.confhostgssenc
and hostnogssenc record types. This would
typically use the gss authentication method.
This also adds a libpq
option, and a system view.
Allow the clientcertpg_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
clientcert=verify-full.
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 from requesting a lock on
tables for which the user lacks permission (Michaël Paquier)
This prevents unauthorized locking delays.
Prevent VACUUM and ANALYZE
from requesting a lock on tables for which it lacks permission
(Michaël Paquier)
This prevents unauthorized locking delays.
Server Configuration
Add ability to enable/disable cluster checksums using (Michael Banck, Michaël Paquier)
The cluster must be offline for these operations.
Reduce the default value of to 2ms (Tom Lane)
Allow 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)
For example, SET work_mem = '30.1GB'.
Allow units to be specified for floating-point server variables
(Tom Lane)
Add and server variables to avoid
WAL file recycling (Jerry Jelinek)
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 .
Allow control of the minimum and maximum SSL>
protocol versions (Peter Eisentraut)
The server settings are and .
Add server variable 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 .
Its purpose is to allow selection of System
V shared memory, if desired.
Streaming Replication and Recovery
Allow some recovery parameters to be changed with reload (Peter
Eisentraut)
These parameters are ,
, , and .
Allow the streaming replication timeout () to be set per connection
(Tsunakawa Takayuki)
Previously, this could only be set cluster-wide.
Add function pg_promote()
to promote standbys to primaries (Laurenz Albe, Michaël Paquier)
Previously, this operation was only possible by using or creating a trigger file.
Allow replication slots to be copied (Masahiko Sawada)
The functions are pg_copy_physical_replication_slot()
and pg_copy_logical_replication_slot().
Have not count as part of
(Alexander Kukushkin)
Add an explicit value of current for (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.
Utility Commands
Add CONCURRENTLY
to allow reindexing concurrently (Michaël Paquier, Andreas
Karlsson, Peter Eisentraut)
This is also controlled by the
option.
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 INSERT or
UPDATE commands.
Add a 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)
Previously, 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 and CREATE
TABLE options to prevent VACUUM
from truncating trailing empty pages (Tsunakawa Takayuki)
The options are vacuum_truncate and
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 VACUUM and
ANALYZE operations on tables that cannot be
immediately locked (Nathan Bossart)
This option is called SKIP_LOCKED.
Allow VACUUM and ANALYZE
to take optional boolean argument specifications (Masahiko Sawada)
Add option
SETTINGS to output non-default optimizer
settings (Tomas Vondra)
This can also be output in auto-explain via .log_settings.
Allow aggregates to be replaced (Andrew Gierth)
The command is CREATE
OR REPLACE AGGREGATE.
Allow modifications of system table options using (Peter Eisentraut)
This allows modifications of reloptions and
autovacuum settings.
Allow RECORD and 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.
Data Types
Update Snowball stemmer dictionaries with support for new languages
(Arthur Zakirov)
This adds additional stemming languages 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)
Functions
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)
Also add log10() as alias for
log(), for standards compliance.
Improve the accuracy of statistical aggregates like variance()
by using more precise algorithms (Dean Rasheed)
Allow 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.
Adjust to_timestamp()/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)
Specifically, in XMLTABLE,
xpath(), and xmlexists().
Allow the XML BY VALUE clause (Chapman Flack)
The clause has no effect.
Prevent current_schema()
and current_schemas() from being run by
parallel workers (Michaël Paquier)
PL/pgSQL
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.
Client Interfaces
Allow to create variables of data type
bytea (Ryo Matsumura)
This allows to interaction with bytea data directly,
rather than using a binary encoding.
Add 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 .
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 PQresultMemorySize().
Remove the no-display/debug flag from the libpq
options parameter (Peter Eisentraut)
This allows the option to be used by
postgres_fdw.
Client Applications
Add colorization to the output of command-line utilities (Peter
Eisentraut)
This is enabled with by setting environment variable
PG_COLORS. EXAMPLE?
Add CSV table output mode in
psql (Daniel Vérité)
This is controlled by \pset format csv or the
command-line option.
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)
pgbench
Allow values produced by queries to be assigned to pgbench
variables (Fabien Coelho, Álvaro Herrera)
The commands is \gset.
Improve precision of pgbench's
option (Tom Lane)
Improve pgbench error reporting with clearer messages and return
codes (Peter Eisentraut)
Server Applications
Allow to select tables for vacuum
based on their wraparound horizon (Nathan Bossart)
The options are and
.
Add vacuumdb to disable waiting for locks or skipping all-visible
pages (Nathan Bossart)
The options are and
.
Allow control of log file rotation via
(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 to use the file system cloning
feature (Peter Eisentraut)
The option has the advantages of
, 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 ; the default
is the current directory.
Have determine the local timezone
from the /etc/localtime symbolic link,
if it exists (Tom Lane)
This is more likely to produce the desired time zone string when
multiple identical time zones exist.
Allow to disable fsync operations
(Michaël Paquier)
This is controlled by the option.
Allow to disable fsync operations
(Michaël Paquier)
pg_dump,
pg_dumpall,
pg_restore
Allow control over the number of rows each
pg_dumpINSERT
statement uses (Surafel Temesgen, David Rowley)
The option is .
Add 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.
Source Code
Add command to create
new table types (Andres Freund, Haribabu Kommi, Álvaro Herrera,
Alexander Korotkov, Dimitri Golgov)
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
(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)
Documentation
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)
Additional Modules
Allow more 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
tables (Etsuro Fujita)
This release also improves costing of
postgres_fdw target list generation.
Properly honor WITH CHECK OPTION on views
that reference postgres_fdw tables
(Etsuro Fujita)
While 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 INSERTs and
UPDATEs with RETURNING
clauses that returned CHECK OPTION values
were validated.
Allow 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 log level
(Tom Dunstan, Andrew Dunstan)
The default is LOG.
Update unaccent rules with new
punctuation and symbols (Hugh Ranalli, Michaël Paquier)
Allow 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 (Amul Sul)
The function citext_hash_extended() also
requires a seed value. NO DOCS?
Add 64-bit hash function to (Amul Sul)
The function hstore_hash_extended() also
requires a seed value. NO DOCS?
Improve and
option handling to match other commands (Tatsuro Yamada)
Acknowledgments
The following individuals (in alphabetical order) have contributed to this
release as patch authors, committers, reviewers, testers, or reporters of
issues.