pgsql: Rationalize use of list_concat + list_copy combinations.
Rationalize use of list_concat + list_copy combinations. In the wake of commit 1cff1b95a, the result of list_concat no longer shares the ListCells of the second input. Therefore, we can replace "list_concat(x, list_copy(y))" with just "list_concat(x, y)". To improve call sites that were list_copy'ing the first argument, or both arguments, invent "list_concat_copy()" which produces a new list sharing no ListCells with either input. (This is a bit faster than "list_concat(list_copy(x), y)" because it makes the result list the right size to start with.) In call sites that were not list_copy'ing the second argument, the new semantics mean that we are usually leaking the second List's storage, since typically there is no remaining pointer to it. We considered inventing another list_copy variant that would list_free the second input, but concluded that for most call sites it isn't worth worrying about, given the relative compactness of the new List representation. (Note that in cases where such leakage would happen, the old code already leaked the second List's header; so we're only discussing the size of the leak not whether there is one. I did adjust two or three places that had been troubling to free that header so that they manually free the whole second List.) Patch by me; thanks to David Rowley for review. Discussion: https://postgr.es/m/11587.1550975...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5ee190f8ec37c1bbfb3061e18304e155d600bc8e Modified Files -- contrib/postgres_fdw/deparse.c| 2 +- contrib/postgres_fdw/postgres_fdw.c | 14 src/backend/commands/indexcmds.c | 4 +-- src/backend/executor/functions.c | 3 +- src/backend/nodes/list.c | 50 src/backend/optimizer/path/allpaths.c | 13 +++- src/backend/optimizer/path/costsize.c | 3 +- src/backend/optimizer/path/indxpath.c | 18 --- src/backend/optimizer/plan/createplan.c | 4 +-- src/backend/optimizer/plan/initsplan.c| 1 - src/backend/optimizer/plan/planner.c | 13 +++- src/backend/optimizer/plan/setrefs.c | 2 +- src/backend/optimizer/prep/prepjointree.c | 1 - src/backend/optimizer/prep/prepqual.c | 12 --- src/backend/optimizer/util/clauses.c | 54 --- src/backend/optimizer/util/orclauses.c| 2 +- src/backend/optimizer/util/relnode.c | 34 +-- src/backend/optimizer/util/tlist.c| 5 ++- src/backend/parser/parse_agg.c| 12 +++ src/backend/parser/parse_clause.c | 5 --- src/backend/partitioning/partprune.c | 8 ++--- src/backend/replication/syncrep.c | 5 +-- src/backend/rewrite/rewriteHandler.c | 8 ++--- src/backend/utils/adt/ruleutils.c | 2 +- src/backend/utils/adt/selfuncs.c | 1 - src/include/nodes/pg_list.h | 2 ++ 26 files changed, 130 insertions(+), 148 deletions(-)
pgsql: Remove EState.es_range_table_array.
Remove EState.es_range_table_array. Now that list_nth is O(1), there's no good reason to maintain a separate array of RTE pointers rather than indexing into estate->es_range_table. Deleting the array doesn't save all that much either; but just on cleanliness grounds, it's better not to have duplicate representations of the identical information. Discussion: https://postgr.es/m/14960.1565384...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3c926587b5928795e54dfea65c712a604f63cdeb Modified Files -- src/backend/executor/execMain.c | 1 - src/backend/executor/execUtils.c | 23 +-- src/include/executor/executor.h | 3 +-- src/include/nodes/execnodes.h| 1 - 4 files changed, 6 insertions(+), 22 deletions(-)
pgsql: Fix planner's test for case-foldable characters in ILIKE with IC
Fix planner's test for case-foldable characters in ILIKE with ICU. As coded, the ICU-collation path in pattern_char_isalpha() failed to consider regular ASCII letters to be case-varying. This led to like_fixed_prefix treating too much of an ILIKE pattern as being a fixed prefix, so that indexscans derived from an ILIKE clause might miss entries that they should find. Per bug #15892 from James Inform. This is an oversight in the original ICU patch (commit eccfef81e), so back-patch to v10 where that came in. Discussion: https://postgr.es/m/15892-e5d2bea3e8a04...@postgresql.org Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c0c12ce391d89328640dd948b82466c308d85415 Modified Files -- src/backend/utils/adt/like_support.c | 8 +++--- src/test/regress/expected/collate.icu.utf8.out | 35 +- src/test/regress/sql/collate.icu.utf8.sql | 12 - 3 files changed, 50 insertions(+), 5 deletions(-)
pgsql: Fix planner's test for case-foldable characters in ILIKE with IC
Fix planner's test for case-foldable characters in ILIKE with ICU. As coded, the ICU-collation path in pattern_char_isalpha() failed to consider regular ASCII letters to be case-varying. This led to like_fixed_prefix treating too much of an ILIKE pattern as being a fixed prefix, so that indexscans derived from an ILIKE clause might miss entries that they should find. Per bug #15892 from James Inform. This is an oversight in the original ICU patch (commit eccfef81e), so back-patch to v10 where that came in. Discussion: https://postgr.es/m/15892-e5d2bea3e8a04...@postgresql.org Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c914e74d2dee0ecf372c1d40f87499d94d591935 Modified Files -- src/backend/utils/adt/selfuncs.c | 10 src/test/regress/expected/collate.icu.utf8.out | 32 ++ src/test/regress/sql/collate.icu.utf8.sql | 9 3 files changed, 47 insertions(+), 4 deletions(-)
pgsql: Fix planner's test for case-foldable characters in ILIKE with IC
Fix planner's test for case-foldable characters in ILIKE with ICU. As coded, the ICU-collation path in pattern_char_isalpha() failed to consider regular ASCII letters to be case-varying. This led to like_fixed_prefix treating too much of an ILIKE pattern as being a fixed prefix, so that indexscans derived from an ILIKE clause might miss entries that they should find. Per bug #15892 from James Inform. This is an oversight in the original ICU patch (commit eccfef81e), so back-patch to v10 where that came in. Discussion: https://postgr.es/m/15892-e5d2bea3e8a04...@postgresql.org Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/886cf85b52cfdd84c0ff9b24193c7e0e0035b1c7 Modified Files -- src/backend/utils/adt/selfuncs.c | 10 src/test/regress/expected/collate.icu.utf8.out | 32 ++ src/test/regress/sql/collate.icu.utf8.sql | 9 3 files changed, 47 insertions(+), 4 deletions(-)
pgsql: Fix planner's test for case-foldable characters in ILIKE with IC
Fix planner's test for case-foldable characters in ILIKE with ICU. As coded, the ICU-collation path in pattern_char_isalpha() failed to consider regular ASCII letters to be case-varying. This led to like_fixed_prefix treating too much of an ILIKE pattern as being a fixed prefix, so that indexscans derived from an ILIKE clause might miss entries that they should find. Per bug #15892 from James Inform. This is an oversight in the original ICU patch (commit eccfef81e), so back-patch to v10 where that came in. Discussion: https://postgr.es/m/15892-e5d2bea3e8a04...@postgresql.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/03c811a483b243952874d8e2b3f0c2e3793bc952 Modified Files -- src/backend/utils/adt/like_support.c | 8 +++--- src/test/regress/expected/collate.icu.utf8.out | 35 +- src/test/regress/sql/collate.icu.utf8.sql | 12 - 3 files changed, 50 insertions(+), 5 deletions(-)
pgsql: Fix compiler warning
Fix compiler warning With some newer gcc versions (8 and 9) you get a -Wformat-overflow warning here. In PG11 and later this was already fixed. Since it's trivial, backport it to get the older branches building without warnings. Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/333a186dc52e32ce250c9d62d9dbaecbd359d651 Modified Files -- src/bin/pgbench/pgbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Fix compiler warning
Fix compiler warning With some newer gcc versions (8 and 9) you get a -Wformat-overflow warning here. In PG11 and later this was already fixed. Since it's trivial, backport it to get the older branches building without warnings. Branch -- REL9_5_STABLE Details --- https://git.postgresql.org/pg/commitdiff/72bdf0f9e4418f49c76743b860fcc471539bc770 Modified Files -- src/bin/pgbench/pgbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Fix compiler warning
Fix compiler warning With some newer gcc versions (8 and 9) you get a -Wformat-overflow warning here. In PG11 and later this was already fixed. Since it's trivial, backport it to get the older branches building without warnings. Branch -- REL9_6_STABLE Details --- https://git.postgresql.org/pg/commitdiff/99493bcbe79dcc0c6efb59af25aca86baf649ab2 Modified Files -- src/bin/pgbench/pgbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Fix compiler warning
Fix compiler warning With some newer gcc versions (8 and 9) you get a -Wformat-overflow warning here. In PG11 and later this was already fixed. Since it's trivial, backport it to get the older branches building without warnings. Branch -- REL9_4_STABLE Details --- https://git.postgresql.org/pg/commitdiff/f02bd634a68c732b4a6eb7cae572d35835a50518 Modified Files -- contrib/pgbench/pgbench.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: amcheck: Skip unlogged relations during recovery.
amcheck: Skip unlogged relations during recovery. contrib/amcheck failed to consider the possibility that unlogged relations will not have any main relation fork files when running in hot standby mode. This led to low-level "can't happen" errors that complain about the absence of a relfilenode file. To fix, simply skip verification of unlogged index relations during recovery. In passing, add a direct check for the presence of a main fork just before verification proper begins, so that we cleanly verify the presence of the main relation fork file. Author: Andrey Borodin, Peter Geoghegan Reported-By: Andrey Borodin Diagnosed-By: Andrey Borodin Discussion: https://postgr.es/m/da9b33ac-53cb-4643-96d4-7a0bbc037...@yandex-team.ru Backpatch: 10-, where amcheck was introduced. Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/f8d2cdc12c9407f26b7872bfb0153a899a5ee299 Modified Files -- contrib/amcheck/verify_nbtree.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-)
pgsql: amcheck: Skip unlogged relations during recovery.
amcheck: Skip unlogged relations during recovery. contrib/amcheck failed to consider the possibility that unlogged relations will not have any main relation fork files when running in hot standby mode. This led to low-level "can't happen" errors that complain about the absence of a relfilenode file. To fix, simply skip verification of unlogged index relations during recovery. In passing, add a direct check for the presence of a main fork just before verification proper begins, so that we cleanly verify the presence of the main relation fork file. Author: Andrey Borodin, Peter Geoghegan Reported-By: Andrey Borodin Diagnosed-By: Andrey Borodin Discussion: https://postgr.es/m/da9b33ac-53cb-4643-96d4-7a0bbc037...@yandex-team.ru Backpatch: 10-, where amcheck was introduced. Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a05fa2c0e77535470b6ee1029671eb41c612f4ef Modified Files -- contrib/amcheck/verify_nbtree.c | 45 - 1 file changed, 40 insertions(+), 5 deletions(-)
pgsql: amcheck: Skip unlogged relations during recovery.
amcheck: Skip unlogged relations during recovery. contrib/amcheck failed to consider the possibility that unlogged relations will not have any main relation fork files when running in hot standby mode. This led to low-level "can't happen" errors that complain about the absence of a relfilenode file. To fix, simply skip verification of unlogged index relations during recovery. In passing, add a direct check for the presence of a main fork just before verification proper begins, so that we cleanly verify the presence of the main relation fork file. Author: Andrey Borodin, Peter Geoghegan Reported-By: Andrey Borodin Diagnosed-By: Andrey Borodin Discussion: https://postgr.es/m/da9b33ac-53cb-4643-96d4-7a0bbc037...@yandex-team.ru Backpatch: 10-, where amcheck was introduced. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6754fe65a4c68c1e3b179080ab62c2f3ff6d877c Modified Files -- contrib/amcheck/verify_nbtree.c | 45 - 1 file changed, 40 insertions(+), 5 deletions(-)
pgsql: amcheck: Skip unlogged relations during recovery.
amcheck: Skip unlogged relations during recovery. contrib/amcheck failed to consider the possibility that unlogged relations will not have any main relation fork files when running in hot standby mode. This led to low-level "can't happen" errors that complain about the absence of a relfilenode file. To fix, simply skip verification of unlogged index relations during recovery. In passing, add a direct check for the presence of a main fork just before verification proper begins, so that we cleanly verify the presence of the main relation fork file. Author: Andrey Borodin, Peter Geoghegan Reported-By: Andrey Borodin Diagnosed-By: Andrey Borodin Discussion: https://postgr.es/m/da9b33ac-53cb-4643-96d4-7a0bbc037...@yandex-team.ru Backpatch: 10-, where amcheck was introduced. Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/4f393793f7d637e4ab8e6460e7bb4cd747f01f85 Modified Files -- contrib/amcheck/verify_nbtree.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-)
pgsql: Fix random regression failure in test case "temp"
Fix random regression failure in test case "temp" This test case could fail because of an incorrect result ordering when looking up at pg_class entries. This commit adds an ORDER BY to the culprit query. The cause of the failure was likely caused by a plan switch. By default, the planner would likely choose an index-only scan or an index scan, but even a small change in the startup cost could have caused a bitmap heap scan to be chosen, causing the failure. While on it, switch some filtering quals to a regular expression as per an idea of Tom Lane. As previously shaped, the quals would have selected any relations whose name begins with "temp". And that could cause failures if another test running in parallel began to use similar relation names. Per report from buildfarm member anole, though the failure was very rare. This test has been introduced by 319a810, so backpatch down to v10. Discussion: https://postgr.es/m/20190807132422.gc15...@paquier.xyz Backpatch-through: 10 Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/fc8c6ae5fdebb8dc39b3d001aa332b80e0945fc2 Modified Files -- src/test/regress/expected/temp.out | 9 + src/test/regress/sql/temp.sql | 9 + 2 files changed, 10 insertions(+), 8 deletions(-)
pgsql: Fix random regression failure in test case "temp"
Fix random regression failure in test case "temp" This test case could fail because of an incorrect result ordering when looking up at pg_class entries. This commit adds an ORDER BY to the culprit query. The cause of the failure was likely caused by a plan switch. By default, the planner would likely choose an index-only scan or an index scan, but even a small change in the startup cost could have caused a bitmap heap scan to be chosen, causing the failure. While on it, switch some filtering quals to a regular expression as per an idea of Tom Lane. As previously shaped, the quals would have selected any relations whose name begins with "temp". And that could cause failures if another test running in parallel began to use similar relation names. Per report from buildfarm member anole, though the failure was very rare. This test has been introduced by 319a810, so backpatch down to v10. Discussion: https://postgr.es/m/20190807132422.gc15...@paquier.xyz Backpatch-through: 10 Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/72f92549b64176e00dad433f8486e302eab8e9bd Modified Files -- src/test/regress/expected/temp.out | 9 + src/test/regress/sql/temp.sql | 9 + 2 files changed, 10 insertions(+), 8 deletions(-)
pgsql: Fix random regression failure in test case "temp"
Fix random regression failure in test case "temp" This test case could fail because of an incorrect result ordering when looking up at pg_class entries. This commit adds an ORDER BY to the culprit query. The cause of the failure was likely caused by a plan switch. By default, the planner would likely choose an index-only scan or an index scan, but even a small change in the startup cost could have caused a bitmap heap scan to be chosen, causing the failure. While on it, switch some filtering quals to a regular expression as per an idea of Tom Lane. As previously shaped, the quals would have selected any relations whose name begins with "temp". And that could cause failures if another test running in parallel began to use similar relation names. Per report from buildfarm member anole, though the failure was very rare. This test has been introduced by 319a810, so backpatch down to v10. Discussion: https://postgr.es/m/20190807132422.gc15...@paquier.xyz Backpatch-through: 10 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/4c0b9cf9e073ca2dc95a75fe983d90fd518864fb Modified Files -- src/test/regress/expected/temp.out | 9 + src/test/regress/sql/temp.sql | 9 + 2 files changed, 10 insertions(+), 8 deletions(-)
pgsql: Fix random regression failure in test case "temp"
Fix random regression failure in test case "temp" This test case could fail because of an incorrect result ordering when looking up at pg_class entries. This commit adds an ORDER BY to the culprit query. The cause of the failure was likely caused by a plan switch. By default, the planner would likely choose an index-only scan or an index scan, but even a small change in the startup cost could have caused a bitmap heap scan to be chosen, causing the failure. While on it, switch some filtering quals to a regular expression as per an idea of Tom Lane. As previously shaped, the quals would have selected any relations whose name begins with "temp". And that could cause failures if another test running in parallel began to use similar relation names. Per report from buildfarm member anole, though the failure was very rare. This test has been introduced by 319a810, so backpatch down to v10. Discussion: https://postgr.es/m/20190807132422.gc15...@paquier.xyz Backpatch-through: 10 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2d7d67cc74d0f59e76464bd5009bc74f1591018e Modified Files -- src/test/regress/expected/temp.out | 9 + src/test/regress/sql/temp.sql | 9 + 2 files changed, 10 insertions(+), 8 deletions(-)
pgsql: Fix inconsistencies and typos in the tree, take 10
Fix inconsistencies and typos in the tree, take 10 This addresses some issues with unnecessary code comments, fixes various typos in docs and comments, and removes some orphaned structures and definitions. Author: Alexander Lakhin Discussion: https://postgr.es/m/9aabc775-5494-b372-8bcb-4dfc0bd37...@gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/66bde49d96a9ddacc49dcbdf1b47b5bd6e31ead5 Modified Files -- contrib/fuzzystrmatch/dmetaphone.c| 2 +- contrib/ltree/ltxtquery_io.c | 2 +- contrib/pgcrypto/internal.c | 19 --- contrib/pgcrypto/pgp-decrypt.c| 7 +-- contrib/pgcrypto/pgp-encrypt.c| 2 +- contrib/pgcrypto/pgp.h| 2 +- contrib/sepgsql/label.c | 2 +- contrib/sepgsql/selinux.c | 6 ++ contrib/spi/refint.example| 2 +- doc/src/sgml/ecpg.sgml| 2 +- doc/src/sgml/plpgsql.sgml | 8 doc/src/sgml/sources.sgml | 2 +- src/backend/access/brin/brin_revmap.c | 7 --- src/backend/access/gist/gist.c| 4 ++-- src/backend/access/hash/hashpage.c| 2 +- src/backend/access/heap/heapam.c | 2 +- src/backend/access/nbtree/nbtutils.c | 2 +- src/backend/access/transam/slru.c | 2 +- src/backend/access/transam/xact.c | 2 +- src/backend/access/transam/xlogreader.c | 2 +- src/backend/catalog/catalog.c | 7 --- src/backend/catalog/pg_constraint.c | 2 +- src/backend/commands/cluster.c| 2 +- src/backend/commands/sequence.c | 2 +- src/backend/executor/spi.c| 4 ++-- src/backend/libpq/auth.c | 2 +- src/backend/libpq/pqcomm.c| 8 src/backend/optimizer/path/costsize.c | 2 +- src/backend/partitioning/partbounds.c | 2 +- src/backend/partitioning/partprune.c | 2 +- src/backend/port/posix_sema.c | 2 +- src/backend/port/win32/signal.c | 2 +- src/backend/postmaster/checkpointer.c | 2 +- src/backend/replication/basebackup.c | 2 +- src/backend/replication/logical/snapbuild.c | 2 +- src/backend/replication/logical/worker.c | 2 +- src/backend/replication/slot.c| 4 ++-- src/backend/storage/file/fd.c | 4 src/backend/storage/ipc/procarray.c | 8 +++- src/backend/storage/lmgr/lwlock.c | 4 ++-- src/backend/storage/lmgr/predicate.c | 4 ++-- src/backend/utils/adt/pg_locale.c | 2 +- src/backend/utils/adt/rangetypes_typanalyze.c | 2 +- src/backend/utils/adt/txid.c | 2 +- src/backend/utils/adt/varlena.c | 2 +- src/backend/utils/adt/xml.c | 2 +- src/backend/utils/misc/check_guc | 2 +- src/backend/utils/mmgr/slab.c | 2 +- src/backend/utils/sort/tuplesort.c| 2 +- src/bin/pg_dump/pg_backup_archiver.c | 2 +- src/bin/pg_rewind/pg_rewind.c | 2 +- src/bin/pg_upgrade/pg_upgrade.h | 2 +- src/include/access/brin_revmap.h | 2 +- src/include/access/hash_xlog.h| 13 - src/include/access/reloptions.h | 2 +- src/include/access/xlogreader.h | 2 +- src/include/catalog/namespace.h | 2 +- src/include/nodes/nodes.h | 4 ++-- src/include/port/win32_port.h | 2 +- src/include/rewrite/prs2lock.h| 2 +- src/include/storage/standbydefs.h | 2 +- src/include/utils/elog.h | 2 +- src/include/utils/guc.h | 2 +- src/include/utils/rel.h | 2 +- src/include/utils/selfuncs.h | 2 +- src/interfaces/ecpg/compatlib/informix.c | 7 +-- src/interfaces/libpq/libpq-fe.h | 2 +- src/pl/plpython/plpy_subxactobject.c | 2 +- src/port/getaddrinfo.c| 4 ++-- src/test/isolation/specs/sequence-ddl.spec| 2 +- src/test/recovery/t/012_subtransactions.pl| 2 +- src/test/regress/.gitignore | 2 +- src/timezone/pgtz.c | 2 +- src/tools/pgindent/README | 2 +- 74 files changed, 93 insertions(+), 141 deletions(-)
pgsql: Update to DocBook 4.5
Update to DocBook 4.5 This moves us to the latest minor version of DocBook 4. It requires no markup changes. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/416c75cf38fbf58f4589fb27b520b64092a7ceff Modified Files -- configure | 6 +++--- configure.in| 2 +- doc/src/sgml/docguide.sgml | 6 +++--- doc/src/sgml/postgres.sgml | 4 ++-- doc/src/sgml/standalone-install.xml | 2 +- doc/src/sgml/standalone-profile.xsl | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-)