Advanced Server 12 integrates all of the community PostgreSQL 12 features. To review a complete list of changes to the community PostgreSQL project and the contributors names, see the PostgreSQL 12 Release Notes at:Allow tables with thousands of child partitions to be processed efficiently by operations that only affect a small number of partitions.Such expressions are evaluated at partitioned-table creation time. Previously, only simple constants were allowed as partition bounds.Allow CREATE TABLE's tablespace specification for a partitioned table to affect the tablespace of its children.The new function 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.Fix bugs that could cause ALTER TABLE DETACH PARTITION to leave behind incorrect dependency state, allowing subsequent operations to misbehave, for example by not dropping a former partition child index when its table is dropped.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 it reduced VACUUM's ability to recycle entire pages. Duplicate index entries are now sorted in heap-storage order.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.This improves optimization for queries that test several columns, requiring an estimate of the combined effect of several WHERE clauses. If the columns are correlated and have non-uniform distributions then multi-column statistics will allow much better estimates.Specifically, CTEs are automatically inlined if they have no side-effects, are not recursive, and are referenced only once in the query. Inlining can be prevented by specifying MATERIALIZED, or forced for multiply-referenced CTEs by specifying NOT MATERIALIZED. Previously, CTEs were never inlined and were always evaluated before the rest of the query.Improve optimizer's ability to verify that partial indexes with IS NOT NULL conditions are usable in queries.Usability can now be recognized in more cases where the calling query involves casts or large x IN (array) clauses.Previously, the database's default collation was used for all statistics. This potentially gives better optimizer behavior for columns with non-default collations.This allows some optimizations that previously would not have been applied in the presence of security barrier views or row-level security.Note that this support is not built by default, but has to be selected explicitly while configuring the build.Allow ALTER TABLE ... SET DATA TYPE changing between timestamp and timestamptz to avoid a table rewrite when the session time zone is UTC.The new columns are client_serial and issuer_dn. Column clientdn has been renamed to client_dn for clarity.This feature allows TCP/IP connections to be encrypted when using GSSAPI authentication, without having to set up a separate encryption facility such as SSL. In support of this, add hostgssenc and hostnogssenc record types in pg_hba.conf for selecting connections that do or do not use GSSAPI encryption, corresponding to the existing hostssl and hostnossl record types. There is also a new gssencmode libpq option, and a pg_stat_gssapi system view.Allow the clientcert pg_hba.conf option to check that the database user name matches the client certificate's common name.This avoids the requirement of specifying ldapserver. It is only supported if PostgreSQL is compiled with OpenLDAP.For example, SET work_mem = '30.1GB' is now allowed, even though work_mem is an integer parameter. The value will be rounded to an integer after any required units conversion.These parameters are archive_cleanup_command, promote_trigger_file, recovery_end_command, and recovery_min_apply_delay.The functions for this are pg_copy_physical_replication_slot() and pg_copy_logical_replication_slot().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.Previously, ALTER TYPE ... ADD VALUE could not be called in a transaction block, unless it was part of the same transaction that created the enumerated type. Now it can be called in a later transaction, so long as the new enumerated value is not referenced until after it is committed.These options are vacuum_truncate and toast.vacuum_truncate. Use of these options reduces VACUUM's locking requirements, but prevents returning disk space to the operating system.This change adds a VACUUM command option INDEX_CLEANUP as well as a table storage option vacuum_index_cleanup. Use of this option reduces the ability to reclaim space and can lead to index bloat, but it is helpful when the main goal is to freeze old tuples.Prevent TRUNCATE, VACUUM and ANALYZE from requesting a lock on tables for which the user lacks permission.Modifications of catalogs' reloptions and autovacuum settings are now supported. (Setting allow_system_table_mods is still required.)Previously, only the first column name was included in the constraint name, resulting in ambiguity for multi-column foreign keys.This adds word stemming support for Arabic, Indonesian, Irish, Lithuanian, Nepali, and Tamil to full text search.This feature supports “nondeterministic” collations that can define case- and accent-agnostic equality comparisons. Thus, for example, a case-insensitive uniqueness constraint on a text column can be made more easily than before. This is only supported for ICU collations.Type name now behaves much like a domain over type text that has default collation “C”. This allows cross-type comparisons to be processed more efficiently.Specifically, in XMLTABLE, xpath(), and xmlexists(), fix some cases where nothing was output for a node, or an unexpected error was thrown, or necessary escaping of XML special characters was omitted.This SQL-standard clause has no effect in PostgreSQL's implementation, but it was unnecessarily being rejected.Prevent current_schema() and current_schemas() from being run by parallel workers, as they are not parallel-safe.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.Allow SQL commands and variables with the same names as those commands to be used in the same PL/pgSQL function.For example, allow a variable called comment to exist in a function that calls the COMMENT SQL command. Previously this combination caused a parse error.This is enabled by setting the environment variable PG_COLOR to always or auto. The specific colors used can be adjusted by setting the environment variable PG_COLORS, using ANSI escape codes for colors. For example, the default behavior is equivalent to PG_COLORS="error=01;31:warning=01;35:locus=01".Improve tab completion of CREATE TABLE, CREATE TRIGGER, CREATE EVENT TRIGGER, ANALYZE, EXPLAIN, VACUUM, ALTER TABLE, ALTER INDEX, ALTER DATABASE, and ALTER INDEX ALTER COLUMN.This prevents the server from being shut down if the shell script that invoked pg_ctl is interrupted later.The --clone option has the advantages of --link, while preventing the old cluster from being changed after the new cluster has started.When pg_dump emits data with INSERT commands rather than COPY, allow more than one data row to be included in each INSERT.Decouple the order of operations in a parallel pg_dump from the order used by a subsequent parallel pg_restore.This allows pg_restore to perform more-fully-parallelized parallel restores, especially in cases where the original dump was not done in parallel. Scheduling of a parallel pg_dump is also somewhat improved.This is primarily useful for making dumps that are exactly comparable across different source server versions. It is not recommended for normal use, as it may result in loss of precision when the dump is restored.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 planner support function interfaces to improve optimizer estimates, inlining, and indexing for functions.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.Simplify renumbering manually-assigned OIDs, and establish a new project policy for management of such OIDs.Patches that manually assign OIDs for new built-in objects (such as new functions) should now randomly choose OIDs in the range 8000—9999. At the end of a development cycle, the OIDs used by committed patches will be renumbered down to lower numbers, currently somewhere in the 4xxx range, using the new renumber_oids.pl script. This approach should greatly reduce the odds of OID collisions between different in-process patches.While there is no specific policy reserving any OIDs for external use, it is recommended that forks and other projects needing private manually-assigned OIDs use numbers in the high 7xxx range. This will avoid conflicts with recently-merged patches, and it should be a long time before the core project reaches that range.printf-family functions, as well as strerror and strerror_r, now behave uniformly across platforms within Postgres code.Notably, printf understands %m everywhere; on Windows, strerror copes with Winsock error codes (it used to do so in backend but not frontend code); and strerror_r always follows the GNU return convention.This affects only the INSTALL file generated during make dist and the seldom-used plain-text postgres.txt output file. Pandoc produces better output than lynx and avoids some locale/encoding issues. Pandoc version 1.13 or later is required.