diff options
-rw-r--r-- | doc/src/sgml/release-18.sgml | 274 | ||||
-rw-r--r-- | src/backend/commands/indexcmds.c | 38 | ||||
-rw-r--r-- | src/backend/optimizer/path/joinpath.c | 9 | ||||
-rw-r--r-- | src/backend/optimizer/path/joinrels.c | 60 | ||||
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 46 | ||||
-rw-r--r-- | src/backend/optimizer/util/paramassign.c | 39 | ||||
-rw-r--r-- | src/include/optimizer/paramassign.h | 2 | ||||
-rw-r--r-- | src/include/optimizer/paths.h | 2 | ||||
-rw-r--r-- | src/makefiles/pgxs.mk | 3 | ||||
-rw-r--r-- | src/test/recovery/t/046_checkpoint_logical_slot.pl | 31 | ||||
-rw-r--r-- | src/test/recovery/t/047_checkpoint_physical_slot.pl | 23 | ||||
-rw-r--r-- | src/test/regress/expected/join.out | 84 | ||||
-rw-r--r-- | src/test/regress/sql/join.sql | 29 |
13 files changed, 386 insertions, 254 deletions
diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index 11a4f99a272..fe0a49c0d73 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -95,7 +95,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Deprecate MD5 password authentication (Nathan Bossart) +Deprecate <link linkend="auth-password">MD5 password</link> authentication (Nathan Bossart) <ulink url="&commit_baseurl;db6a4a985">§</ulink> </para> @@ -137,7 +137,7 @@ Prevent <link linkend="sql-copy"><command>COPY FROM</command></link> from treati <para> <xref linkend="app-psql"/> will still treat <literal>\.</literal> as an end-of-file marker when reading <acronym>CSV</acronym> files from <literal>STDIN</literal>. Older <application>psql</application> clients connecting to <productname>PostgreSQL</productname> 18 servers might -experience <literal>\copy</literal> problems. This +experience <link linkend="app-psql-meta-commands-copy"><literal>\copy</literal></link> problems. This release also enforces that <literal>\.</literal> must appear alone on a line. </para> </listitem> @@ -165,7 +165,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Execute <literal>AFTER</literal> triggers as the role that was active when trigger events were queued (Laurenz Albe) +Execute <literal>AFTER</literal> <link linkend="triggers">triggers</link> as the role that was active when trigger events were queued (Laurenz Albe) <ulink url="&commit_baseurl;01463e1cc">§</ulink> </para> @@ -219,7 +219,7 @@ Author: Fujii Masao <fujii@postgresql.org> <listitem> <para> -Change <structname>pg_backend_memory_contexts</structname>.<structfield>level</structfield> and <function>pg_log_backend_memory_contexts()</function> to be one-based (Melih Mutlu, Atsushi Torikoshi, David Rowley, Fujii Masao) +Change <structname>pg_backend_memory_contexts</structname>.<structfield>level</structfield> and <link linkend="functions-admin-signal-table"><function>pg_log_backend_memory_contexts()</function></link> to be one-based (Melih Mutlu, Atsushi Torikoshi, David Rowley, Fujii Masao) <ulink url="&commit_baseurl;32d3ed816">§</ulink> <ulink url="&commit_baseurl;d9e03864b">§</ulink> <ulink url="&commit_baseurl;706cbed35">§</ulink> @@ -274,7 +274,7 @@ Author: Alexander Korotkov <akorotkov@postgresql.org> <listitem> <para> -Convert some <literal>IN (VALUES ...)</literal> to <literal>x = ANY ...</literal> for better optimizer statistics (Alena Rybakina, Andrei Lepikhov) +Convert some <link linkend="functions-comparisons-in-scalar"><literal>IN (VALUES ...)</literal></link> to <literal>x = ANY ...</literal> for better optimizer statistics (Alena Rybakina, Andrei Lepikhov) <ulink url="&commit_baseurl;c0962a113">§</ulink> </para> </listitem> @@ -286,7 +286,7 @@ Author: Alexander Korotkov <akorotkov@postgresql.org> <listitem> <para> -Allow transforming <literal>OR</literal>-clauses to arrays for faster index processing (Alexander Korotkov, Andrey Lepikhov) +Allow transforming <link linkend="functions-logical"><literal>OR</literal></link>-clauses to arrays for faster index processing (Alexander Korotkov, Andrey Lepikhov) <ulink url="&commit_baseurl;ae4569161">§</ulink> </para> </listitem> @@ -304,7 +304,7 @@ Author: David Rowley <drowley@postgresql.org> <listitem> <para> -Speed up the processing of <literal>INTERSECT</literal>, <literal>EXCEPT</literal>, window aggregates, and view column aliases (Tom Lane, David Rowley) +Speed up the processing of <link linkend="sql-intersect"><literal>INTERSECT</literal></link>, <link linkend="sql-except"><literal>EXCEPT</literal></link>, <link linkend="tutorial-window">window aggregates</link>, and <link linkend="sql-createview">view column aliases</link> (Tom Lane, David Rowley) <ulink url="&commit_baseurl;52c707483">§</ulink> <ulink url="&commit_baseurl;276279295">§</ulink> <ulink url="&commit_baseurl;8d96f57d5">§</ulink> @@ -319,7 +319,7 @@ Author: Richard Guo <rguo@postgresql.org> <listitem> <para> -Allow the keys of <link linkend="sql-select"><command>SELECT DISTINCT</command></link> to be internally reordered to avoid sorting (Richard Guo) +Allow the keys of <link linkend="sql-distinct"><command>SELECT DISTINCT</command></link> to be internally reordered to avoid sorting (Richard Guo) <ulink url="&commit_baseurl;a8ccf4e93">§</ulink> </para> @@ -335,7 +335,7 @@ Author: David Rowley <drowley@postgresql.org> <listitem> <para> -Ignore <literal>GROUP BY</literal> columns that are functionally dependent on other columns (Zhang Mingli, Jian He, David Rowley) +Ignore <link linkend="sql-groupby"><literal>GROUP BY</literal></link> columns that are functionally dependent on other columns (Zhang Mingli, Jian He, David Rowley) <ulink url="&commit_baseurl;bd10ec529">§</ulink> </para> @@ -358,7 +358,7 @@ Author: Richard Guo <rguo@postgresql.org> <listitem> <para> -Allow some <literal>HAVING</literal> clauses on <literal>GROUPING SETS</literal> to be pushed to <literal>WHERE</literal> clauses (Richard Guo) +Allow some <link linkend="sql-having"><literal>HAVING</literal></link> clauses on <link linkend="queries-grouping-sets"><literal>GROUPING SETS</literal></link> to be pushed to <link linkend="sql-where"><literal>WHERE</literal></link> clauses (Richard Guo) <ulink url="&commit_baseurl;67a54b9e8">§</ulink> <ulink url="&commit_baseurl;247dea89f">§</ulink> <ulink url="&commit_baseurl;f5050f795">§</ulink> @@ -379,7 +379,7 @@ Author: Dean Rasheed <dean.a.rasheed@gmail.com> <listitem> <para> -Improve row estimates for <function>generate_series()</function> using <type>numeric</type> and <type>timestamp</type> values (David Rowley, Song Jinzhou) +Improve row estimates for <link linkend="functions-srf-series"><function>generate_series()</function></link> using <link linkend="datatype-numeric"><type>numeric</type></link> and <link linkend="datatype-datetime"><type>timestamp</type></link> values (David Rowley, Song Jinzhou) <ulink url="&commit_baseurl;036bdcec9">§</ulink> <ulink url="&commit_baseurl;97173536e">§</ulink> </para> @@ -408,7 +408,7 @@ Author: Richard Guo <rguo@postgresql.org> <listitem> <para> -Allow merge joins to use incremental sorts (Richard Guo) +Allow merge joins to use <link linkend="guc-enable-incremental-sort">incremental sorts</link> (Richard Guo) <ulink url="&commit_baseurl;828e94c9d">§</ulink> </para> </listitem> @@ -437,7 +437,7 @@ Author: Richard Guo <rguo@postgresql.org> <listitem> <para> -Allow partitionwise joins in more cases, and reduce its memory usage (Richard Guo, Tom Lane, Ashutosh Bapat) +Allow <link linkend="guc-enable-partitionwise-join">partitionwise joins</link> in more cases, and reduce its memory usage (Richard Guo, Tom Lane, Ashutosh Bapat) <ulink url="&commit_baseurl;9b282a935">§</ulink> <ulink url="&commit_baseurl;513f4472a">§</ulink> </para> @@ -464,7 +464,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Improve <acronym>SQL</acronym>-language function plan caching (Alexander Pyhalov, Tom Lane) +Improve <link linkend="xfunc-sql"><acronym>SQL</acronym>-language function</link> plan caching (Alexander Pyhalov, Tom Lane) <ulink url="&commit_baseurl;0dca5d68d">§</ulink> <ulink url="&commit_baseurl;09b07c295">§</ulink> </para> @@ -500,7 +500,7 @@ Author: Peter Geoghegan <pg@bowt.ie> <listitem> <para> -Allow skip scans of btree indexes (Peter Geoghegan) +Allow skip scans of <link linkend="xfunc-sql">btree</link> indexes (Peter Geoghegan) <ulink url="&commit_baseurl;92fe23d93">§</ulink> <ulink url="&commit_baseurl;8a510275d">§</ulink> </para> @@ -537,7 +537,7 @@ Author: Tomas Vondra <tomas.vondra@postgresql.org> <listitem> <para> -Allow <literal>GIN</literal> indexes to be created in parallel (Tomas Vondra, Matthias van de Meent) +Allow <link linkend="gin"><literal>GIN</literal></link> indexes to be created in parallel (Tomas Vondra, Matthias van de Meent) <ulink url="&commit_baseurl;8492feb98">§</ulink> </para> </listitem> @@ -549,7 +549,7 @@ Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> <listitem> <para> -Allow values to be sorted to speed range-type GiST and btree index builds (Bernd Helmle) +Allow values to be sorted to speed range-type <link linkend="gist">GiST</link> and <link linkend="btree">btree</link> index builds (Bernd Helmle) <ulink url="&commit_baseurl;e9e7b6604">§</ulink> </para> </listitem> @@ -639,7 +639,7 @@ Author: Jeff Davis <jdavis@postgresql.org> <listitem> <para> -Improve the performance and reduce memory usage of hash joins and <literal>GROUP BY</literal> (David Rowley, Jeff Davis) +Improve the performance and reduce memory usage of hash joins and <link linkend="sql-groupby"><literal>GROUP BY</literal></link> (David Rowley, Jeff Davis) <ulink url="&commit_baseurl;adf97c156">§</ulink> <ulink url="&commit_baseurl;0f5738202">§</ulink> <ulink url="&commit_baseurl;4d143509c">§</ulink> @@ -648,7 +648,7 @@ Improve the performance and reduce memory usage of hash joins and <literal>GROUP </para> <para> -This also improves hash set operations used by <literal>EXCEPT</literal>, and hash lookups of subplan values. +This also improves hash set operations used by <link linkend="sql-except"><literal>EXCEPT</literal></link>, and hash lookups of subplan values. </para> </listitem> @@ -728,7 +728,7 @@ Increase the logging granularity of server variable <xref linkend="guc-log-conne </para> <para> -This server variable was previously only boolean; these options are still supported. +This server variable was previously only boolean, which is still supported. </para> </listitem> @@ -768,7 +768,7 @@ Add server variable <xref linkend="guc-log-lock-failures"/> to log lock acquisit </para> <para> -Specifically it reports <link linkend="sql-select"><command>SELECT ... NOWAIT</command></link> lock failures. +Specifically it reports <link linkend="sql-for-update-share"><command>SELECT ... NOWAIT</command></link> lock failures. </para> </listitem> @@ -779,7 +779,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Modify <link linkend="monitoring-pg-stat-all-tables-view"><structname>pg_stat_all_tables</structname></link> and its variants to report the time spent in <literal>VACUUM</literal>, <literal>ANALYZE</literal>, and their automatic variants (Sami Imseih) +Modify <link linkend="monitoring-pg-stat-all-tables-view"><structname>pg_stat_all_tables</structname></link> and its variants to report the time spent in <xref linkend="sql-vacuum"/>, <xref linkend="sql-analyze"/>, and their <link linkend="autovacuum">automatic</link> variants (Sami Imseih) <ulink url="&commit_baseurl;30a6ed0ce">§</ulink> </para> @@ -803,7 +803,7 @@ Add delay time reporting to <xref linkend="sql-vacuum"/> and <xref linkend="sql- </para> <para> -This information appears in the autovacuum logs, the system views <link linkend="vacuum-progress-reporting"><structname>pg_stat_progress_vacuum</structname></link> and <link linkend="pg-stat-progress-analyze-view"><structname>pg_stat_progress_analyze</structname></link>, and the output of <command>VACUUM</command> and <command>ANALYZE</command> when in <literal>VERBOSE</literal> +This information appears in the server log, the system views <link linkend="vacuum-progress-reporting"><structname>pg_stat_progress_vacuum</structname></link> and <link linkend="pg-stat-progress-analyze-view"><structname>pg_stat_progress_analyze</structname></link>, and the output of <xref linkend="sql-vacuum"/> and <xref linkend="sql-analyze"/> when in <literal>VERBOSE</literal> mode; tracking must be enabled with the server variable <xref linkend="guc-track-cost-delay-timing"/>. </para> </listitem> @@ -850,7 +850,7 @@ Add per-backend I/O statistics reporting (Bertrand Drouvot) </para> <para> -The statistics are accessed via <function>pg_stat_get_backend_io()</function>. Per-backend I/O statistics can be cleared via <function>pg_stat_reset_backend_stats()</function>. +The statistics are accessed via <link linkend="pg-stat-get-backend-io"><function>pg_stat_get_backend_io()</function></link>. Per-backend I/O statistics can be cleared via <link linkend="monitoring-stats-funcs-table"><function>pg_stat_reset_backend_stats()</function></link>. </para> </listitem> @@ -866,7 +866,7 @@ Add <link linkend="monitoring-pg-stat-io-view"><structname>pg_stat_io</structnam </para> <para> -The new columns are <structfield>read_bytes</structfield>, <structfield>write_bytes</structfield>, and <structfield>extend_bytes</structfield>. The <structfield>op_bytes</structfield> column, which always equaled <literal>BLCKSZ</literal>, has been removed. +The new columns are <structfield>read_bytes</structfield>, <structfield>write_bytes</structfield>, and <structfield>extend_bytes</structfield>. The <structfield>op_bytes</structfield> column, which always equaled <link linkend="guc-block-size"><varname>BLCKSZ</varname></link>, has been removed. </para> </listitem> @@ -931,12 +931,12 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Add function <function>pg_stat_get_backend_wal()</function> to return per-backend <acronym>WAL</acronym> statistics (Bertrand Drouvot) +Add function <link linkend="pg-stat-get-backend-wal"><function>pg_stat_get_backend_wal()</function></link> to return per-backend <acronym>WAL</acronym> statistics (Bertrand Drouvot) <ulink url="&commit_baseurl;76def4cdd">§</ulink> </para> <para> -Per-backend <acronym>WAL</acronym> statistics can be cleared via <function>pg_stat_reset_backend_stats()</function>. +Per-backend <acronym>WAL</acronym> statistics can be cleared via <link linkend="monitoring-stats-funcs-table"><function>pg_stat_reset_backend_stats()</function></link>. </para> </listitem> @@ -947,7 +947,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Add function <function>pg_ls_summariesdir()</function> to specifically list the contents of <envar>PGDATA</envar>/<filename>pg_wal/summaries</filename> (Yushi Ogiwara) +Add function <link linkend="functions-admin-genfile-table"><function>pg_ls_summariesdir()</function></link> to specifically list the contents of <link linkend="storage-file-layout"><envar>PGDATA</envar></link>/<link linkend="guc-wal-summary-keep-time"><filename>pg_wal/summaries</filename></link> (Yushi Ogiwara) <ulink url="&commit_baseurl;4e1fad378">§</ulink> </para> </listitem> @@ -991,7 +991,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Add columns to <link linkend="monitoring-pg-stat-database-view"><structname>pg_stat_database</structname></link> to report parallel workers activity (Benoit Lobréau) +Add columns to <link linkend="monitoring-pg-stat-database-view"><structname>pg_stat_database</structname></link> to report parallel worker activity (Benoit Lobréau) <ulink url="&commit_baseurl;e7a9496de">§</ulink> </para> @@ -1009,7 +1009,7 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org> <listitem> <para> -Have query jumbling of arrays consider only the first and last array elements (Dmitry Dolgov, Sami Imseih) +Have <link linkend="guc-compute-query-id">query id</link> computation of arrays consider only the first and last array elements (Dmitry Dolgov, Sami Imseih) <ulink url="&commit_baseurl;62d712ecf">§</ulink> <ulink url="&commit_baseurl;9fbd53dea">§</ulink> </para> @@ -1026,7 +1026,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Adjust query jumbling to group together queries using the same relation name (Michael Paquier, Sami Imseih) +Adjust query id computations to group together queries using the same relation name (Michael Paquier, Sami Imseih) <ulink url="&commit_baseurl;787514b30">§</ulink> </para> @@ -1077,7 +1077,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Add function <function>pg_get_acl()</function> to retrieve database access control details (Joel Jacobson) +Add function <link linkend="functions-info-object-table"><function>pg_get_acl()</function></link> to retrieve database access control details (Joel Jacobson) <ulink url="&commit_baseurl;4564f1ceb">§</ulink> <ulink url="&commit_baseurl;d898665bf">§</ulink> </para> @@ -1090,7 +1090,7 @@ Author: Fujii Masao <fujii@postgresql.org> <listitem> <para> -Add function <function>has_largeobject_privilege()</function> to check large object privileges (Yugo Nagata) +Add function <link linkend="functions-info-access-table"><function>has_largeobject_privilege()</function></link> to check large object privileges (Yugo Nagata) <ulink url="&commit_baseurl;4eada203a">§</ulink> </para> </listitem> @@ -1114,7 +1114,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Add predefined role <literal>pg_signal_autovacuum_worker</literal> (Kirill Reshke) +Add predefined role <link linkend="predefined-roles"><literal>pg_signal_autovacuum_worker</literal></link> (Kirill Reshke) <ulink url="&commit_baseurl;ccd38024b">§</ulink> </para> @@ -1139,13 +1139,13 @@ Author: Daniel Gustafsson <dgustafsson@postgresql.org> <listitem> <para> -Add support for the OAuth authentication method (Jacob Champion, Daniel Gustafsson, Thomas Munro) +Add support for the <link linkend="auth-oauth">OAuth authentication method</link> (Jacob Champion, Daniel Gustafsson, Thomas Munro) <ulink url="&commit_baseurl;b3f0be788">§</ulink> </para> <para> -This adds an <literal>oauth</literal> authentication method to <filename>pg_hba.conf</filename>, libpq OAuth options, a server variable <xref linkend="guc-oauth-validator-libraries"/> to load token validation libraries, and -a configure flag <option>--with-libcurl</option> to add the required compile-time libraries. +This adds an <literal>oauth</literal> authentication method to <link linkend="auth-pg-hba-conf"><filename>pg_hba.conf</filename></link>, libpq OAuth options, a server variable <xref linkend="guc-oauth-validator-libraries"/> to load token validation libraries, and +a configure flag <link linkend="configure-option-with-libcurl"><option>--with-libcurl</option></link> to add the required compile-time libraries. </para> </listitem> @@ -1189,18 +1189,6 @@ Rename server variable <varname>ssl_ecdh_curve</varname> to <xref linkend="guc-s </listitem> <!-- -Author: Daniel Gustafsson <dgustafsson@postgresql.org> -2025-01-24 [924d89a35] pgcrypto: Add function to check FIPS mode ---> - -<listitem> -<para> -Add function <function>pg_check_fipsmode()</function> to report the server's <acronym>FIPS</acronym> mode (Daniel Gustafsson) -<ulink url="&commit_baseurl;924d89a35">§</ulink> -</para> -</listitem> - -<!-- Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> 2025-04-02 [a460251f0] Make cancel request keys longer Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> @@ -1209,7 +1197,7 @@ Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> <listitem> <para> -Make cancel request keys 256 bits (Heikki Linnakangas, Jelte Fennema-Nio) +Make <link linkend="functions-admin-signal-table">cancel request keys</link> 256 bits (Heikki Linnakangas, Jelte Fennema-Nio) <ulink url="&commit_baseurl;a460251f0">§</ulink> <ulink url="&commit_baseurl;9d9b9d46f">§</ulink> </para> @@ -1242,7 +1230,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Allow specification of the fixed number of dead tuples that will trigger an autovacuum (Nathan Bossart, Frédéric Yhuel) +Allow specification of the fixed number of dead tuples that will trigger an <link linkend="autovacuum">autovacuum</link> (Nathan Bossart, Frédéric Yhuel) <ulink url="&commit_baseurl;306dc520b">§</ulink> </para> @@ -1357,7 +1345,7 @@ Author: Amit Kapila <akapila@postgresql.org> <listitem> <para> -Allow the values of generated columns to be logically replicated (Shubham Khanna, Vignesh C, Zhijie Hou, Shlok Kyal, Peter Smith) +Allow the values of <link linkend="sql-createtable-parms-generated-stored">generated columns</link> to be logically replicated (Shubham Khanna, Vignesh C, Zhijie Hou, Shlok Kyal, Peter Smith) <ulink url="&commit_baseurl;745217a05">§</ulink> <ulink url="&commit_baseurl;7054186c4">§</ulink> <ulink url="&commit_baseurl;87ce27de6">§</ulink> @@ -1392,7 +1380,7 @@ Author: Amit Kapila <akapila@postgresql.org> <listitem> <para> -Allow <link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION</command></link> to change the replication slot's two-phase commit behavior (Hayato Kuroda, Ajin Cherian, Amit Kapila, Zhijie Hou) +Allow <xref linkend="sql-altersubscription"/> to change the replication slot's two-phase commit behavior (Hayato Kuroda, Ajin Cherian, Amit Kapila, Zhijie Hou) <ulink url="&commit_baseurl;1462aad2e">§</ulink> <ulink url="&commit_baseurl;4868c96bc">§</ulink> </para> @@ -1413,7 +1401,7 @@ Author: Amit Kapila <akapila@postgresql.org> <listitem> <para> -Log conflicts while applying logical replication changes (Zhijie Hou, Nisha Moond) +Log <link linkend="hot-standby-conflict">conflicts</link> while applying logical replication changes (Zhijie Hou, Nisha Moond) <ulink url="&commit_baseurl;9758174e2">§</ulink> <ulink url="&commit_baseurl;edcb71258">§</ulink> <ulink url="&commit_baseurl;640178c92">§</ulink> @@ -1448,7 +1436,7 @@ Author: Richard Guo <rguo@postgresql.org> <listitem> <para> -Allow generated columns to be virtual, and make them the default (Peter Eisentraut, Jian He, Richard Guo, Dean Rasheed) +Allow <link linkend="sql-createtable-parms-generated-stored">generated columns</link> to be virtual, and make them the default (Peter Eisentraut, Jian He, Richard Guo, Dean Rasheed) <ulink url="&commit_baseurl;83ea6c540">§</ulink> <ulink url="&commit_baseurl;cdc168ad4">§</ulink> <ulink url="&commit_baseurl;1e4351af3">§</ulink> @@ -1466,7 +1454,7 @@ Author: Dean Rasheed <dean.a.rasheed@gmail.com> <listitem> <para> -Add <literal>OLD</literal>/<literal>NEW</literal> support to <literal>RETURNING</literal> in <acronym>DML</acronym> queries (Dean Rasheed) +Add <literal>OLD</literal>/<literal>NEW</literal> support to <link linkend="dml-returning"><literal>RETURNING</literal></link> in <acronym>DML</acronym> queries (Dean Rasheed) <ulink url="&commit_baseurl;80feb727c">§</ulink> </para> @@ -1500,7 +1488,7 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Allow <literal>LIKE</literal> with nondeterministic collations (Peter Eisentraut) +Allow <link linkend="functions-like"><literal>LIKE</literal></link> with <link linkend="collation-nondeterministic">nondeterministic collations</link> (Peter Eisentraut) <ulink url="&commit_baseurl;85b7efa1c">§</ulink> </para> </listitem> @@ -1528,7 +1516,7 @@ Author: Jeff Davis <jdavis@postgresql.org> <listitem> <para> -Add builtin collation provider <literal>PG_UNICODE_FAST</literal> (Jeff Davis) +Add builtin collation provider <link linkend="locale-providers"><literal>PG_UNICODE_FAST</literal></link> (Jeff Davis) <ulink url="&commit_baseurl;d3d098316">§</ulink> </para> @@ -1571,7 +1559,7 @@ Add functions to modify per-relation and per-column optimizer statistics (Corey </para> <para> -The functions are <function>pg_restore_relation_stats()</function>, <function>pg_restore_attribute_stats()</function>, <function>pg_clear_relation_stats()</function>, and <function>pg_clear_attribute_stats()</function>. +The functions are <link linkend="functions-admin-statsmod"><function>pg_restore_relation_stats()</function></link>, <function>pg_restore_attribute_stats()</function>, <function>pg_clear_relation_stats()</function>, and <function>pg_clear_attribute_stats()</function>. </para> </listitem> @@ -1606,12 +1594,12 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Allow the specification of non-overlapping <literal>PRIMARY KEY</literal> and <literal>UNIQUE</literal> constraints (Paul A. Jungwirth) +Allow the specification of non-overlapping <link linkend="sql-createtable-parms-primary-key"><literal>PRIMARY KEY</literal></link> and <link linkend="sql-createtable-parms-unique"><literal>UNIQUE</literal></link> constraints (Paul A. Jungwirth) <ulink url="&commit_baseurl;fc0438b4e">§</ulink> </para> <para> -This is specified by <literal>WITHOUT OVERLAPS</literal> on the last column. +This is specified by <literal>WITHOUT OVERLAPS</literal> on the last specified column. </para> </listitem> @@ -1624,7 +1612,7 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Allow <literal>CHECK</literal> and foreign key constraints to be specified as <literal>NOT ENFORCED</literal> (Amul Sul) +Allow <link linkend="sql-createtable-parms-check"><literal>CHECK</literal></link> and <link linkend="sql-createtable-parms-references">foreign key</link> constraints to be specified as <literal>NOT ENFORCED</literal> (Amul Sul) <ulink url="&commit_baseurl;ca87c415e">§</ulink> <ulink url="&commit_baseurl;eec0040c4">§</ulink> </para> @@ -1640,7 +1628,7 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Require primary/foreign key relationships to use either deterministic collations or the the same nondeterministic collations (Peter Eisentraut) +Require <link linkend="sql-createtable-parms-references">primary/foreign key</link> relationships to use either deterministic collations or the the same nondeterministic collations (Peter Eisentraut) <ulink url="&commit_baseurl;9321d2fdf">§</ulink> </para> @@ -1656,7 +1644,7 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org> <listitem> <para> -Store column <literal>NOT NULL</literal> specifications in <structname>pg_constraint</structname> (Álvaro Herrera, Bernd Helmle) +Store column <link linkend="sql-createtable-parms-not-null"><literal>NOT NULL</literal></link> specifications in <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> (Álvaro Herrera, Bernd Helmle) <ulink url="&commit_baseurl;14e87ffa5">§</ulink> </para> @@ -1715,7 +1703,7 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org> <listitem> <para> -Allow dropping of constraints <literal>ONLY</literal> on partitioned tables (Álvaro Herrera) +Allow <link linkend="sql-altertable-desc-drop-constraint">dropping</link> of constraints <literal>ONLY</literal> on partitioned tables (Álvaro Herrera) <ulink url="&commit_baseurl;4dea33ce7">§</ulink> </para> @@ -1936,7 +1924,7 @@ Author: Jeff Davis <jdavis@postgresql.org> <listitem> <para> -Improve Unicode full case mapping and conversion (Jeff Davis) +Improve <link linkend="collation-managing-standard">Unicode</link> full case mapping and conversion (Jeff Davis) <ulink url="&commit_baseurl;4e7f62bc3">§</ulink> <ulink url="&commit_baseurl;286a365b9">§</ulink> </para> @@ -1953,7 +1941,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Allow <type>jsonb</type> <literal>null</literal> values to be cast to scalar types as <literal>NULL</literal> (Tom Lane) +Allow <link linkend="datatype-json"><type>jsonb</type></link> <literal>null</literal> values to be cast to scalar types as <literal>NULL</literal> (Tom Lane) <ulink url="&commit_baseurl;a5579a90a">§</ulink> </para> @@ -1964,12 +1952,12 @@ Previously such casts generated an error. <!-- Author: Andrew Dunstan <andrew@dunslane.net> -2025-03-05 [4603903d2] Allow <function>json{b}_strip_nulls()</function> to remove <literal>null</literal> array elements +2025-03-05 [4603903d2] Allow json{b}_strip_nulls() to remove null array elements --> <listitem> <para> -Add optional parameter to json{b}_strip_nulls to allow removal of null array elements (Florents Tselai) +Add optional parameter to <link linkend="functions-json-processing-table"><function>json{b}_strip_nulls</function></link> to allow removal of null array elements (Florents Tselai) <ulink url="&commit_baseurl;4603903d2">§</ulink> </para> </listitem> @@ -1981,7 +1969,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Add function <function>array_sort()</function> which sorts an array's first dimension (Junwang Zhao, Jian He) +Add function <link linkend="array-functions-table"><function>array_sort()</function></link> which sorts an array's first dimension (Junwang Zhao, Jian He) <ulink url="&commit_baseurl;6c12ae09f">§</ulink> </para> </listitem> @@ -1993,7 +1981,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Add function <function>array_reverse()</function> which reverses an array's first dimension (Aleksander Alekseev) +Add function <link linkend="array-functions-table"><function>array_reverse()</function></link> which reverses an array's first dimension (Aleksander Alekseev) <ulink url="&commit_baseurl;49d6c7d8d">§</ulink> </para> </listitem> @@ -2005,7 +1993,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Add function <function>reverse()</function> to reverse bytea bytes (Aleksander Alekseev) +Add function <link linkend="functions-string-other"><function>reverse()</function></link> to reverse bytea bytes (Aleksander Alekseev) <ulink url="&commit_baseurl;0697b2390">§</ulink> </para> </listitem> @@ -2017,7 +2005,7 @@ Author: Dean Rasheed <dean.a.rasheed@gmail.com> <listitem> <para> -Allow casting between integer types and <type>bytea</type> (Aleksander Alekseev) +Allow casting between integer types and <link linkend="datatype-binary"><type>bytea</type></link> (Aleksander Alekseev) <ulink url="&commit_baseurl;6da469bad">§</ulink> </para> @@ -2033,7 +2021,7 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Update Unicode data to Unicode 16.0.0 (Peter Eisentraut) +Update Unicode data to <link linkend="collation-managing-standard">Unicode</link> 16.0.0 (Peter Eisentraut) <ulink url="&commit_baseurl;82a46cca9">§</ulink> </para> </listitem> @@ -2045,7 +2033,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Add full text search stemming for Estonian (Tom Lane) +Add full text search <link linkend="textsearch-snowball-dictionary">stemming</link> for Estonian (Tom Lane) <ulink url="&commit_baseurl;b464e51ab">§</ulink> </para> </listitem> @@ -2057,12 +2045,12 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Improve the <type>XML</type> error codes to more closely match the <acronym>SQL</acronym> standard (Tom Lane) +Improve the <link linkend="datatype-xml"><type>XML</type></link> error codes to more closely match the <acronym>SQL</acronym> standard (Tom Lane) <ulink url="&commit_baseurl;cd838e200">§</ulink> </para> <para> -These errors are reported via <literal>SQLSTATE</literal>. +These errors are reported via <link linkend="errcodes-appendix"><literal>SQLSTATE</literal></link>. </para> </listitem> @@ -2082,7 +2070,7 @@ Author: Jeff Davis <jdavis@postgresql.org> <listitem> <para> -Add function <function>CASEFOLD()</function> to allow for more sophisticated case-insensitive matching (Jeff Davis) +Add function <link linkend="functions-string-other"><function>casefold()</function></link> to allow for more sophisticated case-insensitive matching (Jeff Davis) <ulink url="&commit_baseurl;bfc599206">§</ulink> </para> @@ -2100,7 +2088,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Allow <function>MIN()</function>/<function>MAX()</function> aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) +Allow <link linkend="functions-aggregate-table"><function>MIN()</function></link>/<link linkend="functions-aggregate-table"><function>MAX()</function></link> aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) <ulink url="&commit_baseurl;a0f1fce80">§</ulink> <ulink url="&commit_baseurl;2d24fd942">§</ulink> </para> @@ -2113,7 +2101,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Add a <literal>WEEK</literal> option to <function>EXTRACT()</function> (Tom Lane) +Add a <literal>WEEK</literal> option to <link linkend="functions-datetime-extract"><function>EXTRACT()</function></link> (Tom Lane) <ulink url="&commit_baseurl;6be39d77a">§</ulink> </para> </listitem> @@ -2137,7 +2125,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Add roman numeral support to <function>to_number()</function> (Hunaid Sohail) +Add roman numeral support to <link linkend="functions-formatting-table"><function>to_number()</function></link> (Hunaid Sohail) <ulink url="&commit_baseurl;172e6b3ad">§</ulink> </para> @@ -2153,12 +2141,12 @@ Author: Masahiko Sawada <msawada@postgresql.org> <listitem> <para> -Add <type>UUID</type> version 7 generation function <function>uuidv7()</function> (Andrey Borodin) +Add <link linkend="datatype-uuid"><type>UUID</type></link> version 7 generation function <link linkend="func_uuid_gen_table"><function>uuidv7()</function></link> (Andrey Borodin) <ulink url="&commit_baseurl;78c5e141e">§</ulink> </para> <para> -This <type>UUID</type> value is temporally sortable. Function alias <function>uuidv4()</function> has been added to explicitly generate version 4 UUIDs. +This <type>UUID</type> value is temporally sortable. Function alias <link linkend="func_uuid_gen_table"><function>uuidv4()</function></link> has been added to explicitly generate version 4 UUIDs. </para> </listitem> @@ -2169,7 +2157,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Add functions <function>crc32()</function> and <function>crc32c()</function> to compute <acronym>CRC</acronym> values (Aleksander Alekseev) +Add functions <link linkend="functions-binarystring-other"><function>crc32()</function></link> and <link linkend="functions-binarystring-other"><function>crc32c()</function></link> to compute <acronym>CRC</acronym> values (Aleksander Alekseev) <ulink url="&commit_baseurl;760162fed">§</ulink> </para> </listitem> @@ -2181,7 +2169,7 @@ Author: Dean Rasheed <dean.a.rasheed@gmail.com> <listitem> <para> -Add math functions <function>gamma()</function> and <function>lgamma()</function> (Dean Rasheed) +Add math functions <link linkend="functions-math-func-table"><function>gamma()</function></link> and <link linkend="functions-math-func-table"><function>lgamma()</function></link> (Dean Rasheed) <ulink url="&commit_baseurl;a3b6dfd41">§</ulink> </para> </listitem> @@ -2193,7 +2181,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Allow <literal>=></literal> syntax for named cursor arguments in plpgsql (Pavel Stehule) +Allow <literal>=></literal> syntax for named cursor arguments in <link linkend="plpgsql">PL/pgSQL</link> (Pavel Stehule) <ulink url="&commit_baseurl;246dedc5d">§</ulink> </para> @@ -2209,7 +2197,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Allow <function>regexp_match[es]()</function>/<function>regexp_like()</function>/<function>regexp_replace()</function>/<function>regexp_count()</function>/<function>regexp_instr()</function>/<function>regexp_substr()</function>/<function>regexp_split_to_table()</function>/<function>regexp_split_to_array()</function> to use named arguments (Jian He) +Allow <link linkend="functions-posix-regexp"><function>regexp_match[es]()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_like()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_replace()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_count()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_instr()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_substr()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_split_to_table()</function></link>/<link linkend="functions-posix-regexp"><function>regexp_split_to_array()</function></link> to use named arguments (Jian He) <ulink url="&commit_baseurl;580f8727c">§</ulink> </para> </listitem> @@ -2230,7 +2218,7 @@ Author: Robert Haas <rhaas@postgresql.org> <listitem> <para> -Add function <function>PQfullProtocolVersion()</function> to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) +Add function <link linkend="libpq-PQfullProtocolVersion"><function>PQfullProtocolVersion()</function></link> to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) <ulink url="&commit_baseurl;cdb6b0fdb">§</ulink> </para> </listitem> @@ -2244,7 +2232,7 @@ Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> <listitem> <para> -Add libpq connection parameters and environment variables to specify the minimum and maximum acceptable protocol version for connections (Jelte Fennema-Nio) +Add libpq connection <link linkend="libpq-connect-ssl-max-protocol-version">parameters</link> and <link linkend="libpq-envars">environment variables</link> to specify the minimum and maximum acceptable protocol version for connections (Jelte Fennema-Nio) <ulink url="&commit_baseurl;285613c60">§</ulink> <ulink url="&commit_baseurl;507034910">§</ulink> </para> @@ -2257,7 +2245,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Add libpq function <function>PQservice()</function> to return the connection service name (Michael Banck) +Add libpq function <link linkend="libpq-PQservice"><function>PQservice()</function></link> to return the connection service name (Michael Banck) <ulink url="&commit_baseurl;4b99fed75">§</ulink> </para> </listitem> @@ -2292,7 +2280,7 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org> <listitem> <para> -Add <function>PQtrace()</function> output for all message types, including authentication (Jelte Fennema-Nio) +Add <link linkend="libpq-PQtrace"><function>PQtrace()</function></link> output for all message types, including authentication (Jelte Fennema-Nio) <ulink url="&commit_baseurl;ea92f3a0a">§</ulink> <ulink url="&commit_baseurl;a5c6b8f22">§</ulink> <ulink url="&commit_baseurl;b8b3f861f">§</ulink> @@ -2308,7 +2296,7 @@ Author: Daniel Gustafsson <dgustafsson@postgresql.org> <listitem> <para> -Add libpq connection parameter <varname>sslkeylogfile</varname> which dumps out <acronym>SSL</acronym> key material (Abhishek Chanda, Daniel Gustafsson) +Add libpq connection parameter <link linkend="libpq-connect-sslkeylogfile"><varname>sslkeylogfile</varname></link> which dumps out <acronym>SSL</acronym> key material (Abhishek Chanda, Daniel Gustafsson) <ulink url="&commit_baseurl;2da74d8d6">§</ulink> </para> @@ -2354,7 +2342,7 @@ Allow <application>psql</application> to parse, bind, and close named prepared s </para> <para> -This is accomplished with new commands <literal>\parse</literal>, <literal>\bind_named</literal>, and <literal>\close</literal>. +This is accomplished with new commands <link linkend="app-psql-meta-command-parse"><literal>\parse</literal></link>, <link linkend="app-psql-meta-command-bind-named"><literal>\bind_named</literal></link>, and <link linkend="app-psql-meta-command-close"><literal>\close</literal></link>. </para> </listitem> @@ -2376,7 +2364,7 @@ Add <application>psql</application> backslash commands to allowing issuance of p </para> <para> -The new commands are <literal>\startpipeline</literal>, <literal>\syncpipeline</literal>, <literal>\sendpipeline</literal>, <literal>\endpipeline</literal>, <literal>\flushrequest</literal>, <literal>\flush</literal>, and <literal>\getresults</literal>. +The new commands are <link linkend="app-psql-meta-command-pipeline"><literal>\startpipeline</literal></link>, <literal>\syncpipeline</literal>, <literal>\sendpipeline</literal>, <literal>\endpipeline</literal>, <literal>\flushrequest</literal>, <literal>\flush</literal>, and <literal>\getresults</literal>. </para> </listitem> @@ -2392,7 +2380,7 @@ Allow adding pipeline status to the <application>psql</application> prompt and a </para> <para> -The new prompt character is <literal>%P</literal> and the new <application>psql</application> variables are <literal>PIPELINE_SYNC_COUNT</literal>, <literal>PIPELINE_COMMAND_COUNT</literal>, and <literal>PIPELINE_RESULT_COUNT</literal>. +The new prompt character is <literal>%P</literal> and the new <application>psql</application> variables are <link linkend="app-psql-variables-pipeline-sync-count"><literal>PIPELINE_SYNC_COUNT</literal></link>, <link linkend="app-psql-variables-pipeline-command-count"><literal>PIPELINE_COMMAND_COUNT</literal></link>, and <link linkend="app-psql-variables-pipeline-result-count"><literal>PIPELINE_RESULT_COUNT</literal></link>. </para> </listitem> @@ -2431,7 +2419,7 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org> <listitem> <para> -Change <application>psql</application>'s <literal>\conninfo</literal> to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) +Change <application>psql</application>'s <xref linkend="app-psql-meta-command-conninfo"/> to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) <ulink url="&commit_baseurl;bba2fbc62">§</ulink> </para> </listitem> @@ -2443,7 +2431,7 @@ Author: Dean Rasheed <dean.a.rasheed@gmail.com> <listitem> <para> -Add function's leakproof indicator to <application>psql</application>'s <literal>\df+</literal>, <literal>\do+</literal>, <literal>\dAo+</literal>, and <literal>\dC+</literal> outputs (Yugo Nagata) +Add function's leakproof indicator to <application>psql</application>'s <link linkend="app-psql-meta-command-df-lc"><literal>\df+</literal></link>, <literal>\do+</literal>, <literal>\dAo+</literal>, and <literal>\dC+</literal> outputs (Yugo Nagata) <ulink url="&commit_baseurl;2355e5111">§</ulink> </para> </listitem> @@ -2455,7 +2443,7 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Add access method details for partitioned relations in <literal>\dP+</literal> (Justin Pryzby) +Add access method details for partitioned relations in <link linkend="app-psql-meta-command-dp-uc"><literal>\dP+</literal></link> (Justin Pryzby) <ulink url="&commit_baseurl;978f38c77">§</ulink> </para> </listitem> @@ -2467,7 +2455,7 @@ Author: Magnus Hagander <magnus@hagander.net> <listitem> <para> -Add <literal>default_version</literal> to the <application>psql</application> <literal>\dx</literal> extension output (Magnus Hagander) +Add <literal>default_version</literal> to the <application>psql</application> <link linkend="app-psql-meta-command-dx-lc"><literal>\dx</literal></link> extension output (Magnus Hagander) <ulink url="&commit_baseurl;d696406a9">§</ulink> </para> </listitem> @@ -2479,7 +2467,7 @@ Author: Daniel Gustafsson <dgustafsson@postgresql.org> <listitem> <para> -Add <application>psql</application> variable <literal>WATCH_INTERVAL</literal> to set the default <literal>\watch</literal> wait time (Daniel Gustafsson) +Add <application>psql</application> variable <xref linkend="app-psql-variables-watch-interval"/> to set the default <link linkend="app-psql-meta-command-watch"><literal>\watch</literal></link> wait time (Daniel Gustafsson) <ulink url="&commit_baseurl;1a759c832">§</ulink> </para> </listitem> @@ -2537,7 +2525,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Add vacuumdb option <option>--missing-stats-only</option> to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) +Add <xref linkend="app-vacuumdb"/> option <option>--missing-stats-only</option> to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) <ulink url="&commit_baseurl;edba754f0">§</ulink> <ulink url="&commit_baseurl;987910502">§</ulink> </para> @@ -2570,7 +2558,7 @@ Author: Robert Haas <rhaas@postgresql.org> <listitem> <para> -Allow <application>pg_verifybackup</application> to verify tar-format backups (Amul Sul) +Allow <xref linkend="app-pgverifybackup"/> to verify tar-format backups (Amul Sul) <ulink url="&commit_baseurl;8dfd31290">§</ulink> </para> </listitem> @@ -2594,7 +2582,7 @@ Author: Masahiko Sawada <msawada@postgresql.org> <listitem> <para> -Add <application>pg_resetwal</application> option <option>--char-signedness</option> to change the default <type>char</type> signedness (Masahiko Sawada) +Add <xref linkend="app-pgresetwal"/> option <option>--char-signedness</option> to change the default <type>char</type> signedness (Masahiko Sawada) <ulink url="&commit_baseurl;30666d185">§</ulink> </para> </listitem> @@ -2888,13 +2876,13 @@ Author: Michael Paquier <michael@paquier.xyz> <listitem> <para> -Separate the loading and running of injection points (Michael Paquier, Heikki Linnakangas) +Separate the loading and running of <link linkend="xfunc-addin-injection-points">injection points</link> (Michael Paquier, Heikki Linnakangas) <ulink url="&commit_baseurl;4b211003e">§</ulink> <ulink url="&commit_baseurl;a0a5869a8">§</ulink> </para> <para> -Injection points can now be created, but not run, via <function>INJECTION_POINT_LOAD()</function>, and such injection points can be run via <function>INJECTION_POINT_CACHED()</function>. +Injection points can now be created, but not run, via <link linkend="xfunc-addin-injection-points"><function>INJECTION_POINT_LOAD()</function></link>, and such injection points can be run via <link linkend="xfunc-addin-injection-points"><function>INJECTION_POINT_CACHED()</function></link>. </para> </listitem> @@ -2917,7 +2905,7 @@ Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> <listitem> <para> -Allow inline injection point test code with <function>IS_INJECTION_POINT_ATTACHED()</function> (Heikki Linnakangas) +Allow inline injection point test code with <link linkend="xfunc-addin-injection-points"><function>IS_INJECTION_POINT_ATTACHED()</function></link> (Heikki Linnakangas) <ulink url="&commit_baseurl;20e0e7da9">§</ulink> </para> </listitem> @@ -2929,7 +2917,7 @@ Author: David Rowley <drowley@postgresql.org> <listitem> <para> -Improve the performance of processing long <type>JSON</type> strings using <acronym>SIMD</acronym> instructions (David Rowley) +Improve the performance of processing long <link linkend="datatype-json"><type>JSON</type></link> strings using <acronym>SIMD</acronym> (Single Instruction Multiple Data) (David Rowley) <ulink url="&commit_baseurl;ca6fde922">§</ulink> </para> </listitem> @@ -2993,14 +2981,14 @@ Author: Tomas Vondra <tomas.vondra@postgresql.org> <listitem> <para> -Add configure option <option>--with-libnuma</option> to enable <acronym>NUMA</acronym> awareness (Jakub Wartak, Bertrand Drouvot) +Add configure option <link linkend="configure-option-with-libnuma"><option>--with-libnuma</option></link> to enable <acronym>NUMA</acronym> awareness (Jakub Wartak, Bertrand Drouvot) <ulink url="&commit_baseurl;65c298f61">§</ulink> <ulink url="&commit_baseurl;8cc139bec">§</ulink> <ulink url="&commit_baseurl;ba2a3c230">§</ulink> </para> <para> -The function <function>pg_numa_available()</function> reports on <acronym>NUMA</acronym> awareness, and system views <link linkend="view-pg-shmem-allocations-numa"><structname>pg_shmem_allocations_numa</structname></link> and <link linkend="pgbuffercache-pg-buffercache-numa"><structname>pg_buffercache_numa</structname></link> which report on shared memory distribution across +The function <link linkend="functions-info-session-table"><function>pg_numa_available()</function></link> reports on <acronym>NUMA</acronym> awareness, and system views <link linkend="view-pg-shmem-allocations-numa"><structname>pg_shmem_allocations_numa</structname></link> and <link linkend="pgbuffercache-pg-buffercache-numa"><structname>pg_buffercache_numa</structname></link> which report on shared memory distribution across <acronym>NUMA</acronym> nodes. </para> </listitem> @@ -3012,7 +3000,7 @@ Author: Nathan Bossart <nathan@postgresql.org> <listitem> <para> -Add <acronym>TOAST</acronym> table to <link linkend="catalog-pg-index"><structname>pg_index</structname></link> to allow for very large expression indexes (Nathan Bossart) +Add <link linkend="storage-toast"><acronym>TOAST</acronym></link> table to <link linkend="catalog-pg-index"><structname>pg_index</structname></link> to allow for very large expression indexes (Nathan Bossart) <ulink url="&commit_baseurl;b52c4fc3c">§</ulink> </para> </listitem> @@ -3051,7 +3039,7 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Add <literal>amgettreeheight</literal>, <literal>amconsistentequality</literal>, and <literal>amconsistentordering</literal> to the index access method <acronym>API</acronym> (Mark Dilger) +Add <link linkend="indexam"><structfield>amgettreeheight</structfield></link>, <literal>amconsistentequality</literal>, and <literal>amconsistentordering</literal> to the index access method <acronym>API</acronym> (Mark Dilger) <ulink url="&commit_baseurl;56fead44d">§</ulink> <ulink url="&commit_baseurl;af4002b38">§</ulink> </para> @@ -3064,7 +3052,7 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Add GiST support function <function>stratnum()</function> (Paul A. Jungwirth) +Add GiST support function <link linkend="gist-extensibility"><function>stratnum()</function></link> (Paul A. Jungwirth) <ulink url="&commit_baseurl;7406ab623">§</ulink> </para> </listitem> @@ -3076,7 +3064,7 @@ Author: Masahiko Sawada <msawada@postgresql.org> <listitem> <para> -Record the default <acronym>CPU</acronym> signedness of <literal>char</literal> in <filename>pg_controldata</filename> (Masahiko Sawada) +Record the default <acronym>CPU</acronym> signedness of <literal>char</literal> in <xref linkend="app-pgcontroldata"/> (Masahiko Sawada) <ulink url="&commit_baseurl;44fe30fda">§</ulink> </para> </listitem> @@ -3146,12 +3134,12 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Add macro <literal>PG_MODULE_MAGIC_EXT</literal> to allow extensions to report their name and version (Andrei Lepikhov) +Add macro <link linkend="functions-info"><literal>PG_MODULE_MAGIC_EXT</literal></link> to allow extensions to report their name and version (Andrei Lepikhov) <ulink url="&commit_baseurl;9324c8c58">§</ulink> </para> <para> -This information can be access via the new function <function>pg_get_loaded_modules()</function>. +This information can be access via the new function <link linkend="functions-info-session-table"><function>pg_get_loaded_modules()</function></link>. </para> </listitem> @@ -3162,7 +3150,7 @@ Author: Tom Lane <tgl@sss.pgh.pa.us> <listitem> <para> -Document that <function>SPI_connect()</function>/<function>SPI_connect_ext()</function> always returns success (<literal>SPI_OK_CONNECT</literal>) (Stepan Neretin) +Document that <link linkend="spi-spi-connect"><function>SPI_connect()</function></link>/<link linkend="spi-spi-connect"><function>SPI_connect_ext()</function></link> always returns success (<literal>SPI_OK_CONNECT</literal>) (Stepan Neretin) <ulink url="&commit_baseurl;218527d01">§</ulink> </para> @@ -3173,25 +3161,25 @@ Errors are always reported via <function>ereport()</function>. <!-- Author: Peter Eisentraut <peter@eisentraut.org> -2025-01-27 [5afaba629] doc: Meson is not experimental on Windows +2024-07-31 [e54a42ac9] Add API and ABI stability guidance to the C language doc --> <listitem> <para> -Remove the experimental designation of <application>Meson</application> builds on <systemitem class="osname">Windows</systemitem> (Aleksander Alekseev) -<ulink url="&commit_baseurl;5afaba629">§</ulink> +Add <link linkend="xfunc-api-abi-stability-guidance">documentation section</link> about <acronym>API</acronym> and <acronym>ABI</acronym> compatibility (David Wheeler, Peter Eisentraut) +<ulink url="&commit_baseurl;e54a42ac9">§</ulink> </para> </listitem> <!-- Author: Peter Eisentraut <peter@eisentraut.org> -2024-07-31 [e54a42ac9] Add API and ABI stability guidance to the C language doc +2025-01-27 [5afaba629] doc: Meson is not experimental on Windows --> <listitem> <para> -Add documentation section about <acronym>API</acronym> and <acronym>ABI</acronym> compatibility (David Wheeler, Peter Eisentraut) -<ulink url="&commit_baseurl;e54a42ac9">§</ulink> +Remove the experimental designation of <application>Meson</application> builds on <systemitem class="osname">Windows</systemitem> (Aleksander Alekseev) +<ulink url="&commit_baseurl;5afaba629">§</ulink> </para> </listitem> @@ -3254,7 +3242,7 @@ Author: Robert Haas <rhaas@postgresql.org> <listitem> <para> -Add extension <application>pg_overexplain</application> which adds debug details to <link linkend="sql-explain"><command>EXPLAIN</command></link> output (Robert Haas) +Add extension <xref linkend="pgoverexplain"/> which adds debug details to <link linkend="sql-explain"><command>EXPLAIN</command></link> output (Robert Haas) <ulink url="&commit_baseurl;8d5ceb113">§</ulink> </para> </listitem> @@ -3272,7 +3260,7 @@ Author: Fujii Masao <fujii@postgresql.org> <listitem> <para> -Add output columns to <function>postgres_fdw_get_connections()</function> (Hayato Kuroda, Sagar Dilip Shedge) +Add output columns to <link linkend="postgres-fdw-functions"><function>postgres_fdw_get_connections()</function></link> (Hayato Kuroda, Sagar Dilip Shedge) <ulink url="&commit_baseurl;c297a47c5">§</ulink> <ulink url="&commit_baseurl;857df3cef">§</ulink> <ulink url="&commit_baseurl;4f08ab554">§</ulink> @@ -3292,15 +3280,15 @@ Author: Peter Eisentraut <peter@eisentraut.org> <listitem> <para> -Allow <acronym>SCRAM</acronym> authentication from the client to be passed to +Allow <link linkend="auth-password"><acronym>SCRAM</acronym></link> authentication from the client to be passed to <xref linkend="postgres-fdw"/> servers (Matheus Alcantara, Peter Eisentraut) <ulink url="&commit_baseurl;761c79508">§</ulink> </para> <para> This avoids storing <application>postgres_fdw</application> authentication information in the database, and is enabled with the -<application>postgres_fdw</application> <literal>use_scram_passthrough</literal> connection option. libpq uses new connection -parameters <literal>scram_client_key</literal> and <literal>scram_server_key</literal>. +<application>postgres_fdw</application> <link linkend="postgres-fdw-option-use-scram-passthrough"><literal>use_scram_passthrough</literal></link> connection option. libpq uses new connection +parameters <xref linkend="libpq-connect-scram-client-key"/> and <xref linkend="libpq-connect-scram-server-key"/>. </para> </listitem> @@ -3373,7 +3361,7 @@ Author: Tatsuo Ishii <ishii@postgresql.org> <listitem> <para> -Have <application>pgbench</application> report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) +Have <xref linkend="pgbench"/> report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) <ulink url="&commit_baseurl;cae0f3c40">§</ulink> </para> </listitem> @@ -3390,7 +3378,7 @@ Add <xref linkend="isn"/> server variable <literal>weak</literal> to control inv </para> <para> -This was previously only controlled by function <function>isn_weak()</function>. +This was previously only controlled by function <link linkend="isn-functions"><function>isn_weak()</function></link>. </para> </listitem> @@ -3401,7 +3389,7 @@ Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> <listitem> <para> -Allow values to be sorted to speed <application>btree_gist</application> index builds (Bernd Helmle, Andrey Borodin) +Allow values to be sorted to speed <xref linkend="btree-gist"/> index builds (Bernd Helmle, Andrey Borodin) <ulink url="&commit_baseurl;e4309f73f">§</ulink> </para> </listitem> @@ -3413,7 +3401,7 @@ Author: Tomas Vondra <tomas.vondra@postgresql.org> <listitem> <para> -Add amcheck function <function>gin_index_check()</function> to verify <literal>GIN</literal> indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) +Add <xref linkend="amcheck"/> check function <link linkend="amcheck-functions"><function>gin_index_check()</function></link> to verify <literal>GIN</literal> indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) <ulink url="&commit_baseurl;14ffaece0">§</ulink> </para> </listitem> @@ -3425,12 +3413,12 @@ Author: Andres Freund <andres@anarazel.de> <listitem> <para> -Add functions <function>pg_buffercache_evict_relation()</function> and <function>pg_buffercache_evict_all()</function> to evict unpinned shared buffers (Nazir Bilal Yavuz) +Add functions <link linkend="pgbuffercache-pg-buffercache-evict-relation"><function>pg_buffercache_evict_relation()</function></link> and <link linkend="pgbuffercache-pg-buffercache-evict-all"><function>pg_buffercache_evict_all()</function></link> to evict unpinned shared buffers (Nazir Bilal Yavuz) <ulink url="&commit_baseurl;dcf7e1697">§</ulink> </para> <para> -The existing function <function>pg_buffercache_evict()</function> now returns the buffer flush status. +The existing function <link linkend="pgbuffercache-pg-buffercache-evict"><function>pg_buffercache_evict()</function></link> now returns the buffer flush status. </para> </listitem> @@ -3445,7 +3433,7 @@ Author: Robert Haas <rhaas@postgresql.org> <listitem> <para> -Allow extensions to install custom <link linkend="sql-explain"><command>EXPLAIN</command></link> options (Robert Haas, Sami Imseih) +Allow extensions to install custom <xref linkend="sql-explain"/> options (Robert Haas, Sami Imseih) <ulink url="&commit_baseurl;c65bc2e1d">§</ulink> <ulink url="&commit_baseurl;4fd02bf7c">§</ulink> <ulink url="&commit_baseurl;50ba65e73">§</ulink> @@ -3550,7 +3538,7 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org> <listitem> <para> -Add <application>pgcrypto</application> functions <function>sha256crypt()</function> and <function>sha512crypt()</function> (Bernd Helmle) +Add <application>pgcrypto</application> algorithms <link linkend="pgcrypto-crypt-algorithms"><literal>sha256crypt</literal></link> and <link linkend="pgcrypto-crypt-algorithms"><literal>sha512crypt</literal></link> (Bernd Helmle) <ulink url="&commit_baseurl;749a9e20c">§</ulink> </para> </listitem> @@ -3562,19 +3550,31 @@ Author: Daniel Gustafsson <dgustafsson@postgresql.org> <listitem> <para> -Add <acronym>CFB</acronym> mode to <application>pgcrypto</application> encryption and decryption (Umar Hayat) +Add <link linkend="pgcrypto-raw-enc-funcs"><acronym>CFB</acronym></link> mode to <application>pgcrypto</application> encryption and decryption (Umar Hayat) <ulink url="&commit_baseurl;9ad1b3d01">§</ulink> </para> </listitem> <!-- Author: Daniel Gustafsson <dgustafsson@postgresql.org> +2025-01-24 [924d89a35] pgcrypto: Add function to check FIPS mode +--> + +<listitem> +<para> +Add function <link linkend="pgcrypto-openssl-support-funcs"><function>fips_mode()</function></link> to report the server's <acronym>FIPS</acronym> mode (Daniel Gustafsson) +<ulink url="&commit_baseurl;924d89a35">§</ulink> +</para> +</listitem> + +<!-- +Author: Daniel Gustafsson <dgustafsson@postgresql.org> 2025-01-24 [035f99cbe] pgcrypto: Make it possible to disable built-in crypto --> <listitem> <para> -Add <application>pgcrypto</application> server variable <varname>builtin_crypto_enabled</varname> to allow disabling builtin non-<acronym>FIPS</acronym> mode cryptographic functions (Daniel Gustafsson, Joe Conway) +Add <application>pgcrypto</application> server variable <link linkend="pgcrypto-configuration-parameters-builtin_crypto_enabled"><varname>builtin_crypto_enabled</varname></link> to allow disabling builtin non-<acronym>FIPS</acronym> mode cryptographic functions (Daniel Gustafsson, Joe Conway) <ulink url="&commit_baseurl;035f99cbe">§</ulink> </para> diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index c3ec2076a52..f2898fee5fc 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -2592,7 +2592,9 @@ makeObjectName(const char *name1, const char *name2, const char *label) * constraint names.) * * Note: it is theoretically possible to get a collision anyway, if someone - * else chooses the same name concurrently. This is fairly unlikely to be + * else chooses the same name concurrently. We shorten the race condition + * window by checking for conflicting relations using SnapshotDirty, but + * that doesn't close the window entirely. This is fairly unlikely to be * a problem in practice, especially if one is holding an exclusive lock on * the relation identified by name1. However, if choosing multiple names * within a single command, you'd better create the new object and do @@ -2608,15 +2610,45 @@ ChooseRelationName(const char *name1, const char *name2, int pass = 0; char *relname = NULL; char modlabel[NAMEDATALEN]; + SnapshotData SnapshotDirty; + Relation pgclassrel; + + /* prepare to search pg_class with a dirty snapshot */ + InitDirtySnapshot(SnapshotDirty); + pgclassrel = table_open(RelationRelationId, AccessShareLock); /* try the unmodified label first */ strlcpy(modlabel, label, sizeof(modlabel)); for (;;) { + ScanKeyData key[2]; + SysScanDesc scan; + bool collides; + relname = makeObjectName(name1, name2, modlabel); - if (!OidIsValid(get_relname_relid(relname, namespaceid))) + /* is there any conflicting relation name? */ + ScanKeyInit(&key[0], + Anum_pg_class_relname, + BTEqualStrategyNumber, F_NAMEEQ, + CStringGetDatum(relname)); + ScanKeyInit(&key[1], + Anum_pg_class_relnamespace, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(namespaceid)); + + scan = systable_beginscan(pgclassrel, ClassNameNspIndexId, + true /* indexOK */ , + &SnapshotDirty, + 2, key); + + collides = HeapTupleIsValid(systable_getnext(scan)); + + systable_endscan(scan); + + /* break out of loop if no conflict */ + if (!collides) { if (!isconstraint || !ConstraintNameExists(relname, namespaceid)) @@ -2628,6 +2660,8 @@ ChooseRelationName(const char *name1, const char *name2, snprintf(modlabel, sizeof(modlabel), "%s%d", label, ++pass); } + table_close(pgclassrel, AccessShareLock); + return relname; } diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index 26f0336f1e4..7aa8f5d799c 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -876,16 +876,13 @@ try_nestloop_path(PlannerInfo *root, /* * Check to see if proposed path is still parameterized, and reject if the * parameterization wouldn't be sensible --- unless allow_star_schema_join - * says to allow it anyway. Also, we must reject if have_dangerous_phv - * doesn't like the look of it, which could only happen if the nestloop is - * still parameterized. + * says to allow it anyway. */ required_outer = calc_nestloop_required_outer(outerrelids, outer_paramrels, innerrelids, inner_paramrels); if (required_outer && - ((!bms_overlap(required_outer, extra->param_source_rels) && - !allow_star_schema_join(root, outerrelids, inner_paramrels)) || - have_dangerous_phv(root, outerrelids, inner_paramrels))) + !bms_overlap(required_outer, extra->param_source_rels) && + !allow_star_schema_join(root, outerrelids, inner_paramrels)) { /* Waste no memory when we reject a path here */ bms_free(required_outer); diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c index 60d65762b5d..aad41b94009 100644 --- a/src/backend/optimizer/path/joinrels.c +++ b/src/backend/optimizer/path/joinrels.c @@ -565,9 +565,6 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, * Also, if the lateral reference is only indirect, we should reject * the join; whatever rel(s) the reference chain goes through must be * joined to first. - * - * Another case that might keep us from building a valid plan is the - * implementation restriction described by have_dangerous_phv(). */ lateral_fwd = bms_overlap(rel1->relids, rel2->lateral_relids); lateral_rev = bms_overlap(rel2->relids, rel1->lateral_relids); @@ -584,9 +581,6 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, /* check there is a direct reference from rel2 to rel1 */ if (!bms_overlap(rel1->relids, rel2->direct_lateral_relids)) return false; /* only indirect refs, so reject */ - /* check we won't have a dangerous PHV */ - if (have_dangerous_phv(root, rel1->relids, rel2->lateral_relids)) - return false; /* might be unable to handle required PHV */ } else if (lateral_rev) { @@ -599,9 +593,6 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, /* check there is a direct reference from rel1 to rel2 */ if (!bms_overlap(rel2->relids, rel1->direct_lateral_relids)) return false; /* only indirect refs, so reject */ - /* check we won't have a dangerous PHV */ - if (have_dangerous_phv(root, rel2->relids, rel1->lateral_relids)) - return false; /* might be unable to handle required PHV */ } /* @@ -1279,57 +1270,6 @@ has_legal_joinclause(PlannerInfo *root, RelOptInfo *rel) /* - * There's a pitfall for creating parameterized nestloops: suppose the inner - * rel (call it A) has a parameter that is a PlaceHolderVar, and that PHV's - * minimum eval_at set includes the outer rel (B) and some third rel (C). - * We might think we could create a B/A nestloop join that's parameterized by - * C. But we would end up with a plan in which the PHV's expression has to be - * evaluated as a nestloop parameter at the B/A join; and the executor is only - * set up to handle simple Vars as NestLoopParams. Rather than add complexity - * and overhead to the executor for such corner cases, it seems better to - * forbid the join. (Note that we can still make use of A's parameterized - * path with pre-joined B+C as the outer rel. have_join_order_restriction() - * ensures that we will consider making such a join even if there are not - * other reasons to do so.) - * - * So we check whether any PHVs used in the query could pose such a hazard. - * We don't have any simple way of checking whether a risky PHV would actually - * be used in the inner plan, and the case is so unusual that it doesn't seem - * worth working very hard on it. - * - * This needs to be checked in two places. If the inner rel's minimum - * parameterization would trigger the restriction, then join_is_legal() should - * reject the join altogether, because there will be no workable paths for it. - * But joinpath.c has to check again for every proposed nestloop path, because - * the inner path might have more than the minimum parameterization, causing - * some PHV to be dangerous for it that otherwise wouldn't be. - */ -bool -have_dangerous_phv(PlannerInfo *root, - Relids outer_relids, Relids inner_params) -{ - ListCell *lc; - - foreach(lc, root->placeholder_list) - { - PlaceHolderInfo *phinfo = (PlaceHolderInfo *) lfirst(lc); - - if (!bms_is_subset(phinfo->ph_eval_at, inner_params)) - continue; /* ignore, could not be a nestloop param */ - if (!bms_overlap(phinfo->ph_eval_at, outer_relids)) - continue; /* ignore, not relevant to this join */ - if (bms_is_subset(phinfo->ph_eval_at, outer_relids)) - continue; /* safe, it can be eval'd within outerrel */ - /* Otherwise, it's potentially unsafe, so reject the join */ - return true; - } - - /* OK to perform the join */ - return false; -} - - -/* * is_dummy_rel --- has relation been proven empty? */ bool diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 4ad30b7627e..8baf36ba4b7 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -4348,9 +4348,11 @@ create_nestloop_plan(PlannerInfo *root, List *joinrestrictclauses = best_path->jpath.joinrestrictinfo; List *joinclauses; List *otherclauses; - Relids outerrelids; List *nestParams; + List *outer_tlist; + bool outer_parallel_safe; Relids saveOuterRels = root->curOuterRels; + ListCell *lc; /* * If the inner path is parameterized by the topmost parent of the outer @@ -4412,9 +4414,47 @@ create_nestloop_plan(PlannerInfo *root, * Identify any nestloop parameters that should be supplied by this join * node, and remove them from root->curOuterParams. */ - outerrelids = best_path->jpath.outerjoinpath->parent->relids; - nestParams = identify_current_nestloop_params(root, outerrelids); + nestParams = identify_current_nestloop_params(root, + best_path->jpath.outerjoinpath); + + /* + * While nestloop parameters that are Vars had better be available from + * the outer_plan already, there are edge cases where nestloop parameters + * that are PHVs won't be. In such cases we must add them to the + * outer_plan's tlist, since the executor's NestLoopParam machinery + * requires the params to be simple outer-Var references to that tlist. + */ + outer_tlist = outer_plan->targetlist; + outer_parallel_safe = outer_plan->parallel_safe; + foreach(lc, nestParams) + { + NestLoopParam *nlp = (NestLoopParam *) lfirst(lc); + TargetEntry *tle; + + if (IsA(nlp->paramval, Var)) + continue; /* nothing to do for simple Vars */ + if (tlist_member((Expr *) nlp->paramval, outer_tlist)) + continue; /* already available */ + + /* Make a shallow copy of outer_tlist, if we didn't already */ + if (outer_tlist == outer_plan->targetlist) + outer_tlist = list_copy(outer_tlist); + /* ... and add the needed expression */ + tle = makeTargetEntry((Expr *) copyObject(nlp->paramval), + list_length(outer_tlist) + 1, + NULL, + true); + outer_tlist = lappend(outer_tlist, tle); + /* ... and track whether tlist is (still) parallel-safe */ + if (outer_parallel_safe) + outer_parallel_safe = is_parallel_safe(root, + (Node *) nlp->paramval); + } + if (outer_tlist != outer_plan->targetlist) + outer_plan = change_plan_targetlist(outer_plan, outer_tlist, + outer_parallel_safe); + /* And finally, we can build the join plan node */ join_plan = make_nestloop(tlist, joinclauses, otherclauses, diff --git a/src/backend/optimizer/util/paramassign.c b/src/backend/optimizer/util/paramassign.c index 3bd3ce37c8f..9836abf9479 100644 --- a/src/backend/optimizer/util/paramassign.c +++ b/src/backend/optimizer/util/paramassign.c @@ -600,7 +600,7 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params) /* * Identify any NestLoopParams that should be supplied by a NestLoop plan - * node with the specified lefthand rels. Remove them from the active + * node with the specified lefthand input path. Remove them from the active * root->curOuterParams list and return them as the result list. * * XXX Here we also hack up the returned Vars and PHVs so that they do not @@ -626,11 +626,26 @@ process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params) * subquery, which'd be unduly expensive. */ List * -identify_current_nestloop_params(PlannerInfo *root, Relids leftrelids) +identify_current_nestloop_params(PlannerInfo *root, Path *leftpath) { List *result; + Relids leftrelids = leftpath->parent->relids; + Relids outerrelids = PATH_REQ_OUTER(leftpath); + Relids allleftrelids; ListCell *cell; + /* + * We'll be able to evaluate a PHV in the lefthand path if it uses the + * lefthand rels plus any available required-outer rels. But don't do so + * if it uses *only* required-outer rels; in that case it should be + * evaluated higher in the tree. For Vars, no such hair-splitting is + * necessary since they depend on only one relid. + */ + if (outerrelids) + allleftrelids = bms_union(leftrelids, outerrelids); + else + allleftrelids = leftrelids; + result = NIL; foreach(cell, root->curOuterParams) { @@ -653,18 +668,20 @@ identify_current_nestloop_params(PlannerInfo *root, Relids leftrelids) leftrelids); result = lappend(result, nlp); } - else if (IsA(nlp->paramval, PlaceHolderVar) && - bms_is_subset(find_placeholder_info(root, - (PlaceHolderVar *) nlp->paramval)->ph_eval_at, - leftrelids)) + else if (IsA(nlp->paramval, PlaceHolderVar)) { PlaceHolderVar *phv = (PlaceHolderVar *) nlp->paramval; + Relids eval_at = find_placeholder_info(root, phv)->ph_eval_at; - root->curOuterParams = foreach_delete_current(root->curOuterParams, - cell); - phv->phnullingrels = bms_intersect(phv->phnullingrels, - leftrelids); - result = lappend(result, nlp); + if (bms_is_subset(eval_at, allleftrelids) && + bms_overlap(eval_at, leftrelids)) + { + root->curOuterParams = foreach_delete_current(root->curOuterParams, + cell); + phv->phnullingrels = bms_intersect(phv->phnullingrels, + leftrelids); + result = lappend(result, nlp); + } } } return result; diff --git a/src/include/optimizer/paramassign.h b/src/include/optimizer/paramassign.h index 59dcb1ff053..d30d20de299 100644 --- a/src/include/optimizer/paramassign.h +++ b/src/include/optimizer/paramassign.h @@ -30,7 +30,7 @@ extern Param *replace_nestloop_param_placeholdervar(PlannerInfo *root, extern void process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params); extern List *identify_current_nestloop_params(PlannerInfo *root, - Relids leftrelids); + Path *leftpath); extern Param *generate_new_exec_param(PlannerInfo *root, Oid paramtype, int32 paramtypmod, Oid paramcollation); extern int assign_special_exec_param(PlannerInfo *root); diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index a48c9721797..8410531f2d6 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -109,8 +109,6 @@ extern Relids add_outer_joins_to_relids(PlannerInfo *root, Relids input_relids, List **pushed_down_joins); extern bool have_join_order_restriction(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2); -extern bool have_dangerous_phv(PlannerInfo *root, - Relids outer_relids, Relids inner_params); extern void mark_dummy_rel(RelOptInfo *rel); extern void init_dummy_sjinfo(SpecialJoinInfo *sjinfo, Relids left_relids, Relids right_relids); diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk index 0de3737e789..039cee3dfe5 100644 --- a/src/makefiles/pgxs.mk +++ b/src/makefiles/pgxs.mk @@ -376,10 +376,7 @@ endif ifdef REGRESS # things created by various check targets rm -rf $(pg_regress_clean_files) -ifeq ($(PORTNAME), win) - rm -f regress.def endif -endif # REGRESS ifdef TAP_TESTS rm -rf tmp_check/ endif diff --git a/src/test/recovery/t/046_checkpoint_logical_slot.pl b/src/test/recovery/t/046_checkpoint_logical_slot.pl index b4265c4a6a5..d67c5108d78 100644 --- a/src/test/recovery/t/046_checkpoint_logical_slot.pl +++ b/src/test/recovery/t/046_checkpoint_logical_slot.pl @@ -21,15 +21,18 @@ my ($node, $result); $node = PostgreSQL::Test::Cluster->new('mike'); $node->init; -$node->append_conf('postgresql.conf', - "shared_preload_libraries = 'injection_points'"); $node->append_conf('postgresql.conf', "wal_level = 'logical'"); $node->start; -$node->safe_psql('postgres', q(CREATE EXTENSION injection_points)); -# Create a simple table to generate data into. -$node->safe_psql('postgres', - q{create table t (id serial primary key, b text)}); +# Check if the extension injection_points is available, as it may be +# possible that this script is run with installcheck, where the module +# would not be installed by default. +if (!$node->check_extension('injection_points')) +{ + plan skip_all => 'Extension injection_points not installed'; +} + +$node->safe_psql('postgres', q(CREATE EXTENSION injection_points)); # Create the two slots we'll need. $node->safe_psql('postgres', @@ -58,23 +61,17 @@ SELECT 1 \watch 0.1 \q )); -# Insert 2M rows; that's about 260MB (~20 segments) worth of WAL. -$node->safe_psql('postgres', - q{insert into t (b) select md5(i::text) from generate_series(1,1000000) s(i)} -); +$node->advance_wal(20); # Run another checkpoint to set a new restore LSN. $node->safe_psql('postgres', q{checkpoint}); -# Another 2M rows; that's about 260MB (~20 segments) worth of WAL. -$node->safe_psql('postgres', - q{insert into t (b) select md5(i::text) from generate_series(1,1000000) s(i)} -); +$node->advance_wal(20); # Run another checkpoint, this time in the background, and make it wait # on the injection point) so that the checkpoint stops right before # removing old WAL segments. -note('starting checkpoint\n'); +note('starting checkpoint'); my $checkpoint = $node->background_psql('postgres'); $checkpoint->query_safe( @@ -88,7 +85,7 @@ checkpoint; )); # Wait until the checkpoint stops right before removing WAL segments. -note('waiting for injection_point\n'); +note('waiting for injection_point'); $node->wait_for_event('checkpointer', 'checkpoint-before-old-wal-removal'); note('injection_point is reached'); @@ -107,7 +104,7 @@ select count(*) from pg_logical_slot_get_changes('slot_logical', null, null) \wa )); # Wait until the slot's restart_lsn points to the next WAL segment. -note('waiting for injection_point\n'); +note('waiting for injection_point'); $node->wait_for_event('client backend', 'logical-replication-slot-advance-segment'); note('injection_point is reached'); diff --git a/src/test/recovery/t/047_checkpoint_physical_slot.pl b/src/test/recovery/t/047_checkpoint_physical_slot.pl index 454e56b9bd2..a1332b5d44c 100644 --- a/src/test/recovery/t/047_checkpoint_physical_slot.pl +++ b/src/test/recovery/t/047_checkpoint_physical_slot.pl @@ -21,15 +21,18 @@ my ($node, $result); $node = PostgreSQL::Test::Cluster->new('mike'); $node->init; -$node->append_conf('postgresql.conf', - "shared_preload_libraries = 'injection_points'"); $node->append_conf('postgresql.conf', "wal_level = 'replica'"); $node->start; -$node->safe_psql('postgres', q(CREATE EXTENSION injection_points)); -# Create a simple table to generate data into. -$node->safe_psql('postgres', - q{create table t (id serial primary key, b text)}); +# Check if the extension injection_points is available, as it may be +# possible that this script is run with installcheck, where the module +# would not be installed by default. +if (!$node->check_extension('injection_points')) +{ + plan skip_all => 'Extension injection_points not installed'; +} + +$node->safe_psql('postgres', q(CREATE EXTENSION injection_points)); # Create a physical replication slot. $node->safe_psql('postgres', @@ -44,9 +47,7 @@ $node->safe_psql('postgres', $node->safe_psql('postgres', q{checkpoint}); # Insert 2M rows; that's about 260MB (~20 segments) worth of WAL. -$node->safe_psql('postgres', - q{insert into t (b) select md5(i::text) from generate_series(1,100000) s(i)} -); +$node->advance_wal(20); # Advance slot to the current position, just to have everything "valid". $node->safe_psql('postgres', @@ -57,9 +58,7 @@ $node->safe_psql('postgres', $node->safe_psql('postgres', q{checkpoint}); # Another 2M rows; that's about 260MB (~20 segments) worth of WAL. -$node->safe_psql('postgres', - q{insert into t (b) select md5(i::text) from generate_series(1,1000000) s(i)} -); +$node->advance_wal(20); my $restart_lsn_init = $node->safe_psql('postgres', q{select restart_lsn from pg_replication_slots where slot_name = 'slot_physical'} diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index f35a0b18c37..c292f04fdba 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -3946,6 +3946,59 @@ where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; (1 row) -- variant that isn't quite a star-schema case +explain (verbose, costs off) +select ss1.d1 from + tenk1 as t1 + inner join tenk1 as t2 + on t1.tenthous = t2.ten + inner join + int8_tbl as i8 + left join int4_tbl as i4 + inner join (select 64::information_schema.cardinal_number as d1 + from tenk1 t3, + lateral (select abs(t3.unique1) + random()) ss0(x) + where t3.fivethous < 0) as ss1 + on i4.f1 = ss1.d1 + on i8.q1 = i4.f1 + on t1.tenthous = ss1.d1 +where t1.unique1 < i4.f1; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Nested Loop + Output: (64)::information_schema.cardinal_number + Join Filter: (t1.tenthous = ((64)::information_schema.cardinal_number)::integer) + -> Seq Scan on public.tenk1 t3 + Output: t3.unique1, t3.unique2, t3.two, t3.four, t3.ten, t3.twenty, t3.hundred, t3.thousand, t3.twothousand, t3.fivethous, t3.tenthous, t3.odd, t3.even, t3.stringu1, t3.stringu2, t3.string4 + Filter: (t3.fivethous < 0) + -> Nested Loop + Output: t1.tenthous, t2.ten + -> Nested Loop + Output: t1.tenthous, t2.ten, i4.f1 + Join Filter: (t1.unique1 < i4.f1) + -> Hash Join + Output: t1.tenthous, t1.unique1, t2.ten + Hash Cond: (t2.ten = t1.tenthous) + -> Seq Scan on public.tenk1 t2 + Output: t2.unique1, t2.unique2, t2.two, t2.four, t2.ten, t2.twenty, t2.hundred, t2.thousand, t2.twothousand, t2.fivethous, t2.tenthous, t2.odd, t2.even, t2.stringu1, t2.stringu2, t2.string4 + -> Hash + Output: t1.tenthous, t1.unique1 + -> Nested Loop + Output: t1.tenthous, t1.unique1 + -> Subquery Scan on ss0 + Output: ss0.x, (64)::information_schema.cardinal_number + -> Result + Output: ((abs(t3.unique1))::double precision + random()) + -> Index Scan using tenk1_thous_tenthous on public.tenk1 t1 + Output: t1.unique1, t1.unique2, t1.two, t1.four, t1.ten, t1.twenty, t1.hundred, t1.thousand, t1.twothousand, t1.fivethous, t1.tenthous, t1.odd, t1.even, t1.stringu1, t1.stringu2, t1.string4 + Index Cond: (t1.tenthous = (((64)::information_schema.cardinal_number))::integer) + -> Seq Scan on public.int4_tbl i4 + Output: i4.f1 + Filter: (i4.f1 = ((64)::information_schema.cardinal_number)::integer) + -> Seq Scan on public.int8_tbl i8 + Output: i8.q1, i8.q2 + Filter: (i8.q1 = ((64)::information_schema.cardinal_number)::integer) +(33 rows) + select ss1.d1 from tenk1 as t1 inner join tenk1 as t2 @@ -4035,6 +4088,37 @@ select * from 1 | 2 | 2 (1 row) +-- This example demonstrates the folly of our old "have_dangerous_phv" logic +begin; +set local from_collapse_limit to 2; +explain (verbose, costs off) +select * from int8_tbl t1 + left join + (select coalesce(t2.q1 + x, 0) from int8_tbl t2, + lateral (select t3.q1 as x from int8_tbl t3, + lateral (select t2.q1, t3.q1 offset 0) s)) + on true; + QUERY PLAN +------------------------------------------------------------------ + Nested Loop Left Join + Output: t1.q1, t1.q2, (COALESCE((t2.q1 + t3.q1), '0'::bigint)) + -> Seq Scan on public.int8_tbl t1 + Output: t1.q1, t1.q2 + -> Materialize + Output: (COALESCE((t2.q1 + t3.q1), '0'::bigint)) + -> Nested Loop + Output: COALESCE((t2.q1 + t3.q1), '0'::bigint) + -> Seq Scan on public.int8_tbl t2 + Output: t2.q1, t2.q2 + -> Nested Loop + Output: t3.q1 + -> Seq Scan on public.int8_tbl t3 + Output: t3.q1, t3.q2 + -> Result + Output: NULL::bigint, NULL::bigint +(16 rows) + +rollback; -- Test proper handling of appendrel PHVs during useless-RTE removal explain (costs off) select * from diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index cc5128add4d..88d2204e447 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1277,6 +1277,23 @@ where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; -- variant that isn't quite a star-schema case +explain (verbose, costs off) +select ss1.d1 from + tenk1 as t1 + inner join tenk1 as t2 + on t1.tenthous = t2.ten + inner join + int8_tbl as i8 + left join int4_tbl as i4 + inner join (select 64::information_schema.cardinal_number as d1 + from tenk1 t3, + lateral (select abs(t3.unique1) + random()) ss0(x) + where t3.fivethous < 0) as ss1 + on i4.f1 = ss1.d1 + on i8.q1 = i4.f1 + on t1.tenthous = ss1.d1 +where t1.unique1 < i4.f1; + select ss1.d1 from tenk1 as t1 inner join tenk1 as t2 @@ -1332,6 +1349,18 @@ select * from (select 1 as x) ss1 left join (select 2 as y) ss2 on (true), lateral (select ss2.y as z limit 1) ss3; +-- This example demonstrates the folly of our old "have_dangerous_phv" logic +begin; +set local from_collapse_limit to 2; +explain (verbose, costs off) +select * from int8_tbl t1 + left join + (select coalesce(t2.q1 + x, 0) from int8_tbl t2, + lateral (select t3.q1 as x from int8_tbl t3, + lateral (select t2.q1, t3.q1 offset 0) s)) + on true; +rollback; + -- Test proper handling of appendrel PHVs during useless-RTE removal explain (costs off) select * from |