Release 9.5 Release Date AS OF 2015-06-01 2015-XX-XX Overview Major enhancements in PostgreSQL 9.5 include: 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) "<" and ">" now have the same precedence as "<=" ">=" and "<>", and IS now has lower precedence. NOT now also has symmetric precedence. The GUC operator_precedence_warning can be enabled to warn about queries where the precedence has changed. Use cast conversions for PL/pgSQL type conversions, rather than converting to and from text (Tom Lane) This causes conversions of booleans to strings to return true or false, not t/f. Allow special characters in server startup option values to be escaped with a backslash (Andres Freund) This allows characters like spaces to be passed inside option values. Passing a backslash now requires supplying a double-backslash. Set the default value of include_realm to not remove the GSS and SSPI realm from the principal (Stephen Frost) Fix REASSIGN and ALTER OWNER TO to properly reassign ownership of types, foreign data wrappers, and foreign servers (Bruce Momjian) Remove server-side GUC autocommit, which was already deprecated and non-operational (Tom Lane) Remove pg_authid.rolcatupdate, as it had no purpose (Adam Brightwell) 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, Heikki Linnakangas, Emre Hasegeli) BRIN indexes are very compact and store the 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 GUC gin_pending_list_limit to control the size of GIN pending lists (Fujii Masao) Previously this was controlled by work_mem. 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 character and numeric fields (Peter Geoghegan, Andrew Gierth, Robert Haas) Improve in-memory hash performance (Tomas Vondra, Robert Haas) Improve concurrency of shared buffer replacement (Robert Haas, Amit Kapila) Improve concurrent locking and buffer scan performance (Andres Freund, Kevin Grittner) 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) Speed up CRC (cyclic redundancy check) computations (Abhijit Menon-Sen, Heikki Linnakangas) Also use CPU instructions for CRC calculations, if supported Monitoring Add per-table autovacuum logging control via log_min_autovacuum_duration (Michael Paquier) NOT DOCUMENTED? Add GUC variable cluster_name (Thomas Munro) This string, set in postgresql.conf, allows clients to query the cluster name. This name also appears in the process title, allowing for easier grouping of processes belonging to the same cluster. Prevent non-superusers from changing log_disconnections on connection startup (Fujii Masao) <acronym>SSL</> Check Subject Alternative Names in SSL server certificates, if present (Alexey Klyukin) Their presence 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 then call OpenSSL functions, PQsslAttribute() returns SSL information in an SSL-implementation-independent way. (Future versions of libpq might support other SSL implementations.) Have libpq honor any OpenSSL thread callbacks (Jan Urbanski) Previously they were overwritten. Server Settings Replace checkpoint_segments with min_wal_size and max_wal_size (Heikki Linnakangas) This allows the allocation of a large number of WAL files without keeping them if they are not needed. Add GUC wal_compression to enable compression of full page images stored in WAL (Rahila Syed, Michael Paquier) Allow the recording of transaction commit timestamps when GUC track_commit_timestamp is enabled (Álvaro Herrera, Petr Jelínek) Timestamp information can be accessed using functions pg_xact_commit_timestamp() and pg_last_committed_xact(). Allow local_preload_libraries to be set by ALTER ROLE SET (Peter Eisentraut, Kyotaro Horiguchi) Allow running autovacuum workers to respond to configuration parameter changes (Michael Paquier) Make GUC debug_assertions read-only (Andres Freund) This means that assertions can no longer be turned off once enabled at compile-time, allowing for more efficient code optimization. This also removed the postgres Allow setting effective_io_concurrency on systems where it has no effect (Peter Eisentraut) Add environment variables PG_OOM_ADJUST_FILE and PG_OOM_ADJUST_VALUE to control Linux OOM killer (Gurjeet Singh) The previous OOM control involved a compile-time option. Add function and view pg_file_settings to show the source of GUC values set in 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 removes the setting from postgresql.auto.conf. Replication and Recovery Add recovery.conf parameter recovery_target_action to control post-recovery activity (Petr Petr Jelínek) GUC pause_at_recovery_target was also removed. Add archive_mode always to allow standbys to always archive received WAL files (Fujii Masao) Add GUC wal_retrieve_retry_interval 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 GUC log_replication_commands to log replication commands (Fujii Masao) By default, replication commands, e.g. IDENTIFY_SYSTEM, are not logged, even when log_statement is set to all. Allow the labeling of the origin of logical replication changes (Andres Freund) This helps with change tracking. Report the backends 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 multi-column UPDATEs with 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 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 control of table WAL logging after table 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 allows the creation of local foreign tables definitions that match the remote table structure. Currently, only the postgres_fdw foreign data wrapper supports this feature. 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 checks are assumed to be enforced on the remote server, and are not checked locally. However, they are considered for optimization and constraint-exclusion checking. Allow foreign data wrappers and custom scans to implement join pushdown (KaiGai Kohei) <xref linkend="SQL-CREATEEVENTTRIGGER"> Add pg_event_trigger_ddl_commands set-returning function, 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. Fix XML xpath() handling to return namespace declarations even if the namespace is in a parent element (Ali Akbar) Previously the namespace was not returned, leading to invalid XML. Allow MACADDR input using the format xxxx-xxxx-xxxx (Herwin Weststrate) Tighten specification 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 exist for JSON (Andrew Dunstan) The functions 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 width_bucket() which supports any sortable data type and non-uniform bucket widths (Petr Jelínek) Allow => to specify named parameters in function calls (Pavel Stehule) User-defined => operators have been issuing warnings since Postgres 9.0, and were removed in hstore in 9.2. Previously only := could be used. 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 (Álvaro Herrera) Add function pg_identify_object_as_address() to return object information based on OIDs (Álvaro Herrera) Loosen security checks for viewing pg_stat_activity, pg_cancel_backend(), and pg_terminate_backend (Stephen Frost) Now, role membership is sufficient; previously only the same role could perform such 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 type regrole that returns the OID of a role (Kyotaro Horiguchi) Add data type regnamespace that returns the OID of a schema (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) Add specification of conversion routines to/from SQL data types to procedural languages data types (Peter Eisentraut) This adds new commands CREATE/DROP TRANSFORM. This also adds transformations between hstore and ltree 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) 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 Have pg_basebackup use a tablespace mapping file with the tar format, to handle file paths of 100+ characters in length and sybolic links on MS Windows (Amit Kapila) <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 setting 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 search_path variable (Jeff Janes) Currently only the first schema can be tab-completed. Improve psql 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 \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 psql \c role names (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 been defined when creating a logical replication slot. This can be used by parallel pg_dump to use 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 <xref linkend="app-pg-ctl"> Change pg_ctl default shutdown mode from smart to fast (Bruce Momjian) 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) 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) Move pg_upgrade_support code into backend and remove the module (Peter Eisentraut) Source Code Simplify WAL record format (Heikki Linnakangas) This allows external tools to more easily track what blocks are modified. Add basic atomics API support (Andres Freund, Oskari Saarenmaa) Add native compiler and memory barriers for Solaris Studio (Oskari Saarenmaa) IS THIS PART OF ATOMICS? 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) Improve dynahash capabilities (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 columns pg_seclabel.provider and pg_shseclabel.provider to TEXT (Tom Lane) This allows these columns to store 64+ characters. 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 pg_rewind, which allows re-synchronizing a master server after failback (Heikki Linnakangas) 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 pg_xlogdump option Allow 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) <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)