Release 9.5 Release Date 2015-??-?? Current as of 2015-08-03 Overview Major enhancements in PostgreSQL 9.5 include: ... to be filled in ... The above items are explained in more detail in the sections below. Migration to Version 9.5 A dump/restore using , or use of , is required for those wishing to migrate data from any previous release. Version 9.5 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities: Adjust operator precedence to match the SQL standard (Tom Lane) The precedence of <=, >= and <> has been reduced to match that of <, > and =. The precedence of IS tests (e.g., x IS NULL) has been reduced to be just below these six comparison operators. Also, multi-keyword operators beginning with NOT now have the precedence of their base operator (for example, NOT BETWEEN now has the same precedence as BETWEEN) whereas before they had inconsistent precedence, behaving like NOT with respect to their left operand but like their base operator with respect to their right operand. The new configuration parameter can be enabled to warn about queries in which these precedence changes result in different parsing choices. Change pg_ctl's default shutdown mode from smart to fast (Bruce Momjian) Use assignment cast behavior for data type conversions in PL/pgSQL assignments, rather than converting to and from text (Tom Lane) This change causes conversions of booleans to strings to produce true or false, not t or f. Other type conversions may succeed in more cases than before; for example, assigning a numeric value 3.9 to an integer variable will now assign 4 rather than failing. If no assignment-grade cast is defined for the particular source and destination types, PL/pgSQL will fall back to its old I/O conversion behavior. Allow characters in server command-line options to be escaped with a backslash (Andres Freund) Formerly, spaces in the options string always separated options, so there was no way to include a space in an option value. Including a backslash in an option value now requires writing \\. Change the default value of include_realm to 1, so that by default the realm is not removed from a GSS or SSPI principal name (Stephen Frost) Fix REASSIGN OWNED and ALTER OWNER TO to properly update permissions lists (ACLs) when changing ownership of types, foreign data wrappers, and foreign servers (Bruce Momjian) Remove server configuration parameter ssl_renegotiation_limit, which was deprecated in earlier releases (Andres Freund) While SSL renegotiation is a good idea in theory, it has caused enough bugs to be considered a net negative in practice, and it is due to be removed from future versions of the relevant standards. We have therefore removed support for it from PostgreSQL. Remove server configuration parameter autocommit, which was already deprecated and non-operational (Tom Lane) Remove pg_authid's rolcatupdate field, as it had no value (Adam Brightwell) Allow json and jsonb array extraction operators to accept negative subscripts, which count from the end of JSON arrays. Previously, these operators returned NULL for negative subscripts. (Peter Geoghegan, Andrew Dunstan) Changes Below you will find a detailed account of the changes between PostgreSQL 9.5 and the previous major release. Server Indexes Add Block Range Indexes (BRIN) (Álvaro Herrera) BRIN indexes are very compact and cheap to update by storing min/max values for a range of heap blocks. Allow queries to perform accurate distance filtering of bounding-box-indexed objects (polygons, circles) using GiST indexes (Alexander Korotkov, Heikki Linnakangas) Previously, a common table expression was required to return a large number of rows ordered by bounding-box distance, and then filtered further with a more accurate non-bounding-box distance calculation. Allow GiST indexes to perform index-only scans (Anastasia Lubennikova, Heikki Linnakangas, Andreas Karlsson) Add configuration parameter to control the size of GIN pending lists (Fujii Masao) Previously the list size was controlled by . This can also be set as an index storage parameter. Issue a warning during the creation of hash indexes because they are not crash-safe (Bruce Momjian) General Performance Improve the speed of sorting VARCHAR, TEXT, and NUMERIC fields (Peter Geoghegan, Andrew Gierth, Robert Haas) Extend the infrastructure that allows sorting to be performed by inlined, non-SQL-callable comparison functions to cover CREATE INDEX, REINDEX, and CLUSTER (Peter Geoghegan) Improve in-memory hash performance (Tomas Vondra, Robert Haas) Improve concurrency of shared buffer replacement (Robert Haas, Amit Kapila) Reduce the number of page locks and pins during index scans (Kevin Grittner) The primary benefit of this is to allow index vacuums to be blocked less often. Make backend local tracking of buffer pins memory efficient (Andres Freund) Previously each session allocated an array with space for every buffer in shared_buffers. Improve lock scalability (Andres Freund) This particularly addresses scalability problems when running on systems with multiple CPU sockets. Allow the optimizer to remove unnecessary references to left outer join subqueries (David Rowley) Allow pushdown of query restrictions into window functions, where appropriate (David Rowley) Allow non-LEAKPROOF functions to be passed into security barrier views if the function does not reference any table columns (Dean Rasheed) Speed up CRC (cyclic redundancy check) computations and switch to CRC-32C (Abhijit Menon-Sen, Heikki Linnakangas) Improve bitmap index scan performance (Teodor Sigaev, Tom Lane) Speed up CREATE INDEX by avoiding unnecessary memory copies (Robert Haas) Increase the number of buffer mapping partitions (Amit Kapila, Andres Freund, Robert Haas) This improves performance for highly concurrent workloads. Monitoring Add per-table autovacuum logging control via log_min_autovacuum_duration (Michael Paquier) NOT DOCUMENTED? Add new configuration parameter (Thomas Munro) This string, typically set in postgresql.conf, allows clients to identify the cluster. This name also appears in the process title of all server processes, allowing for easier identification of processes belonging to the same cluster. Prevent non-superusers from changing on connection startup (Fujii Masao) <acronym>SSL</> Check Subject Alternative Names in SSL server certificates, if present (Alexey Klyukin) When they are present, this replaces checks against the certificate's Common Name. Add system view pg_stat_ssl to report SSL connection information (Magnus Hagander) Add libpq function PQsslAttribute() that returns SSL information (Heikki Linnakangas) While PQgetssl() can still be used to call OpenSSL functions, PQsslAttribute() returns SSL information in an SSL-implementation-independent way. (Future versions of libpq might support other SSL implementations.) Make libpq honor any OpenSSL thread callbacks (Jan Urbanski) Previously they were overwritten. Server Settings Replace configuration parameter checkpoint_segments with and (Heikki Linnakangas) This allows the allocation of a large number of WAL files without keeping them if they are not needed. Thus the default for has been increased to 1GB. Add configuration parameter to control compression of full page images stored in WAL (Rahila Syed, Michael Paquier) Allow recording of transaction commit timestamps when configuration parameter is enabled (Álvaro Herrera, Petr Jelínek) Timestamp information can be accessed using functions pg_xact_commit_timestamp() and pg_last_committed_xact(). Allow to be set by ALTER ROLE SET (Peter Eisentraut, Kyotaro Horiguchi) Allow running autovacuum workers to respond to configuration parameter changes (Michael Paquier) Make configuration parameter read-only (Andres Freund) This means that assertions can no longer be turned off if they were enabled at compile time, allowing for more efficient code optimization. This change also removed the postgres Allow setting on systems where it has no effect (Peter Eisentraut) Add environment variables PG_OOM_ADJUST_FILE and PG_OOM_ADJUST_VALUE to help control the Linux OOM killer (Gurjeet Singh) The previous OOM control infrastructure involved a compile-time option. Add system view pg_file_settings to show the contents of the server's configuration files (Sawada Masahiko) Add pending_restart to the system view pg_settings to indicate a change is pending a restart (Peter Eisentraut) Allow ALTER SYSTEM values to be reset with ALTER SYSTEM RESET (Vik Fearing) This command removes the setting from postgresql.auto.conf. Replication and Recovery Add recovery.conf parameter recovery_target_action to control post-recovery activity (Petr Jelínek) This replaces the old parameter pause_at_recovery_target. Add new value always to allow standbys to always archive received WAL files (Fujii Masao) Add configuration parameter to control WAL read retry after failure (Alexey Vasiliev, Michael Paquier) This is particularly helpful for warm standbys. Archive WAL files with suffix .partial during standby promotion (Heikki Linnakangas) Add configuration parameter to log replication commands (Fujii Masao) By default, replication commands, e.g. IDENTIFY_SYSTEM, are not logged, even when is set to all. Allow labeling of the origin progress of logical replication changes (Andres Freund) This is helpful when implementing replication solutions. Report the processes holding replication slots in pg_replication_slots (Craig Ringer) The new output column is active_pid. Allow recovery.conf's primary_conninfo to use connection URIs, e.g. postgres:// (Alexander Shulgin) Queries Allow INSERTS that would generate constraint conflicts to be turned into UPDATEs or ignored (Peter Geoghegan, Heikki Linnakangas, Andres Freund) The syntax is INSERT ... ON CONFLICT DO NOTHING/UPDATE. This is the Postgres implementation of the popular UPSERT command. Add GROUP BY analysis functions GROUPING SETS, CUBE and ROLLUP (Andrew Gierth, Atri Sharma) Allow to set multiple columns in an UPDATE to the result of a single subselect (Tom Lane) This is accomplished using the syntax UPDATE tab SET (col1, col2, ...) = (SELECT ...). Add new SELECT option SKIP LOCKED to skip locked rows (Thomas Munro) This does not throw an error for locked rows like NOWAIT does. Add SELECT option TABLESAMPLE to return a subset of a table (Petr Jelínek) Suggest possible matches for mistyped column names (Peter Geoghegan, Robert Haas) Utility Commands Add more details about sort ordering in EXPLAIN output (Marius Timmer, Lukas Kreft, Arne Scheffer) Details include COLLATE, DESC, USING, and NULLS FIRST/LAST. Have VACUUM log the number of pages skipped due to pins (Jim Nasby) Have TRUNCATE properly update the pg_stat* tuple counters (Alexander Shulgin) <xref linkend="SQL-REINDEX"> Allow REINDEX to reindex an entire schema using the SCHEMA option (Sawada Masahiko) Add VERBOSE option to REINDEX (Sawada Masahiko) Prevent REINDEX DATABASE and SCHEMA from outputting object names, unless VERBOSE is used (Simon Riggs) Remove obsolete FORCE option from REINDEX (Fujii Masao) Object Manipulation Add row-level security control (Craig Ringer, KaiGai Kohei, Adam Brightwell, Dean Rasheed, Stephen Frost) This controls viewing and adding/modifying rows via new commands CREATE/ALTER/DROP POLICY and ALTER TABLE ... ENABLE/DISABLE ROW SECURITY. Allow changing of the WAL logging status of a table after creation with ALTER TABLE .. SET LOGGED / UNLOGGED (Fabrízio de Royes Mello) Add IF NOT EXISTS clause to CREATE TABLE AS, CREATE INDEX, CREATE SEQUENCE, and CREATE MATERIALIZED VIEW (Fabrízio de Royes Mello) Add support for IF EXISTS to ALTER TABLE ... RENAME CONSTRAINT (Bruce Momjian) Allow CURRENT/SESSION_USER to specify the current user in some commands (Kyotaro Horiguchi, Álvaro Herrera) Commands include ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and various ALTER OBJECT / OWNER TO commands. Allow comments on domain constraints (Álvaro Herrera) Reduce lock levels of some create and alter trigger and foreign key commands (Simon Riggs, Andreas Karlsson) Allow LOCK TABLE .. ROW EXCLUSIVE MODE for those with INSERT privileges (Stephen Frost) Previously only UPDATE, DELETE, and TRUNCATE privileges allowed this. Apply table and domain CHECK constraints in name order (Tom Lane) The previous order was indeterminate. Allow CREATE/ALTER DATABASE to manipulate datistemplate and datallowconn (Vik Fearing) This allows these database settings to be changed more easily than modifying the pg_database system table. <xref linkend="SQL-CREATEFOREIGNDATAWRAPPER"> Add support for IMPORT FOREIGN SCHEMA (Ronan Dunklau, Michael Paquier, Tom Lane) This command allows automatic creation of local foreign tables that match the structure of existing tables on a remote server. Allow foreign tables to participate in inheritance (Shigeru Hanada, Etsuro Fujita) This also allows foreign tables to mark check constraints as not valid, and to set storage and OID characteristics. Allow CHECK constraints to be placed on foreign tables (Shigeru Hanada, Etsuro Fujita) These constraints are assumed to be enforced on the remote server, and are not enforced locally. However, they are assumed to hold for purposes of query optimization, such as constraint exclusion. Allow foreign data wrappers and custom scans to implement join pushdown (KaiGai Kohei) <xref linkend="SQL-CREATEEVENTTRIGGER"> Add a set-returning function pg_event_trigger_ddl_commands(), which returns DDL activity associated with event triggers (Álvaro Herrera) Allow event triggers on table rewrites caused by ALTER TABLE (Dimitri Fontaine) Add event trigger support for database-level COMMENT, SECURITY LABEL, and GRANT/REVOKE (Álvaro Herrera) Add columns to the output of pg_event_trigger_dropped_objects (Álvaro Herrera) This allows simpler processing of delete operations. Data Types Allow the XML data type to accept empty or all-whitespace values (Peter Eisentraut) This is required by the SQL/XML specification. Allow MACADDR input using the format xxxx-xxxx-xxxx (Herwin Weststrate) Tighten syntax of INTERVAL precision specifications (Bruce Momjian) Only allow interval precision to be specified after the INTERVAL keyword if no units are specified. Add selectivity estimators for INET/CIDR operators and improve estimators for text search functions (Emre Hasegeli, Tom Lane) <link linkend="datatype-json"><acronym>JSON</></link> Add JSONB functions jsonb_set() and jsonb_pretty() (Dmitry Dolgov, Andrew Dunstan, Petr Jelínek) Add several generator functions for JSONB that already existed for JSON (Andrew Dunstan) These are to_jsonb(), jsonb_object(), jsonb_build_object(), jsonb_build_array(), jsonb_agg(), and jsonb_object_agg(). Reduce casting requirements to/from JSON and JSONB (Tom Lane) Allow TEXT, TEXT array, and INTEGER values to be subtracted from JSONB documents (Dmitry Dolgov, Andrew Dunstan) Add JSONB operator || (Dmitry Dolgov, Andrew Dunstan) Add json_strip_nulls() and jsonb_strip_nulls() functions to remove JSON null values from documents (Andrew Dunstan) Functions Add generate_series() for NUMERIC values (Plato Malugin) Allow array_agg() and ARRAY() to take arrays as inputs (Ali Akbar, Tom Lane) Add functions array_position() and array_positions() to return subscripts of array values (Pavel Stehule) Add point-to-polygon distance operator (<->) (Alexander Korotkov) Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING (Jeff Davis) Previously, only a single-byte character was allowed as an escape. Add a width_bucket() variant that supports any sortable data type and non-uniform bucket widths (Petr Jelínek) Add an optional missing_ok argument to pg_read_file() and related functions (Michael Paquier, Heikki Linnakangas) Allow => to specify named parameters in function calls (Pavel Stehule) Previously only := could be used. This requires removing the possibility for => to be a user-defined operator. Creation of user-defined => operators has been issuing warnings since Postgres 9.0. Add POSIX-compliant rounding for platforms that use Postgres-supplied rounding functions (Pedro Gimeno Fortea) System Information Functions and Views Add function pg_get_object_address() to return OIDs that uniquely identify an object, and function pg_identify_object_as_address() to return object information based on OIDs (Álvaro Herrera) Loosen security checks for viewing queries in pg_stat_activity, executing pg_cancel_backend(), and executing pg_terminate_backend() (Stephen Frost) Now, role membership is sufficient; previously only the same role could perform these operations. Add pg_stat_get_snapshot_timestamp() to output the timestamp of the statistics snapshot (Matt Kelly) This represents the last time the snapshot files was written to the file system. Add mxid_age() to compute multi-xid age (Bruce Momjian) Add data types regrole regnamespace that returns the OID of a role (Kyotaro Horiguchi) Aggregates Add MIN()/MAX() aggregates for INET/CIDR data types (Haribabu Kommi) Use 128-bit integers, where supported, as aggregate accumulators (Andreas Karlsson) Server-Side Languages Improve support for composite types in PL/Python (Ed Behn, Ronan Dunklau) This allows PL/Python functions to return arrays of composite types. Reduce lossiness of PL/Python floating value conversions (Marko Kreen) Allow specification of conversion routines between SQL data types and data types of procedural languages (Peter Eisentraut) This change adds new commands CREATE/DROP TRANSFORM. This also adds optional transformations between the hstore and ltree types to/from PL/Perl and PL/Python. <link linkend="plpgsql">PL/pgSQL</link> Server-Side Language Improve PL/pgSQL array performance (Tom Lane) Add ASSERT statement in PL/pgSQL (Pavel Stehule) Allow more PL/pgSQL keywords to be used as identifiers (Tom Lane) Client Applications Move pg_archivecleanup, pg_test_fsync, pg_test_timing, and pg_xlogdump from contrib to src/bin (Peter Eisentraut) Add pg_rewind, which allows re-synchronizing a master server after failback (Heikki Linnakangas) Allow pg_receivexlog to manage physical replication slots (Michael Paquier) This is controlled via new Allow the pg_receivexlog to synchronously flush WAL to storage using Without this, WAL files are fsynced only on close. Allow vacuumdb to vacuum in parallel using Add Make pg_basebackup use a tablespace mapping file when using tar format, to support symbolic links and file paths of 100+ characters in length on MS Windows (Amit Kapila) Add pg_xlogdump option <xref linkend="APP-PSQL"> Allow psql to produce AsciiDoc output (Szymon Guz) Add errors mode to psql's ECHO variable to display only failed commands (Pavel Stehule) This can also be enabled with the psql Allow column, header, and border control to psql's Unicode style (Pavel Stehule) Single or double output is supported; the default is single. Add psql PROMPT variables option (%l) to display the multi-line statement line number (Sawada Masahiko) Add psql setting pager_min_lines to control pager invocation (Andrew Dunstan) Improve psql line counting used when deciding to invoke the pager (Andrew Dunstan) Add psql tab completion when setting the variable (Jeff Janes) Currently only the first schema can be tab-completed. Improve psql's tab completion for triggers and rules (Andreas Karlsson) <link linkend="APP-PSQL-meta-commands">Backslash Commands</link> Add psql \? help sections variables and options (Pavel Stehule) variables outputs psql variables and options shows command-line options. \? commands is the default output. This help information can also be output via --help=section. Show tablespace size in psql's \db+ (Fabrízio de Royes Mello) Show data type owners in psql's \dT+ (Magnus Hagander) Allow psql's \watch to output \timing information (Fujii Masao) Also prevent Allow psql's \sf and \ef to honor ECHO_HIDDEN (Andrew Dunstan) Improve psql tab completion for \set, \unset, and :variable names (Pavel Stehule) Allow tab completion of role names in psql \c commands (Ian Barwick) <xref linkend="APP-PGDUMP"> Allow pg_dump to share a snapshot taken by another session using The remote snapshot must have been exported by pg_export_snapshot() or logical replication slot creation. This can be used by another pg_dump to use a share a consistent snapshot across pg_dump processes. Always have pg_dump print server and pg_dump versions (Jing Wang) Previously, version information was only printed in Remove the long-ignored <xref linkend="app-pg-ctl"> Allow multiple pg_ctl Allow control of pg_ctl's event source logging on MS Windows (MauMau) This only controls pg_ctl, not the server, which has separate settings in postgresql.conf. <xref linkend="pgupgrade"> Move pg_upgrade from contrib to src/bin (Peter Eisentraut) In connection with this change, the functionality previously provided by the pg_upgrade_support module has been moved into the core server. Allow multiple pg_upgrade Improve database collation comparisons in pg_upgrade (Heikki Linnakangas) Document the use of rsync for standby server upgrades using pg_upgrade (Stephen Frost, Bruce Momjian) Remove support for upgrading from 8.3 clusters (Bruce Momjian) <xref linkend="pgbench"> Move pgbench from contrib to src/bin (Peter Eisentraut) Allow counting of pgbench transactions that take over a specified amount of time (Fabien Coelho) This is controlled by new Allow pgbench to generate Gaussian/exponential distributions using \setrandom (Kondo Mitsumasa, Fabien Coelho) Allow pgbench's \set command to handle multi-operator expressions (Robert Haas, Fabien Coelho) Source Code Simplify WAL record format (Heikki Linnakangas) This allows external tools to more easily track what blocks are modified. Add atomic memory operations API (Andres Freund) Allow custom path and scan methods (KaiGai Kohei, Tom Lane) This allows extensions greater control over the optimizer and executor. Allow foreign data wrappers to do post-filter locking (Etsuro Fujita) Foreign tables can now take part in INSERT ... ON CONFLICT DO NOTHING queries (Peter Geoghegan, Heikki Linnakangas, Andres Freund) Foreign data wrappers must be modified to handle this. INSERT ... ON CONFLICT DO UPDATE is not supported on foreign tables. Improve hash_create()'s API for selecting simple-binary-key hash functions (Teodor Sigaev, Tom Lane) Improve parallel execution infrastructure (Robert Haas, Amit Kapila, Noah Misch, Rushabh Lathia, Jeevan Chalke) Remove Alpha (CPU) and Tru64 (OS) ports (Andres Freund) Remove swap-byte-based spinlock implementation for ARMv5 and earlier CPUs (Robert Haas) ARMv5's weak memory ordering made this locking implementation unsafe. Spinlock support is still possible on newer gcc implementations with atomics support. Generate an error when excessively long (100+ character) file paths are written to tar files (Peter Eisentraut) Tar does not support such overly-long paths. Change index opclass for columns pg_seclabel.provider and pg_shseclabel.provider to be text_pattern_ops (Tom Lane) This avoids possible problems with these indexes when different databases of a cluster have different default collations. Change the spinlock primitives to function as compiler barriers (Robert Haas) MS Windows Allow higher-precision timestamp resolution on Windows 8 or Windows Server 2012 and later Windows systems (Craig Ringer) Install shared libraries to bin in MS Windows (Peter Eisentraut, Michael Paquier) Install src/test/modules together with contrib on MSVC builds (Michael Paquier) Allow configure's Pass PGFILEDESC into MSVC contrib builds (Michael Paquier) Add icons to all MSVC-built binaries and version information to all MS Windows binaries (Noah Misch) MinGW already had such icons. Add optional-argument support to the internal getopt_long() implementation (Michael Paquier, Andres Freund) This is used by the MSVC build. Additional Modules Add statistics for minimum, maximum, mean, and standard deviation times to pg_stat_statements (Mitsumasa Kondo, Andrew Dunstan) Add pgcrypto function pgp_armor_headers() to extract PGP armor headers (Marko Tiikkaja, Heikki Linnakangas) Allow empty replacement strings in unaccent (Mohammad Alhashash) This is useful in languages where diacritic signs are represented as separate characters. Allow multi-character source strings in unaccent (Tom Lane) This could be useful in languages where diacritic signs are represented as separate characters. It also allows more complex unaccent dictionaries. Add contrib modules tsm_system_rows and tsm_system_time to allow additional table sampling methods (Petr Jelínek) Add GIN index inspection functions to pageinspect (Heikki Linnakangas, Peter Geoghegan, Michael Paquier) Add information about buffer pins to pg_buffercache display (Andres Freund) Allow pgstattuple to report approximate answers with less overhead using pgstattuple_approx() (Abhijit Menon-Sen) Move dummy_seclabel, test_shm_mq, test_parser, and worker_spi from contrib to src/test/modules (Álvaro Herrera) These modules are only meant for server testing, so they do not need to be built or installed when packaging PostgreSQL.