RefLib

Reference library for AI

Back

postgresql_16:9.5.16.3 Changes

PostgreSQL 16 > Appendixes > Release Notes > Release 16 > Changes

Below you will find a detailed account of the changes between PostgreSQL 16 and the previous major release.

Server

Optimizer

The new server variable enable_presorted_aggregate (see guc-enable-presorted-aggregate) can be used to disable this.

General Performance

This makes full-table freeze vacuums less necessary.

The VACUUM (see postgresql_16:7.1.182)/ANALYZE (see postgresql_16:7.1.44) option is BUFFER_USAGE_LIMIT, and the vacuumdb (see postgresql_16:7.2.20) option is --buffer-usage-limit. The default value is set by server variable vacuum_buffer_usage_limit (see guc-vacuum-buffer-usage-limit), which also controls autovacuum.

ASCII detection is particularly useful for COPY FROM (see postgresql_16:7.1.53). Vector operations are also used for some C array searches.

Monitoring

This information appears in pg_stat_*_tables (see pg-stat-all-tables-view) and pg_stat_*_indexes (see postgresql_16:4.13.2.19).

The pg_stat_*_tables column is n_tup_newpage_upd (see postgresql_16:4.13.2.18).

The transaction id is displayed in the transactionid column and the speculative insertion token is displayed in the objid column.

Previously entries were created only when the first statistics were reported.

Previously the index values might change during the lifetime of the session.

Previously this type of wait was reported as DSMFillZeroWrite, which was also used by mmap() allocations.

Physical WAL senders do not display a database name.

Privileges

This is accomplished with the option password_required=false (see postgresql_16:7.1.82).

Previously a user's ability to perform LOCK TABLE at various lock levels was limited to the lock levels required by the commands they had permission to execute on the table. For example, someone with UPDATE (see postgresql_16:7.1.181) permission could perform all lock levels except ACCESS SHARE, even though it was a lesser lock level. Now users can issue lesser lock levels if they already have permission for greater lock levels.

Previously CREATEROLE permission was required.

Previously only the WITH ADMIN OPTION syntax was supported.

This is controlled by server variable createrole_self_grant (see guc-createrole-self-grant).

This is now only allowed for inherited roles.

This is a requirement even when a non-bootstrap superuser is granting role membership.

The current user still must have sufficient permissions given by the specified granted-by user.

This is controlled by a new GRANT ... SET option.

For example, removing ADMIN OPTION will fail if there are privileges using that option; CASCADE must be used to revoke dependent permissions.

This guarantees that pg_auth_members (see postgresql_16:8.2.9).grantor values are always valid.

Previously a new membership grant would remove a previous matching membership grant, even if other aspects of the grant did not match.

Restoring such users could lead to errors.

Previously only a single privilege name, like SELECT (see postgresql_16:7.1.170), was accepted.

Server Configuration

This is enabled with server variable gss_accept_delegation (see guc-gss-accept-delegation) and libpq connection parameter gssdelegation (see libpq-connect-gssdelegation).

Previously, while certain variables, like transaction_isolation (see guc-default-transaction-isolation), were not affected by RESET ALL (see postgresql_16:7.1.163), they could be individually reset in inappropriate situations.

This also affects the categories displayed in the pg_settings (see postgresql_16:8.3.24) view.

Rather than honor changes only at the start of each relation, honor them at the start of each block.

The archive_command (see guc-archive-command) command is now more likely to be called with already-archived files after a crash.

Previously archive_library would override archive_command.

This allows collection of a core dump for a stuck child process. This is controlled by send_abort_for_crash (see guc-send-abort-for-crash) and send_abort_for_kill (see guc-send-abort-for-kill). The postmaster's -T switch is now the same as setting send_abort_for_crash.

The number of reserved slots is set by server variable reserved_connections (see guc-reserved-connections).

This adds the special handling required to enable huge pages on newer versions of Windows 10.

While primarily for developers, wal_sync_method=open_sync (see guc-wal-sync-method)/open_datasync has been modified to not use direct I/O with wal_level=minimal; this is now enabled with debug_io_direct=wal.

pg_hba.conf (see postgresql_16:4.6.1)

Regular expression patterns are prefixed with a slash. Database and role names that begin with slashes need to be double-quoted if referenced in pg_hba.conf.

Specifically, add support for all, role membership with +, and regular expressions with a leading slash. Any user name that matches these patterns must be double-quoted.

These are controlled by include, include_if_exists, and include_dir. System views pg_hba_file_rules (see postgresql_16:8.3.9) and pg_ident_file_mappings (see postgresql_16:8.3.10) now display the file name.

Localization (see postgresql_16:4.9)

Previously the default was always UTF-8.

Previously they only controlled libc providers.

This only works if ICU support is enabled.

This is done using CREATE COLLATION (see postgresql_16:7.1.57)'s new RULES clause, as well as new options for CREATE DATABASE (see postgresql_16:7.1.59), createdb (see postgresql_16:7.2.2), and initdb (see postgresql_16:7.3.1).

Previously, only ICU locales could be imported on Windows.

Logical Replication (see postgresql_16:4.16)

Snapshot WAL records are required for logical slot creation but cannot be created on standbys. To avoid delays, the new function pg_log_standby_snapshot() (see functions-snapshot-synchronization-table) allows creation of such records.

The variable is debug_logical_replication_streaming (see guc-debug-logical-replication-streaming).

This is only possible for subscriptions marked as binary.

The CREATE SUBSCRIPTION (see postgresql_16:7.1.82) STREAMING option now supports parallel to enable application of large transactions by parallel workers. The number of parallel workers is controlled by the new server variable max_parallel_apply_workers_per_subscription (see guc-max-parallel-apply-workers-per-subscription). Wait events LogicalParallelApplyMain (see wait-event-activity-table), LogicalParallelApplyStateChange, and LogicalApplySendData were also added. Column leader_pid was added to system view pg_stat_subscription (see postgresql_16:4.13.2.8) to track parallel activity.

Specifically, REPLICA IDENTITY FULL can now use btree indexes rather than sequentially scanning the table to find matches.

This can be used to avoid replication loops. This is controlled by the new CREATE SUBSCRIPTION ... ORIGIN option.

This improves security and now requires subscription owners to be either superusers or to have SET ROLE (see postgresql_16:7.1.174) permission on all roles owning tables in the replication set. The previous behavior of performing all operations as the subscription owner can be enabled with the subscription run_as_owner (see postgresql_16:7.1.82) option.

Previously the retry time was applied globally. This also adds wait events >LogicalRepLauncherDSA (see wait-event-lwlock-table) and LogicalRepLauncherHash.

Utility Commands

This is controlled by the postgres_fdw (see postgresql_16:9.6.38) option batch_size (see postgresql_16:9.6.38.1).

Previously only ALTER TABLE (see postgresql_16:7.1.33) could control this.

This is accomplished by having VACUUM (see postgresql_16:7.1.182) turn off PROCESS_MAIN or by vacuumdb (see postgresql_16:7.2.20) using the --no-process-main option.

The options are SKIP_DATABASE_STATS and ONLY_DATABASE_STATS.

Previously the database name had to be specified.

Data Types

For example, 0x42F, 0o273, and 0b100101.

Previously only unquoted eight-byte integers were supported with these non-decimal bases.

This can improve readability for long strings of digits.

General Queries

For example, allow hexadecimal, octal, and binary integers and underscores between digits.

Functions

The new functions JSON_ARRAY() (see functions-json-creation-table), JSON_ARRAYAGG() (see functions-aggregate-table), JSON_OBJECT(), and JSON_OBJECTAGG() are part of the SQL standard.

The IS JSON (see functions-sqljson-misc) checks include checks for values, arrays, objects, scalars, and unique keys.

The functions are date_add() (see functions-datetime-table), date_subtract(), and generate_series() (see functions-srf-series).

This allows the creation of expression indexes using this function.

This reports the authentication method and its authenticated user.

Previously it returned NULL.

PL/pgSQL (see postgresql_16:6.6)

This is accomplished with GET DIAGNOSTICS variable = PG_ROUTINE_OID (see postgresql_16:6.6.5.5).

libpq (see postgresql_16:5.1)

This can also be used to disallow certain authentication methods.

This is enabled with load_balance_hosts=random (see libpq-connect-load-balance-hosts) and can be used for load balancing.

The option values are disable, allow, and require.

This is enabled with sslrootcert=system (see libpq-connect-sslrootcert), which also enables sslmode=verify-full (see libpq-connect-sslmode).

Client Applications

This change does prevent keywords which match C typedef names from being processed as keywords in later EXEC SQL blocks.

(see postgresql_16:7.2.18)

This is controlled by xheader_width (see postgresql_16:7.2.18.4).

The Member of output column has been removed from \du and \dg because this new command displays this information in more detail.

The options are \dpS (see postgresql_16:7.2.18.4) and \zS (see postgresql_16:7.2.18.4).

Function bodies are more easily viewed with \sf (see postgresql_16:7.2.18.4).

Passing arguments to such queries is done using the new psql \bind (see postgresql_16:7.2.18.4) command.

The \watch options can now be named when specified.

The new psql control variables are SHELL_ERROR (see postgresql_16:7.2.18.4) and SHELL_EXIT_CODE (see postgresql_16:7.2.18.4).

pg_dump (see postgresql_16:7.2.11)

The new options are --table-and-children, --exclude-table-and-children, and --exclude-table-data-and-children.

Options like --compress=gzip:5.

Server Applications

The option is -c name=value.

Specifically, the new options control the valid-until date, bypassing of row-level security, and role membership.

This option could be easily confused with new createuser role membership options, so option --member-of has been added with the same functionality. The --role option can still be used.

These are controlled by options --schema and --exclude-schema.

This removes the requirement that the new cluster be created with the same locale and encoding settings.

The option is --copy.

Options like --compress=server-5 are now supported.

Previously if pg_rewind was run after a timeline switch but before a checkpoint was issued, it might incorrectly determine that a rewind was unnecessary.

This signal is often used by systemd.

Source Code

This removes build flag (see postgresql_16:4.2) --with-icu and adds flag --without-icu.

This was already enabled on MinGW builds.

Functions that need to be called from the core backend or other extensions must now be explicitly marked PGDLLEXPORT.

Previously Windows Vista and Windows XP were supported.

Backend support for this authentication method was removed in PostgresSQL 9.1.

This eventually will replace the Autoconf and Windows-based MSVC build systems.

Make finding openssl program a configure or meson option

The build options are --with-segsize-blocks (see postgresql_16:4.2.3.3) and -Dsegsize_blocks.

The new options are --show-diff, --silent-diff, --commit, and --help, and allow multiple --exclude options. Also require the typedef file to be explicitly specified. Options --code-base and --build were also removed.

Additional Modules

This affects queries using server-side PREPARE (see postgresql_16:7.1.157)/EXECUTE (see postgresql_16:7.1.145) and client-side parse/bind. Logging is controlled by auto_explain.log_parameter_max_length (see auto-explain-configuration-parameters-log-parameter-max-length); by default query parameters will be logged with no length restriction.

Previously even if compute_query_id was enabled, log_verbose (see auto-explain-configuration-parameters-log-verbose) was not showing the query identifier.

Previously constants appeared instead of placeholders, e.g., $1.

Previously ending LSNs which represent nonexistent WAL locations would generate an error, while they will now be interpreted as the end of the WAL.

This is similar to bt_page_stats() except it can report on a range of pages.

Initialization changes will require modules written for older versions of Postgres to be updated.

This allows @extschema:referenced_extension_name@ to be treated as a constant for the lifetime of the extension.

postgres_fdw (see postgresql_16:9.6.38)

This is enabled with postgres_fdw option parallel_abort (see postgresql_16:9.6.38.1).

The postgres_fdw option analyze_sampling (see postgresql_16:9.6.38.1) controls the sampling method.

Back