pgsql: Remove lc_ctype_is_c().
Remove lc_ctype_is_c(). Instead always fetch the locale and look at the ctype_is_c field. hba.c relies on regexes working for the C locale without needing catalog access, which worked before due to a special case for C_COLLATION_OID in lc_ctype_is_c(). Move the special case to pg_set_regex_collation() now that lc_ctype_is_c() is gone. Author: Andreas Karlsson Discussion: https://postgr.es/m/60929555-4709-40a7-b136-bcb44cff5...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/51edc4ca54f826cfac012c7306eee479f07a5dc7 Modified Files -- src/backend/regex/regc_pg_locale.c | 21 ++--- src/backend/utils/adt/formatting.c | 27 --- src/backend/utils/adt/like.c | 2 +- src/backend/utils/adt/like_support.c | 19 +++ src/backend/utils/adt/pg_locale.c| 26 -- src/include/catalog/pg_collation.dat | 3 +-- src/include/utils/pg_locale.h| 2 -- 7 files changed, 39 insertions(+), 61 deletions(-)
pgsql: Be more careful with error paths in pg_set_regex_collation().
Be more careful with error paths in pg_set_regex_collation(). Set global variables after error paths so that they don't end up in an inconsistent state. The inconsistent state doesn't lead to an actual problem, because after an error, pg_set_regex_collation() will be called again before the globals are accessed. Change extracted from patch by Andreas Karlsson, though not discussed explicitly. Discussion: https://postgr.es/m/60929555-4709-40a7-b136-bcb44cff5...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7829f85a6285b3703a53ba5963a4df2e768014df Modified Files -- src/backend/regex/regc_pg_locale.c | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-)
pgsql: Remove lc_collate_is_c().
Remove lc_collate_is_c(). Instead just look up the collation and check collate_is_c field. Author: Andreas Karlsson Discussion: https://postgr.es/m/60929555-4709-40a7-b136-bcb44cff5...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/06421b08436414b42cd169501005f15adee986f1 Modified Files -- src/backend/access/spgist/spgtextproc.c | 2 +- src/backend/commands/collationcmds.c| 8 ++-- src/backend/utils/adt/like_support.c| 4 ++-- src/backend/utils/adt/pg_locale.c | 33 +++- src/backend/utils/adt/selfuncs.c| 6 -- src/backend/utils/adt/varchar.c | 20 ++- src/backend/utils/adt/varlena.c | 34 - src/include/utils/pg_locale.h | 1 - 8 files changed, 35 insertions(+), 73 deletions(-)
pgsql: Remember last collation to speed up collation cache.
Remember last collation to speed up collation cache. This optimization is to avoid a performance regression in an upcoming patch that will remove lc_collate_is_c(). Discussion: https://postgr.es/m/96a559be83329bc66074a3925ebcfa8ceb16dfc5.ca...@j-davis.com Discussion: https://postgr.es/m/646f662e145ab38cff1c04d475f4448f53fc5042.ca...@j-davis.com Discussion: https://postgr.es/m/54565933-d82f-4d7c-8f47-288b1b570...@eisentraut.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/12d3345c0d2842a36d0ee2bce06cfe7d3cac84da Modified Files -- src/backend/utils/adt/pg_locale.c | 13 + 1 file changed, 13 insertions(+)
pgsql: Fix obsolete comments in varstr_cmp().
Fix obsolete comments in varstr_cmp(). Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a8395677840c37f6988d7d6420d551d0b744e6bd Modified Files -- src/backend/utils/adt/varlena.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-)
pgsql: Slightly refactor varstr_sortsupport() to improve readability.
Slightly refactor varstr_sortsupport() to improve readability. Author: Andreas Karlsson Discussion: https://postgr.es/m/69c2a864-846f-4309-bd5a-aaa1c34f9...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a95ff1fe2eb4926b13e0940ad1f37d048704bdb0 Modified Files -- src/backend/utils/adt/varlena.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-)
pgsql: Improve configure error for ICU libraries if pkg-config is absen
Improve configure error for ICU libraries if pkg-config is absent. If pkg-config is not installed, the ICU libraries cannot be found, but the custom configure error message did not mention this. This might lead to confusion about the actual problem. To improve this, remove the explicit error message and rely on PKG_CHECK_MODULES' generic error message. Author: Michael Banck Reported-by: Holger Jakobs Discussion: https://postgr.es/m/ccd579ed-4949-d3de-ab13-9e6456fd2caf%40jakobs.com Discussion: https://postgr.es/m/66b5d05c.050a0220.7c8ce.a...@mx.google.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0fb0f689331cb0c00348aab752dced30493a6672 Modified Files -- configure| 30 ++ configure.ac | 6 +- 2 files changed, 23 insertions(+), 13 deletions(-)
pgsql: Fix doc typo: unicode_assigned() return type.
Fix doc typo: unicode_assigned() return type. Reported-by: Hironobu SUZUKI Discussion: https://postgr.es/m/5dd88820-bb00-4b90-904b-738ea2e4e...@interdb.jp Backpatch-through: 17 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/225483238d3e46669c9d73f8faead7aff567c856 Modified Files -- doc/src/sgml/func.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Fix doc typo: unicode_assigned() return type.
Fix doc typo: unicode_assigned() return type. Reported-by: Hironobu SUZUKI Discussion: https://postgr.es/m/5dd88820-bb00-4b90-904b-738ea2e4e...@interdb.jp Backpatch-through: 17 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a3c6aa42ee0d625a55e73e17230db3eaeed3566c Modified Files -- doc/src/sgml/func.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Remove unnecessary check for NULL locale, per Coverity.
Remove unnecessary check for NULL locale, per Coverity. Discussion: https://postgr.es/m/3804933.1723394...@sss.pgh.pa.us Reported-by: Tom Lane Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a459ac504cc62421c08c9ee1ddc3e6f9be61f384 Modified Files -- src/backend/utils/adt/like.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: selfuncs.c: use pg_strxfrm() instead of strxfrm().
selfuncs.c: use pg_strxfrm() instead of strxfrm(). pg_strxfrm() takes a pg_locale_t, so it works properly with all providers. This improves estimates for ICU when performing linear interpolation within a histogram bin. Previously, convert_string_datum() always used strxfrm() and relied on setlocale(). That did not produce good estimates for non-default or non-libc collations. Discussion: https://postgr.es/m/89475ee5487d795124f4e25118ea8f1853edb8cb.ca...@j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a890ad214942c9eab1b2f0c6997e7dc114f99e71 Modified Files -- src/backend/utils/adt/pg_locale.c | 23 --- src/backend/utils/adt/selfuncs.c | 13 + 2 files changed, 25 insertions(+), 11 deletions(-)
pgsql: Remove support for null pg_locale_t most places.
Remove support for null pg_locale_t most places. Previously, passing NULL for pg_locale_t meant "use the libc provider and the server environment". Now that the database collation is represented as a proper pg_locale_t (not dependent on setlocale()), remove special cases for NULL. Leave wchar2char() and char2wchar() unchanged for now, because the callers don't always have a libc-based pg_locale_t available. Discussion: https://postgr.es/m/cfd9eb85-c52a-4ec9-a90e-a5e4de56e...@eisentraut.org Reviewed-by: Peter Eisentraut, Andreas Karlsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e9931bfb7515b253cc26ff495ee917acff8995d0 Modified Files -- src/backend/access/hash/hashfunc.c | 10 ++-- src/backend/regex/regc_pg_locale.c | 113 ++--- src/backend/utils/adt/formatting.c | 84 +++ src/backend/utils/adt/like.c | 10 +--- src/backend/utils/adt/pg_locale.c | 73 +--- src/backend/utils/adt/varchar.c| 10 ++-- src/backend/utils/adt/varlena.c| 28 +++-- 7 files changed, 73 insertions(+), 255 deletions(-)
pgsql: Small refactoring around ExecCreateTableAs().
Small refactoring around ExecCreateTableAs(). Since commit 4b74ebf726, the refresh logic is used to populate materialized views, so we can simplify the error message in ExecCreateTableAs(). Also, RefreshMatViewByOid() is moved to just after create_ctas_nodata() call to improve code readability. Author: Yugo Nagata Discussion: https://postgr.es/m/20240802161301.d975daca9ba7a706fa05e...@sraoss.co.jp Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7926a9a80f6daf0fcc1feb1bee5c51fd001bc173 Modified Files -- src/backend/commands/createas.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-)
pgsql: Add is_create parameter to RefreshMatviewByOid().
Add is_create parameter to RefreshMatviewByOid(). RefreshMatviewByOid is used for both REFRESH and CREATE MATERIALIZED VIEW. This flag is currently just used for handling internal error messages, but also aimed to improve code-readability. Author: Yugo Nagata Discussion: https://postgr.es/m/20240726122630.70e889f63a4d7e26f8549...@sraoss.co.jp Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ca2eea3ac89a4ea16ab069cb681510d05de5285f Modified Files -- src/backend/commands/createas.c | 5 + src/backend/commands/matview.c | 42 + src/include/commands/matview.h | 5 +++-- 3 files changed, 34 insertions(+), 18 deletions(-)
pgsql: Remove unused ParamListInfo argument from ExecRefreshMatView.
Remove unused ParamListInfo argument from ExecRefreshMatView. Author: Yugo Nagata Discussion: https://postgr.es/m/20240726122630.70e889f63a4d7e26f8549...@sraoss.co.jp Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f683d3a4ca6dc441a86ed90070f126c20ea46b45 Modified Files -- src/backend/commands/createas.c | 2 +- src/backend/commands/matview.c | 7 +++ src/backend/tcop/utility.c | 2 +- src/include/commands/matview.h | 5 ++--- 4 files changed, 7 insertions(+), 9 deletions(-)
pgsql: Relax check for return value from second call of pg_strnxfrm().
Relax check for return value from second call of pg_strnxfrm(). strxfrm() is not guaranteed to return the exact number of bytes needed to store the result; it may return a higher value. Discussion: https://postgr.es/m/32f85d88d1f64395abfe5a10dd97a62a4d3474ce.ca...@j-davis.com Reviewed-by: Heikki Linnakangas Backpatch-through: 16 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/403cbd21081939563ec79d100a83b168afcf0300 Modified Files -- src/backend/access/hash/hashfunc.c | 8 ++-- src/backend/utils/adt/pg_locale.c | 12 ++-- src/backend/utils/adt/varchar.c| 8 ++-- 3 files changed, 18 insertions(+), 10 deletions(-)
pgsql: Relax check for return value from second call of pg_strnxfrm().
Relax check for return value from second call of pg_strnxfrm(). strxfrm() is not guaranteed to return the exact number of bytes needed to store the result; it may return a higher value. Discussion: https://postgr.es/m/32f85d88d1f64395abfe5a10dd97a62a4d3474ce.ca...@j-davis.com Reviewed-by: Heikki Linnakangas Backpatch-through: 16 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/10fdc67f81972a03eee928a3b0ae226a78243fad Modified Files -- src/backend/access/hash/hashfunc.c | 8 ++-- src/backend/utils/adt/pg_locale.c | 12 ++-- src/backend/utils/adt/varchar.c| 8 ++-- 3 files changed, 18 insertions(+), 10 deletions(-)
pgsql: Relax check for return value from second call of pg_strnxfrm().
Relax check for return value from second call of pg_strnxfrm(). strxfrm() is not guaranteed to return the exact number of bytes needed to store the result; it may return a higher value. Discussion: https://postgr.es/m/32f85d88d1f64395abfe5a10dd97a62a4d3474ce.ca...@j-davis.com Reviewed-by: Heikki Linnakangas Backpatch-through: 16 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/679c5084cf210c6e958276b657039e8ba0c077c0 Modified Files -- src/backend/access/hash/hashfunc.c | 8 ++-- src/backend/utils/adt/pg_locale.c | 12 ++-- src/backend/utils/adt/varchar.c| 8 ++-- 3 files changed, 18 insertions(+), 10 deletions(-)
pgsql: Make collation not depend on setlocale().
Make collation not depend on setlocale(). Now that the result of pg_newlocale_from_collation() is always non-NULL, then we can move the collate_is_c and ctype_is_c flags into pg_locale_t. That simplifies the logic in lc_collate_is_c() and lc_ctype_is_c(), removing the dependence on setlocale(). This commit also eliminates the multi-stage initialization of the collation cache. As long as we have catalog access, then it's now safe to call pg_newlocale_from_collation() without checking lc_collate_is_c() first. Discussion: https://postgr.es/m/cfd9eb85-c52a-4ec9-a90e-a5e4de56e...@eisentraut.org Reviewed-by: Peter Eisentraut, Andreas Karlsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/72fe6d24a38c88e112d5e63a8e907c3e96ae46ad Modified Files -- src/backend/utils/adt/pg_locale.c | 180 + src/include/utils/pg_locale.h | 14 +++ src/test/regress/expected/collate.utf8.out | 26 + src/test/regress/sql/collate.utf8.sql | 15 +++ 4 files changed, 81 insertions(+), 154 deletions(-)
pgsql: Do not return NULL from pg_newlocale_from_collation().
Do not return NULL from pg_newlocale_from_collation(). Previously, pg_newlocale_from_collation() returned NULL as a special case for the DEFAULT_COLLATION_OID if the provider was libc. In that case the behavior would depend on the last call to setlocale(). Now, consistent with the other providers, it will return a pointer to default_locale, which is not dependent on setlocale(). Note: for the C and POSIX locales, the locale_t structure within the pg_locale_t will still be zero, because those locales are implemented with internal logic and do not use libc at all. lc_collate_is_c() and lc_ctype_is_c() still depend on setlocale() to determine the current locale, which will be removed in a subsequent commit. Discussion: https://postgr.es/m/cfd9eb85-c52a-4ec9-a90e-a5e4de56e...@eisentraut.org Reviewed-by: Peter Eisentraut, Andreas Karlsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8240401437c8e261b4ae95fcc4183db98339cc9e Modified Files -- src/backend/utils/adt/pg_locale.c | 191 ++ 1 file changed, 110 insertions(+), 81 deletions(-)
pgsql: Refactor pg_set_regex_collation() for clarity.
Refactor pg_set_regex_collation() for clarity. Discussion: https://postgr.es/m/63409030-2746-462e-beac-759bd4303...@proxel.se Reviewed-by: Andreas Karlsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2e68077b07cc597ef6bdfacffb5acbd17e179237 Modified Files -- src/backend/regex/regc_pg_locale.c | 34 +++--- 1 file changed, 19 insertions(+), 15 deletions(-)
pgsql: Fix whitespace in commit 005c6b833f.
Fix whitespace in commit 005c6b833f. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c0ef1234dfb68bb0b5c926c0eafd82881ad78374 Modified Files -- src/backend/utils/adt/pg_locale.c | 4 ++-- src/tools/pgindent/typedefs.list | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
pgsql: Refactor: make default_locale internal to pg_locale.c.
Refactor: make default_locale internal to pg_locale.c. Discussion: https://postgr.es/m/2228884bb1f1a02614b39f71a90c94d2cc8a3a2f.ca...@j-davis.com Reviewed-by: Peter Eisentraut, Andreas Karlsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1c461a8d8d3c7a4655fdb944ffca94b1e49e5b3d Modified Files -- src/backend/utils/adt/pg_locale.c | 69 +-- src/backend/utils/init/postinit.c | 43 +++- src/include/utils/pg_locale.h | 3 +- 3 files changed, 72 insertions(+), 43 deletions(-)
pgsql: Change collation cache to use simplehash.h.
Change collation cache to use simplehash.h. Speeds up text comparison expressions when using a collation other than the database default collation. Does not affect larger operations such as ORDER BY, because the lookup is only done once. Discussion: https://postgr.es/m/7bb9f018d20a7b30b9a7f6231efab1b5e50c7720.ca...@j-davis.com Reviewed-by: John Naylor, Andreas Karlsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/005c6b833f7866b71b50a5382e30d6c3f695306e Modified Files -- src/backend/utils/adt/pg_locale.c | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-)
pgsql: When creating materialized views, use REFRESH to load data.
When creating materialized views, use REFRESH to load data. Previously, CREATE MATERIALIZED VIEW ... WITH DATA populated the MV the same way as CREATE TABLE ... AS. Instead, reuse the REFRESH logic, which locks down security-restricted operations and restricts the search_path. This reduces the chance that a subsequent refresh will fail. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/20240630222344.db.nmi...@google.com Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b4da732fd64e936970f38c792f8b32c4bdf2bcd5 Modified Files -- src/backend/commands/createas.c | 32 - src/backend/commands/matview.c | 64 - src/include/commands/matview.h | 3 ++ src/test/regress/expected/namespace.out | 4 +-- 4 files changed, 60 insertions(+), 43 deletions(-)
pgsql: When creating materialized views, use REFRESH to load data.
When creating materialized views, use REFRESH to load data. Previously, CREATE MATERIALIZED VIEW ... WITH DATA populated the MV the same way as CREATE TABLE ... AS. Instead, reuse the REFRESH logic, which locks down security-restricted operations and restricts the search_path. This reduces the chance that a subsequent refresh will fail. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/20240630222344.db.nmi...@google.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4b74ebf726d444ba820830cad986a1f92f724649 Modified Files -- src/backend/commands/createas.c | 32 - src/backend/commands/matview.c | 64 - src/include/commands/matview.h | 3 ++ src/test/regress/expected/namespace.out | 4 +-- 4 files changed, 60 insertions(+), 43 deletions(-)
pgsql: Add missing RestrictSearchPath() calls.
Add missing RestrictSearchPath() calls. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/20240630222344.db.nmi...@google.com Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a15b0edb5dd9d2a3731f374b576485799c00431c Modified Files -- src/backend/commands/indexcmds.c | 4 1 file changed, 4 insertions(+)
pgsql: Add missing RestrictSearchPath() calls.
Add missing RestrictSearchPath() calls. Reported-by: Noah Misch Backpatch-through: 17 Discussion: https://postgr.es/m/20240630222344.db.nmi...@google.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8e28778ce396c3dac74a5fa8724e1ca7cea16d19 Modified Files -- src/backend/commands/indexcmds.c | 4 1 file changed, 4 insertions(+)
pgsql: Fix missing invalidations for search_path cache.
Fix missing invalidations for search_path cache. Reported-by: Noah Misch Discussion: https://postgr.es/m/20240630223047.1f.nmi...@google.com Backpatch-through: 17 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d3e076549b99d1130053223adb9c1fa909d75dc0 Modified Files -- src/backend/catalog/namespace.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-)
pgsql: Fix missing invalidations for search_path cache.
Fix missing invalidations for search_path cache. Reported-by: Noah Misch Discussion: https://postgr.es/m/20240630223047.1f.nmi...@google.com Backpatch-through: 17 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b3bd18294ee471c5a6f1db69be57f08c1e00f1a6 Modified Files -- src/backend/catalog/namespace.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-)
pgsql: Collation documentation fixes.
Collation documentation fixes. Discussion: https://postgr.es/m/9beecdf7-e8c8-4eab-adc7-fa225c2fe...@eisentraut.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8ba34c698d19450ccae9a5aea59a6d0bc8b75c0e Modified Files -- doc/src/sgml/catalogs.sgml | 11 +-- doc/src/sgml/charset.sgml | 4 +++- 2 files changed, 8 insertions(+), 7 deletions(-)
Re: pgsql: Support C.UTF-8 locale in the new builtin collation provider.
On Thu, 2024-05-02 at 09:34 +0200, Peter Eisentraut wrote: > This commit changed the functions builtin_locale_encoding() and > builtin_validate_locale() in pg_locale.c, but did not update the > comments that claim that "C" is the only supported locale name. > > (I think it would be best to remove the comment altogether and let > the > code speak for itself.) Thank you, committed. Regards, Jeff Davis
pgsql: Remove obsolete comment.
Remove obsolete comment. Per suggestion from Peter, the comment was not helpful, so remove it rather than fixing it. Reported-by: Peter Eisentraut Discussion: https://postgr.es/m/d9421b21-e759-4b74-a039-c487b469c...@eisentraut.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/832c4f657fc5d578dc821e9b5175b6ee341e18a8 Modified Files -- src/backend/utils/adt/pg_locale.c | 6 -- 1 file changed, 6 deletions(-)
Re: pgsql: Introduce "builtin" collation provider.
On Tue, 2024-04-23 at 11:23 +0200, Peter Eisentraut wrote: > I think I found a small bug in this commit. Good catch, thank you. Committed a fix. Regards, Jeff Davis
pgsql: Fix locale options checking in CREATE DATABASE.
Fix locale options checking in CREATE DATABASE. Discussion: https://postgr.es/m/4ea13583-7305-40b0-8525-58381533e...@eisentraut.org Reported-by: Peter Eisentraut Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7562a9bd7100702ce7878a17f4aaac1df08a8e09 Modified Files -- src/backend/commands/dbcommands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
pgsql: Fix test failures when language environment is not UTF-8.
Fix test failures when language environment is not UTF-8. For tests that depend on UTF-8 encoding, force LC_COLLATE=C and LC_CTYPE=C to avoid an encoding mismatch. Reported-by: Thomas Munro Discussion: https://postgr.es/m/CA+hUKGK-ZqV1njkG_=xcCqXh2fcMkz85FTMnhS2opm4ZerH=x...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e2a235767180941eef8887240ddace1a021f04e3 Modified Files -- src/bin/initdb/t/001_initdb.pl| 2 ++ src/bin/scripts/t/020_createdb.pl | 2 ++ 2 files changed, 4 insertions(+)
pgsql: CREATE INDEX: do not update stats during binary upgrade.
CREATE INDEX: do not update stats during binary upgrade. During binary upgrade, indexes are created before the data is moved into place, so it will always be zero. This is not currently a major problem, but will be when we try to preserve statistics during upgrade. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=dapdfb8v0tgfxk-dlowfsaezwrwjhyxij7bg3kbjc...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/71b66171d045878cb9267a268a3bf8ce4f11f333 Modified Files -- src/backend/catalog/index.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-)
pgsql: Add unicode_strtitle() for Unicode Default Case Conversion.
Add unicode_strtitle() for Unicode Default Case Conversion. This brings the titlecasing implementation for the builtin provider out of formatting.c and into unicode_case.c, along with unicode_strlower() and unicode_strupper(). Accepts an arbitrary word boundary callback. Simple for now, but can be extended to support the Unicode Default Case Conversion algorithm with full case mapping. Discussion: https://postgr.es/m/3bc653b5d562ae9e2838b11cb696816c328a489a.ca...@j-davis.com Reviewed-by: Peter Eisentraut Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/46e5441fa536b89c1123f270fdfeeb72c320b901 Modified Files -- src/backend/utils/adt/formatting.c | 107 +++-- src/common/unicode_case.c | 76 +++--- src/include/common/unicode_case.h | 5 ++ 3 files changed, 140 insertions(+), 48 deletions(-)
pgsql: Use version for builtin collations.
Use version for builtin collations. Given that the version field already exists, there's little reason not to use it. Suggestion from Peter Eisentraut. Discussion: https://postgr.es/m/613c120a-5413-4fa7-a501-6590eae55...@eisentraut.org Reviewed-by: Peter Eisentraut Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/46a44dc372033da9bd8b9840711e560c9d73e768 Modified Files -- src/backend/utils/adt/pg_locale.c| 14 -- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_collation.dat | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-)
pgsql: Run perltidy on generate-unicode_version.pl.
Run perltidy on generate-unicode_version.pl. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b0be28761ec5958bb7bbf9a03d94ee6e1bc59849 Modified Files -- src/common/unicode/generate-unicode_version.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
pgsql: Clarify comment for LogicalTapeSetBlocks().
Clarify comment for LogicalTapeSetBlocks(). Discussion: https://postgr.es/m/1229327.1711160...@sss.pgh.pa.us Backpatch-through: 13 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/abcea19abf3bd9dfbb4d4b9571ee7a522eb52893 Modified Files -- src/backend/utils/sort/logtape.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)
pgsql: Clarify comment for LogicalTapeSetBlocks().
Clarify comment for LogicalTapeSetBlocks(). Discussion: https://postgr.es/m/1229327.1711160...@sss.pgh.pa.us Backpatch-through: 13 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/24d1b9989134e96f643ba31cd0e379fce5062534 Modified Files -- src/backend/utils/sort/logtape.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)
pgsql: Clarify comment for LogicalTapeSetBlocks().
Clarify comment for LogicalTapeSetBlocks(). Discussion: https://postgr.es/m/1229327.1711160...@sss.pgh.pa.us Backpatch-through: 13 Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b74e4a08b9835e18a14fd3f23e19ddd460ed5b88 Modified Files -- src/backend/utils/sort/logtape.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)
pgsql: Clarify comment for LogicalTapeSetBlocks().
Clarify comment for LogicalTapeSetBlocks(). Discussion: https://postgr.es/m/1229327.1711160...@sss.pgh.pa.us Backpatch-through: 13 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/022068ea2c60fd0b1ec9b9be5d1cc680b640335c Modified Files -- src/backend/utils/sort/logtape.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)
pgsql: Clarify comment for LogicalTapeSetBlocks().
Clarify comment for LogicalTapeSetBlocks(). Discussion: https://postgr.es/m/1229327.1711160...@sss.pgh.pa.us Backpatch-through: 13 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bc5fcaa289a92941a1c7b191c7c9311bd742e172 Modified Files -- src/backend/utils/sort/logtape.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)
pgsql: Fix convert_case(), introduced in 5c40364dd6.
Fix convert_case(), introduced in 5c40364dd6. Check source length before checking for NUL terminator to avoid reading one byte past the string end. Also fix unreachable bug when caller does not expect NUL-terminated result. Add unit test coverage of convert_case() in case_test.c, which makes it easier to reproduce the valgrind failure. Discussion: https://postgr.es/m/7a9fd36d-7a38-4dc2-e676-fc939491a...@gmail.com Reported-by: Alexander Lakhin Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/503c0ad976f5e4ada2d1b47ae05aa7133351b645 Modified Files -- src/common/unicode/case_test.c | 101 +++-- src/common/unicode_case.c | 6 +-- 2 files changed, 101 insertions(+), 6 deletions(-)
pgsql: Remove incorrect Assert introduced in c8aeaf3ab.
Remove incorrect Assert introduced in c8aeaf3ab. Already removed incidentally in version 15 (c4649cce3), so this commit is only applied to versions 13 and 14. The comment above is misleading in all versions 13 and later, so that will be fixed in a separate commit. Discussion: https://postgr.es/m/cfd84cb8-12fe-433a-a4bb-f460a4515f9c.zhaotinghai.zth%40alibaba-inc.com Reported-by: Tinghai Zhao Backpatch-through: 13 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/bf038eb219bb6c7dc8a8de58de3513c035a5efba Modified Files -- src/backend/utils/sort/logtape.c | 7 --- 1 file changed, 7 deletions(-)
pgsql: Remove incorrect Assert introduced in c8aeaf3ab.
Remove incorrect Assert introduced in c8aeaf3ab. Already removed incidentally in version 15 (c4649cce3), so this commit is only applied to versions 13 and 14. The comment above is misleading in all versions 13 and later, so that will be fixed in a separate commit. Discussion: https://postgr.es/m/cfd84cb8-12fe-433a-a4bb-f460a4515f9c.zhaotinghai.zth%40alibaba-inc.com Reported-by: Tinghai Zhao Backpatch-through: 13 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a1a51dc4fab7efdcf3c3a50d9dd9f0a4a420f4f7 Modified Files -- src/backend/utils/sort/logtape.c | 8 1 file changed, 8 deletions(-)
pgsql: Inline basic UTF-8 functions.
Inline basic UTF-8 functions. Shows a measurable speedup when processing UTF-8 data, such as with the new builtin collation provider. Discussion: https://postgr.es/m/163f4e2190cdf67f67016044e503c5004547e5a9.ca...@j-davis.com Reviewed-by: Peter Eisentraut Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/9acae56ce0b0812f3e940cf1f87e73e8d5784e78 Modified Files -- src/common/wchar.c| 61 --- src/include/mb/pg_wchar.h | 61 +++ 2 files changed, 61 insertions(+), 61 deletions(-)
pgsql: Support C.UTF-8 locale in the new builtin collation provider.
Support C.UTF-8 locale in the new builtin collation provider. The builtin C.UTF-8 locale has similar semantics to the libc locale of the same name. That is, code point sort order (fast, memcmp-based) combined with Unicode semantics for character operations such as pattern matching, regular expressions, and LOWER()/INITCAP()/UPPER(). The character semantics are based on Unicode simple case mappings. The builtin provider's C.UTF-8 offers several important advantages over libc: * faster sorting -- benefits from additional optimizations such as abbreviated keys and varstrfastcmp_c * faster case conversion, e.g. LOWER(), at least compared with some libc implementations * available on all platforms with identical semantics, and the semantics are stable, testable, and documentable within a given Postgres major version Being based on memcmp, the builtin C.UTF-8 locale does not offer natural language sort order. But it is an improvement for most use cases that might otherwise use libc's "C.UTF-8" locale, as well as many use cases that use libc's "C" locale. Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com Reviewed-by: Daniel Vérité, Peter Eisentraut, Jeremy Schneider Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f69319f2f1fb16eda4b535bcccec90dff3a6795e Modified Files -- doc/src/sgml/charset.sgml| 27 +- doc/src/sgml/ref/create_collation.sgml | 2 +- doc/src/sgml/ref/create_database.sgml| 13 ++- doc/src/sgml/ref/initdb.sgml | 5 +- src/backend/regex/regc_pg_locale.c | 36 ++- src/backend/utils/adt/formatting.c | 112 ++ src/backend/utils/adt/pg_locale.c| 52 +++--- src/bin/initdb/initdb.c | 16 +++- src/bin/initdb/t/001_initdb.pl | 17 src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 +- src/bin/scripts/t/020_createdb.pl| 18 src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_collation.dat | 3 + src/test/regress/expected/collate.utf8.out | 136 +++ src/test/regress/expected/collate.utf8_1.out | 8 ++ src/test/regress/parallel_schedule | 4 +- src/test/regress/sql/collate.utf8.sql| 67 + 17 files changed, 494 insertions(+), 26 deletions(-)
pgsql: Fix documentation oversights from 2d819a08a1.
Fix documentation oversights from 2d819a08a1. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bb5604ba9e53e3a0fb9967f960e36cff4d36b0ab Modified Files -- doc/src/sgml/ref/create_database.sgml | 3 ++- doc/src/sgml/ref/createdb.sgml| 10 ++ 2 files changed, 12 insertions(+), 1 deletion(-)
pgsql: Update src/common/unicode/README.
Update src/common/unicode/README. Change the test description to include the case mapping test. Oversight in 5c40364dd6. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f9f3fb1cb71a6cf28283a8cc3185599ec0ce94d3 Modified Files -- src/common/unicode/README | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-)
pgsql: Fix another warning, introduced by 846311051e.
Fix another warning, introduced by 846311051e. Discussion: https://postgr.es/m/3703896.1710799...@sss.pgh.pa.us Reported-by: Tom Lane Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/60769c62dc85680ee357aec92461fe97c715aebb Modified Files -- src/backend/utils/adt/pg_locale.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
pgsql: Address more review comments on commit 2d819a08a1.
Address more review comments on commit 2d819a08a1. Based on comments from Peter Eisentraut. * Document CREATE DATABASE ... BUILTIN_LOCALE. * Determine required encoding based on locale name for CREATE COLLATION. Use -1 for "C" (requires catversion bump). * initdb output fixups. * Make ctype_is_c a constant true for now. * Fixups to ICU 010_create_database.pl test. Discussion: https://postgr.es/m/4135cf11-206d-40ed-96c0-9363c1232...@eisentraut.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/846311051e8fdca4c9db83b2b09425759a8b102d Modified Files -- doc/src/sgml/ref/create_database.sgml | 18 ++ src/backend/commands/collationcmds.c | 2 +- src/backend/utils/adt/pg_locale.c | 28 +--- src/bin/initdb/initdb.c | 7 --- src/bin/initdb/t/001_initdb.pl| 2 +- src/include/catalog/catversion.h | 2 +- src/include/utils/pg_locale.h | 1 + src/test/icu/t/010_database.pl| 12 +++- 8 files changed, 58 insertions(+), 14 deletions(-)
pgsql: Fix unreachable code warning from commit 2d819a08a1.
Fix unreachable code warning from commit 2d819a08a1. Found by Coverity. Discussion: https://postgr.es/m/3422201.1710711...@sss.pgh.pa.us Reported-by: Tom Lane Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/61f352ece9e7eb89c7154da178d0c3bc69fc72c9 Modified Files -- src/backend/utils/adt/pg_locale.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-)
pgsql: Introduce "builtin" collation provider.
Introduce "builtin" collation provider. New provider for collations, like "libc" or "icu", but without any external dependency. Initially, the only locale supported by the builtin provider is "C", which is identical to the libc provider's "C" locale. The libc provider's "C" locale has always been treated as a special case that uses an internal implementation, without using libc at all -- so the new builtin provider uses the same implementation. The builtin provider's locale is independent of the server environment variables LC_COLLATE and LC_CTYPE. Using the builtin provider, the database collation locale can be "C" while LC_COLLATE and LC_CTYPE are set to "en_US", which is impossible with the libc provider. By offering a new builtin provider, it clarifies that the semantics of a collation using this provider will never depend on libc, and makes it easier to document the behavior. Discussion: https://postgr.es/m/ab925f69-5f9d-f85e-b87c-bd2a44798...@joeconway.com Discussion: https://postgr.es/m/dd9261f4-7a98-4565-93ec-336c1c110...@manitou-mail.org Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com Reviewed-by: Daniel Vérité, Peter Eisentraut, Jeremy Schneider Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2d819a08a1cbc11364e36f816b02e33e8dcc030b Modified Files -- doc/src/sgml/charset.sgml | 90 ++- doc/src/sgml/ref/create_collation.sgml | 11 ++- doc/src/sgml/ref/create_database.sgml | 7 +- doc/src/sgml/ref/createdb.sgml | 2 +- doc/src/sgml/ref/initdb.sgml | 17 - src/backend/catalog/pg_collation.c | 5 +- src/backend/commands/collationcmds.c | 74 +++ src/backend/commands/dbcommands.c | 129 + src/backend/utils/adt/formatting.c | 6 ++ src/backend/utils/adt/pg_locale.c | 123 ++- src/backend/utils/init/postinit.c | 20 - src/bin/initdb/initdb.c| 53 ++ src/bin/initdb/t/001_initdb.pl | 40 +- src/bin/pg_dump/pg_dump.c | 23 +- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 81 - src/bin/psql/describe.c| 4 +- src/bin/scripts/createdb.c | 19 - src/bin/scripts/t/020_createdb.pl | 60 +++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_collation.dat | 6 +- src/include/catalog/pg_collation.h | 3 + src/include/utils/pg_locale.h | 5 ++ src/test/icu/t/010_database.pl | 22 +++--- src/test/regress/expected/collate.out | 19 - src/test/regress/sql/collate.sql | 8 ++ 25 files changed, 671 insertions(+), 158 deletions(-)
pgsql: Fix version check in 002_pg_upgrade.pl.
Fix version check in 002_pg_upgrade.pl. Commit f696c0cd5f tried to account for the version in a way that includes development versions, but it was broken. Fix with suggestion from Tom Lane. Discussion: https://postgr.es/m/1553991.1710191...@sss.pgh.pa.us Reported-by: Tom Lane Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/32dd2c1eff540e454d50a1d59d2d90ab6e70e0b6 Modified Files -- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-)
Re: pgsql: Catalog changes preparing for builtin collation provider.
On Mon, 2024-03-11 at 18:04 -0400, Tom Lane wrote: > Another question is why it didn't fail on all the animals with > similar > Perl vintage. My guess about that is that there's some configuration > difference causing the Perl script to take slightly different code > paths, but it's just a guess. Sounds plausible. > > Yeah. I was dismayed to find that there's no perlcritic check for > this, because it sure seems like the kind of thing you don't want > to invoke by accident. Additionally, the delimiters can many characters, which makes simple grepping harder. I found a few cases -- attached a patch. Something is better than nothing. I'm not sure that I got the /.*/ cases right, but they don't seem to be expecting any output, so /.*/ seemed like the right pattern. Regards, Jeff Davis From be5aa677e37180a8c1b0faebcceab5506b1c8130 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Mon, 11 Mar 2024 16:44:56 -0700 Subject: [PATCH v1] perl: avoid empty regex patterns Empty patterns have special behavior that uses the last successful pattern match. This behavior can be surprising, so remove empty patterns and instead match against exactly what is intended (e.g. /^$/ or /.*/). Unfortunately there's not an easy way to check for this in an automated way, so it's likely that some cases have been missed and will be missed in the future. This commit just cleans up known instances. Discussion: https://postgr.es/m/1548559.1710188...@sss.pgh.pa.us --- src/bin/pg_upgrade/t/003_logical_slots.pl | 4 ++-- src/bin/pg_upgrade/t/004_subscription.pl| 2 +- src/bin/psql/t/001_basic.pl | 8 src/bin/psql/t/010_tab_completion.pl| 2 +- src/test/recovery/t/037_invalid_database.pl | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl index 83d71c3084..256dfd53b1 100644 --- a/src/bin/pg_upgrade/t/003_logical_slots.pl +++ b/src/bin/pg_upgrade/t/003_logical_slots.pl @@ -78,7 +78,7 @@ command_checks_all( [ qr/max_replication_slots \(1\) must be greater than or equal to the number of logical replication slots \(2\) on the old cluster/ ], - [qr//], + [qr/^$/], 'run of pg_upgrade where the new cluster has insufficient max_replication_slots' ); ok( -d $newpub->data_dir . "/pg_upgrade_output.d", @@ -118,7 +118,7 @@ command_checks_all( [ qr/Your installation contains logical replication slots that can't be upgraded./ ], - [qr//], + [qr/^$/], 'run of pg_upgrade of old cluster with slots having unconsumed WAL records' ); diff --git a/src/bin/pg_upgrade/t/004_subscription.pl b/src/bin/pg_upgrade/t/004_subscription.pl index df5d6dffbc..c8ee2390d1 100644 --- a/src/bin/pg_upgrade/t/004_subscription.pl +++ b/src/bin/pg_upgrade/t/004_subscription.pl @@ -68,7 +68,7 @@ command_checks_all( [ qr/max_replication_slots \(0\) must be greater than or equal to the number of subscriptions \(1\) on the old cluster/ ], - [qr//], + [qr/^$/], 'run of pg_upgrade where the new cluster has insufficient max_replication_slots' ); diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl index 9f0b6cf8ca..ce875ce316 100644 --- a/src/bin/psql/t/001_basic.pl +++ b/src/bin/psql/t/001_basic.pl @@ -412,23 +412,23 @@ my $perlbin = $^X; $perlbin =~ s!\\!/!g if $PostgreSQL::Test::Utils::windows_os; my $pipe_cmd = "$perlbin -pe '' >$g_file"; -psql_like($node, "SELECT 'one' \\g | $pipe_cmd", qr//, "one command \\g"); +psql_like($node, "SELECT 'one' \\g | $pipe_cmd", qr/.*/, "one command \\g"); my $c1 = slurp_file($g_file); like($c1, qr/one/); -psql_like($node, "SELECT 'two' \\; SELECT 'three' \\g | $pipe_cmd", qr//, "two commands \\g"); +psql_like($node, "SELECT 'two' \\; SELECT 'three' \\g | $pipe_cmd", qr/.*/, "two commands \\g"); my $c2 = slurp_file($g_file); like($c2, qr/two.*three/s); -psql_like($node, "\\set SHOW_ALL_RESULTS 0\nSELECT 'four' \\; SELECT 'five' \\g | $pipe_cmd", qr//, +psql_like($node, "\\set SHOW_ALL_RESULTS 0\nSELECT 'four' \\; SELECT 'five' \\g | $pipe_cmd", qr/.*/, "two commands \\g with only last result"); my $c3 = slurp_file($g_file); like($c3, qr/five/); unlike($c3, qr/four/); psql_like($node, "copy (values ('foo'),('bar')) to stdout \\g | $pipe_cmd", - qr//, + qr/.*/, "copy output passed to \\g pipe"); my $c4 = slurp_file($g_file); like($c4, qr/foo.*bar/s); diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index b6575b075e..d3a95ac066 100644 --- a/src/bin/psql/t/010_ta
Re: pgsql: Catalog changes preparing for builtin collation provider.
On Mon, 2024-03-11 at 17:08 -0400, Tom Lane wrote: > Jeff Davis writes: > > was perfectly correct as it stood, because pg_version is a > PostgreSQL::Version object. Why did you feel a need to > editorialize on that? The goal was to do a version check for 17 that's inclusive of development versions. Patch attached, following the example in AdjustUpgrade.pm. It feels a bit inconsistent to sometimes use $oldnode->pg_version and sometimes use $old_major_version, but it's certainly better than what I had done in f696c0cd5f. Regards, Jeff Davis From ad3ba667553d8c2862b74939676244340631d192 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Mon, 11 Mar 2024 15:32:41 -0700 Subject: [PATCH v1] Another fix to 002_pg_upgrade.pl. Properly use PostgreSQL::Version, rather than the hacks introduced by f696c0cd5f. Discussion: https://postgr.es/m/1553991.1710191...@sss.pgh.pa.us Reported-by: Tom Lane --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 5ef78691cb..18335070c8 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -92,9 +92,9 @@ my $oldnode = PostgreSQL::Test::Cluster->new('old_node', install_path => $ENV{oldinstall}); -# Numeric major version of old cluster, ignoring "devel" suffix. -# Needed for testing upgrades from development version to itself. -my $old_major_version = int($oldnode->pg_version =~ s/devel//rg); +# Needed in some cases for testing upgrades from a development or beta +# version to itself. +my $old_major_version = PostgreSQL::Version->new($oldnode->pg_version->major); my %node_params = (); @@ -118,7 +118,7 @@ my $original_locale = "C"; my $original_datlocale = ""; my $provider_field = "'c' AS datlocprovider"; my $old_datlocale_field = "NULL AS datlocale"; -if ($old_major_version >= 15 && $ENV{with_icu} eq 'yes') +if ($oldnode->pg_version >= 15 && $ENV{with_icu} eq 'yes') { $provider_field = "datlocprovider"; if ($old_major_version >= 17) -- 2.34.1
Re: pgsql: Catalog changes preparing for builtin collation provider.
On Mon, 2024-03-11 at 16:21 -0400, Tom Lane wrote: > Oh! No, it's a "feature": man perlop quoth Wow. > So we actually need to find and nuke all of these, not just the one > that's causing trouble. For now I committed the one change to fix the buildfarm. I am still confused on a couple of points here, such as: why does my example work fine on newer versions of perl? But I agree: if the empty pattern is magical, we should get rid of it, even if we don't understand the exact conditions under which it behaves magically. Reagrds, Jeff Davis
pgsql: Fix 002_pg_upgrade.pl.
Fix 002_pg_upgrade.pl. Commit f696c0cd5f caused a test failure in 002_pg_upgrade.pl, because an earlier s/// operator caused qr// to no longer match the empty string. Use qr/^$/ instead, which is a better test anyway, because we expect the stderr to be empty. Initially this appeared to be a perl bug, but per discussion, it seems that it was a misunderstanding of how perl works: an empty pattern uses the last successful pattern. Given how surprising that behavior is to perl non-experts, we will need to look for similar problems elsewhere and eliminate the use of empty patterns throughout the code. For now, address this one instance to fix the buildfarm. Discussion: https://postgr.es/m/0ef325fa06e7a1605c4e119c4ecb637c67e5fb4e.ca...@j-davis.com Reviewed-by: Tom Lane Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/bbbf71d9a68103e00f73dae02fa6de6d60c3b86a Modified Files -- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: pgsql: Catalog changes preparing for builtin collation provider.
On Sun, 2024-03-10 at 00:05 -0500, Tom Lane wrote: > Yeah. It looks to me like it's somehow Perl-version-related. I found it. On perl 5.16.3 on a failing instance: use strict; die '"" does not match qr// before substitution' unless '' =~ qr//; my $foo = ('|a|' =~ s/a//r); die '"" does not match qr// after substitution' unless '' =~ qr//; print "$foo\n"; dies with: "" does not match qr// after substitution at - line 4. My commit adds a line using the s/// operator. That's so bizarre that I have to guess that it's a perl bug. I poked around in the perl docs to see if I'm missing something, but I didn't find anything indicating that a substitution would have crazy side effects. Please correct me if I'm wrong; I'm far from a perl expert. Assuming that it is a perl bug, there are two potential workarounds: 1. Use qr/^$/ for the test rather than qr//. 2. Don't use s/// anywhere. Find another way to transform devel versions into numbers. Either one has the potential to leave traps for later. New tests might either rely on s/// or expect qr// to work. I am inclined toward #1, because if we use qr/^$/, other tests are likely to copy it and they will be safe as well. Though I'm still not sure what's going on with longfin. Thoughts? Regards, Jeff Davis
Re: pgsql: Catalog changes preparing for builtin collation provider.
On Sat, 2024-03-09 at 22:50 +, Jeff Davis wrote: > Catalog changes preparing for builtin collation provider. This is causing problems on a couple buildfarm members (mantid, lapwing, snakefly) that all look like this: # Running: pg_upgrade --no-sync -d /home/postgres/buildroot/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/ t_002_pg_upgrade_old_node_data/pgdata -D /home/postgres/buildroot/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/ t_002_pg_upgrade_new_node_data/pgdata -b /home/postgres/buildroot/HEAD/pgsql.build/tmp_install/home/postgres/bui ldroot/HEAD/inst/bin -B /home/postgres/buildroot/HEAD/pgsql.build/tmp_install/home/postgres/bui ldroot/HEAD/inst/bin -s /tmp/3b07YyaACZ -p 52828 -P 52829 --copy -- check [01:08:08.992](1.053s) ok 9 - invalid database causes failure status (got 1 vs expected 1) [01:08:08.992](0.001s) ok 10 - invalid database causes failure stdout /(?^:invalid)/ [01:08:08.993](0.001s) not ok 11 - invalid database causes failure stderr /(?^:)/ [01:08:08.993](0.000s) [01:08:08.993](0.000s) # Failed test 'invalid database causes failure stderr /(?^:)/' [01:08:08.993](0.000s) # at t/002_pg_upgrade.pl line 370. [01:08:08.994](0.000s) # '' # doesn't match '(?^:)' That's a little confusing to me: the '(?^:)' is just qr//, which should match anything, right? It's expecting stderr to be empty, and the test failure seems to indicate it is empty, so again I don't really see the problem. Am I missing something obvious here? Quite a few other members are passing and I didn't find an obvious pattern yet. Regards, Jeff Davis
pgsql: Catalog changes preparing for builtin collation provider.
Catalog changes preparing for builtin collation provider. Rename pg_collation.colliculocale to colllocale, and pg_database.daticulocale to datlocale. These names reflects that the fields will be useful for the upcoming builtin provider as well, not just for ICU. This is purely a rename; no changes to the meaning of the fields. Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com Reviewed-by: Peter Eisentraut Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f696c0cd5f299f1b51e214efc55a22a782cc175d Modified Files -- doc/src/sgml/bki.sgml | 2 +- doc/src/sgml/catalogs.sgml | 26 +++--- src/backend/catalog/pg_collation.c | 10 ++-- src/backend/commands/collationcmds.c | 34 ++--- src/backend/commands/dbcommands.c | 68 +- src/backend/utils/adt/pg_locale.c | 4 +- src/backend/utils/init/postinit.c | 12 ++--- src/bin/initdb/initdb.c| 34 ++--- src/bin/pg_dump/pg_dump.c | 56 +++-- src/bin/pg_upgrade/info.c | 31 +++- src/bin/pg_upgrade/pg_upgrade.c| 34 + src/bin/pg_upgrade/pg_upgrade.h| 2 +- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 29 +++ src/bin/psql/describe.c| 20 +--- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_collation.dat | 2 +- src/include/catalog/pg_collation.h | 4 +- src/include/catalog/pg_database.dat| 2 +- src/include/catalog/pg_database.h | 2 +- src/test/regress/expected/collate.icu.utf8.out | 4 +- src/test/regress/expected/psql.out | 18 +++ src/test/regress/sql/collate.icu.utf8.sql | 4 +- 22 files changed, 231 insertions(+), 169 deletions(-)
Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack.
On Sat, 2024-03-09 at 12:49 -0500, Tom Lane wrote: > I guess you are running that in some way that the rest of us aren't. FWIW, I am following the directions in src/bin/pg_upgrade/TESTING. > > However, we'd inevitably hit the more-than-one-DB-to-drop problem > eventually, so better to fix that now. Please push your fix and > then I'll clean up the unnecessary DROPs. Thank you for looking. Pushed, and separately ran perltidy. Regards, Jeff Davis
pgsql: Run perltidy on 002_pg_upgrade.pl.
Run perltidy on 002_pg_upgrade.pl. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b0289574bdf1202248201a3143d1459bdf5727fd Modified Files -- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 1 file changed, 4 insertions(+), 4 deletions(-)
pgsql: Fix cross-version pg_upgrade test.
Fix cross-version pg_upgrade test. Pass each statement as a separate '-c' arg, so they don't get combined into a single transaction. Discussion: https://postgr.es/m/bca97aecb50b2026b7dbc26604bf31861c819a64.ca...@j-davis.com Reviewed-by: Tom Lane Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5ba8b70debb119813f241069bf359c00e4a784f0 Modified Files -- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Re: pgsql: Further further fix pg_upgrade crossversion test for adminpack.
On Mon, 2024-03-04 at 18:10 +, Tom Lane wrote: > Further further fix pg_upgrade crossversion test for adminpack. Ever since this commit the cross-version upgrade test is failing (for me, at least) with: # Running: psql -X -v ON_ERROR_STOP=1 -c drop database if exists contrib_regression_adminpack; drop database if exists regression_adminpack -d port=53977 host=/tmp/EK6UT_TufI dbname='postgres' ERROR: DROP DATABASE cannot run inside a transaction block It looks like when you added another command, the two were joined with ";\n", which ends up running the commands in a transaction block, which doesn't work for DROP DATABASE. I'm not sure how this test is succeeding for others, so perhaps I'm doing something wrong? Patch attached, though I'm not particularly great with perl and the array flattening in my implementation might be too magical. Regards, Jeff Davis From 54e13ddb01b859606ebe938a98587aef666df668 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Fri, 8 Mar 2024 23:37:16 -0800 Subject: [PATCH] Fix cross-version pg_upgrade test. --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index d951ed3af0..16b42d475f 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -246,15 +246,19 @@ if (defined($ENV{oldinstall})) foreach my $updb (keys %$adjust_cmds) { - my $upcmds = join(";\n", @{ $adjust_cmds->{$updb} }); + my @command_args = (); + for my $upcmd (@{ $adjust_cmds->{$updb} }) + { + push @command_args, '-c', $upcmd; + } # For simplicity, use the newer version's psql to issue the commands. $newnode->command_ok( [ 'psql', '-X', '-v', 'ON_ERROR_STOP=1', -'-c', $upcmds, '-d', $oldnode->connstr($updb), +@command_args, ], "ran version adaptation commands for database $updb"); } -- 2.34.1
Re: pgsql: Unicode case mapping tables and functions.
On Fri, 2024-03-08 at 10:24 +0200, Heikki Linnakangas wrote: > On 07/03/2024 21:18, Jeff Davis wrote: > > Unicode case mapping tables and functions. > > With -Wtype-limits, I'm seeing this warning: Thank you, fixed. Somehow I lost that flag from my script. Can you please add some recommended compiler warning flags here: https://wiki.postgresql.org/wiki/Committing_checklist ? Regards, Jeff Davis
pgsql: Fix type signedness error in commit 5c40364dd6.
Fix type signedness error in commit 5c40364dd6. Use ssize_t instead of size_t. Discussion: https://postgr.es/m/b20d6d97-7338-48ea-ba33-837a1c8ef...@iki.fi Reported-by: Heikki Linnakangas Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/33ee2550d30bebb938238846369b2aae10e7f00f Modified Files -- src/common/unicode_case.c | 10 +- src/include/common/unicode_case.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)
pgsql: Unicode case mapping tables and functions.
Unicode case mapping tables and functions. Implements Unicode simple case mapping, in which all code points map to exactly one other code point unconditionally. These tables are generated from UnicodeData.txt, which is already being used by other infrastructure in src/common/unicode. The tables are checked into the source tree, so they only need to be regenerated when we update the Unicode version. In preparation for the builtin collation provider, and possibly useful for other callers. Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com Reviewed-by: Peter Eisentraut, Daniel Verite, Jeremy Schneider Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5c40364dd6d9c6a260c8965dffe2e066642d6f79 Modified Files -- src/common/Makefile |1 + src/common/meson.build|1 + src/common/unicode/Makefile | 15 +- src/common/unicode/case_test.c| 100 + src/common/unicode/generate-unicode_case_table.pl | 134 + src/common/unicode/meson.build| 31 + src/common/unicode_case.c | 174 ++ src/common/wchar.c|4 +- src/include/common/unicode_case.h | 27 + src/include/common/unicode_case_table.h | 3001 + src/include/mb/pg_wchar.h | 15 + 11 files changed, 3498 insertions(+), 5 deletions(-)
pgsql: Add Unicode property tables.
Add Unicode property tables. Provide functions to test for Unicode properties, such as Alphabetic or Cased. These functions use tables derived from Unicode data files, similar to the tables for Unicode normalization or general category, and those tables can be updated with the 'update-unicode' build target. Use Unicode properties to provide functions to test for regex character classes, like 'punct' or 'alnum'. Infrastructure in preparation for a builtin collation provider, and may also be useful for other callers. Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com Reviewed-by: Daniel Verite, Peter Eisentraut, Jeremy Schneider Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ad49994538c57270c244fab4e1de040568066313 Modified Files -- src/common/unicode/Makefile|6 +- src/common/unicode/README | 45 +- src/common/unicode/category_test.c | 222 +- .../unicode/generate-unicode_category_table.pl | 390 ++- src/common/unicode/meson.build |4 +- src/common/unicode_category.c | 318 +- src/include/common/unicode_category.h | 27 +- src/include/common/unicode_category_table.h| 3694 +++- 8 files changed, 4604 insertions(+), 102 deletions(-)
pgsql: Run pgindent again on the same file.
Run pgindent again on the same file. Apparently, pgindent got confused by the double space. The first time I ran it, it moved the function name to the next line. The second time I ran it, it moved the function name back, but without the double space. Now the results appear stable. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0984a3b851abe89bec6c3eff51b03038808e1997 Modified Files -- src/backend/utils/activity/backend_status.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
pgsql: Run pgindent for commit ef4cfdce0e.
Run pgindent for commit ef4cfdce0e. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b406af1806e9fc5c090e58282c7d98f22a4b397f Modified Files -- src/backend/utils/activity/backend_status.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
pgsql: docs: Update HOT update docs for 19d8e2308b
docs: Update HOT update docs for 19d8e2308b Commit 19d8e2308b changed when the HOT update optimization is possible but neglected to update the Heap-Only Tuples (HOT) documentation. This patch updates that documentation accordingly. Author: Elizabeth Christensen Backpatch-through: 16 Reviewed-By: Stephen Frost, Alvaro Herrera Discussion: https://postgr.es/m/CABoUFXRjisr58Ct_3VsFEdQx+fJeQTWTdJnM7XAp=8mubto...@mail.gmail.com Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/8870c54d8a17da3e2f7597acf2922f0fb8eadfa5 Modified Files -- doc/src/sgml/storage.sgml | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-)
pgsql: docs: Update HOT update docs for 19d8e2308b
docs: Update HOT update docs for 19d8e2308b Commit 19d8e2308b changed when the HOT update optimization is possible but neglected to update the Heap-Only Tuples (HOT) documentation. This patch updates that documentation accordingly. Author: Elizabeth Christensen Backpatch-through: 16 Reviewed-By: Stephen Frost, Alvaro Herrera Discussion: https://postgr.es/m/CABoUFXRjisr58Ct_3VsFEdQx+fJeQTWTdJnM7XAp=8mubto...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7a9328e8e40534fb4de41b4ac152e3c6989d84e7 Modified Files -- doc/src/sgml/storage.sgml | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-)
pgsql: Update sepgsql expected output.
Update sepgsql expected output. Fix for buildfarm member rhinoceros after commit 2af07e2f74. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c7ea3f42291bf5c74be8f957c775c5e7b3f78592 Modified Files -- contrib/sepgsql/expected/ddl.out | 37 + 1 file changed, 37 insertions(+)
pgsql: Fix buildfarm failures from 2af07e2f74.
Fix buildfarm failures from 2af07e2f74. Use GUC_ACTION_SAVE rather than GUC_ACTION_SET, necessary for working with parallel query. Now that the call requires more arguments, wrap the call in a new function to avoid code duplication and offer a place for a comment. Discussion: https://postgr.es/m/e1rhjpo-0027wf...@gemulon.postgresql.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/59825d16399699e2f99016b9add46cb2d4916f82 Modified Files -- contrib/amcheck/t/004_verify_nbtree_unique.pl | 45 +++ contrib/amcheck/verify_nbtree.c | 3 +- src/backend/access/brin/brin.c| 3 +- src/backend/catalog/index.c | 13 +++- src/backend/commands/analyze.c| 3 +- src/backend/commands/cluster.c| 3 +- src/backend/commands/indexcmds.c | 10 ++ src/backend/commands/matview.c| 3 +- src/backend/commands/vacuum.c | 3 +- src/backend/utils/misc/guc.c | 19 +++ src/include/utils/guc.h | 7 + 11 files changed, 52 insertions(+), 60 deletions(-)
Re: pgsql: Fix search_path to a safe value during maintenance operations.
On Mon, 2024-03-04 at 21:15 -0500, Tom Lane wrote: > Jeff Davis writes: > > Fix search_path to a safe value during maintenance operations. > > The buildfarm seems pretty unhappy with this. Looks like I need to use GUC_ACTION_SAVE. I will remedy it shortly. Regards, Jeff Davis
pgsql: Fix search_path to a safe value during maintenance operations.
Fix search_path to a safe value during maintenance operations. While executing maintenance operations (ANALYZE, CLUSTER, REFRESH MATERIALIZED VIEW, REINDEX, or VACUUM), set search_path to 'pg_catalog, pg_temp' to prevent inconsistent behavior. Functions that are used for functional indexes, in index expressions, or in materialized views and depend on a different search path must be declared with CREATE FUNCTION ... SET search_path='...'. This change was previously committed as 05e1737351, then reverted in commit 2fcc7ee7af because it was too late in the cycle. Preparation for the MAINTAIN privilege, which was previously reverted due to search_path manipulation hazards. Discussion: https://postgr.es/m/d4ccaf3658cb3c281ec88c851a09733cd9482f22.ca...@j-davis.com Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org Discussion: https://postgr.es/m/e44327179e5c9015c8dda67351c04da552066017.camel%40j-davis.com Reviewed-by: Greg Stark, Nathan Bossart, Noah Misch Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2af07e2f749a9208ca1ed84fa1d8fe0e75833288 Modified Files -- contrib/amcheck/t/004_verify_nbtree_unique.pl | 33 +--- contrib/amcheck/verify_nbtree.c| 2 + doc/src/sgml/amcheck.sgml | 3 ++ doc/src/sgml/brin.sgml | 4 +- doc/src/sgml/ref/analyze.sgml | 6 +++ doc/src/sgml/ref/cluster.sgml | 6 +++ doc/src/sgml/ref/create_index.sgml | 6 +++ doc/src/sgml/ref/refresh_materialized_view.sgml| 6 +++ doc/src/sgml/ref/reindex.sgml | 6 +++ doc/src/sgml/ref/vacuum.sgml | 6 +++ src/backend/access/brin/brin.c | 2 + src/backend/catalog/index.c| 9 + src/backend/catalog/namespace.c| 3 ++ src/backend/commands/analyze.c | 2 + src/backend/commands/cluster.c | 2 + src/backend/commands/indexcmds.c | 8 src/backend/commands/matview.c | 2 + src/backend/commands/vacuum.c | 2 + src/bin/scripts/t/100_vacuumdb.pl | 4 -- src/include/utils/guc.h| 6 +++ .../test_oat_hooks/expected/alter_table.out| 2 + .../test_oat_hooks/expected/test_oat_hooks.out | 4 ++ src/test/regress/expected/matview.out | 4 +- src/test/regress/expected/namespace.out| 44 ++ src/test/regress/expected/privileges.out | 12 +++--- src/test/regress/expected/vacuum.out | 2 +- src/test/regress/sql/matview.sql | 4 +- src/test/regress/sql/namespace.sql | 32 src/test/regress/sql/privileges.sql| 8 ++-- src/test/regress/sql/vacuum.sql| 2 +- 30 files changed, 200 insertions(+), 32 deletions(-)
pgsql: Documentation update for Standard Collations.
Documentation update for Standard Collations. Correct out-of-date text that said the "default" collation is always based on LC_COLLATE and LC_CTYPE. Also reformat into a list to make it easier to understand and compare the available collations, and briefly document the stability characteristics of each one. Discussion: https://postgr.es/m/4a69d067374d2f6bfb66f5bfb2ab9a020493d49f.ca...@j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/875e46a0a246e416b12a9debe084ede9d02f1b5d Modified Files -- doc/src/sgml/charset.sgml | 72 +-- 1 file changed, 45 insertions(+), 27 deletions(-)
pgsql: Pass correct count to WALRead().
Pass correct count to WALRead(). Previously, some callers requested XLOG_BLCKSZ bytes unconditionally. While this did not cause a problem, because the extra bytes are ignored, it's confusing and makes it harder to add safety checks. Additionally, the comment about zero padding was incorrect. With this commit, all callers request the number of bytes they actually need. Author: Bharath Rupireddy Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/CALj2ACWBRFac2TingD3PE3w2EBHXUHY3=aeezpjmqhpeobg...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/73f0a1326608ac3a7d390706fdeec59fe4dc42c0 Modified Files -- src/backend/access/transam/xlogutils.c | 7 +-- src/backend/postmaster/walsummarizer.c | 7 +-- src/backend/replication/walsender.c| 2 +- 3 files changed, 3 insertions(+), 13 deletions(-)
pgsql: Add assert to WALReadFromBuffers().
Add assert to WALReadFromBuffers(). Per suggestion from Andres. Discussion: https://postgr.es/m/20240214025508.6mcblauossthv...@awork3.anarazel.de Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/9ecbf54075a91ed155cc779fcc1870de0fff5fef Modified Files -- src/backend/access/transam/xlog.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-)
pgsql: Read WAL directly from WAL buffers.
Read WAL directly from WAL buffers. If available, read directly from WAL buffers, avoiding the need to go through the filesystem. Only for physical replication for now, but can be expanded to other callers. In preparation for replicating unflushed WAL data. Author: Bharath Rupireddy Discussion: https://postgr.es/m/CALj2ACXKKK%3DwbiG5_t6dGao5GoecMwRkhr7GjVBM_jg54%2BNa%3DQ%40mail.gmail.com Reviewed-by: Andres Freund, Alvaro Herrera, Nathan Bossart, Dilip Kumar, Nitin Jadhav, Melih Mutlu, Kyotaro Horiguchi Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/91f2cae7a4e664e9c0472b364c7db29d755ab151 Modified Files -- src/backend/access/transam/xlog.c | 120 src/backend/access/transam/xlogreader.c | 3 - src/backend/replication/walsender.c | 12 +++- src/include/access/xlog.h | 3 + 4 files changed, 134 insertions(+), 4 deletions(-)
pgsql: Fix buildfarm error from commit 5c31669058.
Fix buildfarm error from commit 5c31669058. Skip test when not using unix domain sockets. Discussion: https://postgr.es/m/caldanm29-8oozsbwo9h6dn_tb_3ya1qjrjput-khan8ncdj...@mail.gmail.com Backpatch-through: 16 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/5b5318c387451e3eb89eddb4574e57a61297102f Modified Files -- src/test/subscription/t/027_nosuperuser.pl | 151 - 1 file changed, 81 insertions(+), 70 deletions(-)
pgsql: Fix buildfarm error from commit 5c31669058.
Fix buildfarm error from commit 5c31669058. Skip test when not using unix domain sockets. Discussion: https://postgr.es/m/caldanm29-8oozsbwo9h6dn_tb_3ya1qjrjput-khan8ncdj...@mail.gmail.com Backpatch-through: 16 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/dd3ca8cbb0141f158545e9ecdd12c89279942e36 Modified Files -- src/test/subscription/t/027_nosuperuser.pl | 151 - 1 file changed, 81 insertions(+), 70 deletions(-)
Re: pgsql: Re-validate connection string in libpqrcv_connect().
On Fri, 2024-01-12 at 21:43 +, Jeff Davis wrote: > Re-validate connection string in libpqrcv_connect(). Looks like the test is causing problems on drogo: ERROR: could not connect to the publisher: connection to server at "127.0.0.1", port 54707 failed: FATAL: SSPI authentication failed for user "regress_test_user"' https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=drongo&dt=2024-01-13%2002%3A41%3A35 I think we need to change the pg_hba.conf on the publisher before creating (or at least before enabling) the subscription. I might have to commit a trial fix unless someone can debug this more easily on drogo's configuration. I suppose I could also take out the test, but I like that it adds better coverage of the password_required setting. Regards, Jeff Davis
pgsql: Fix memory leak in connection string validation.
Fix memory leak in connection string validation. Introduced in commit c3afe8cf5a. Discussion: https://postgr.es/m/066a65233d3cb4ea27a9e0778d2f1d0dc764b222.ca...@j-davis.com Reviewed-by: Nathan Bossart, Tom Lane Backpatch-through: 16 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/41820e640af14ab9d2a8d29692fc8b2b79655ecb Modified Files -- src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 5 + 1 file changed, 5 insertions(+)
pgsql: Fix memory leak in connection string validation.
Fix memory leak in connection string validation. Introduced in commit c3afe8cf5a. Discussion: https://postgr.es/m/066a65233d3cb4ea27a9e0778d2f1d0dc764b222.ca...@j-davis.com Reviewed-by: Nathan Bossart, Tom Lane Backpatch-through: 16 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/45da69371ebfc4d6982695e58791989660c1cc33 Modified Files -- src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 5 + 1 file changed, 5 insertions(+)
pgsql: Re-validate connection string in libpqrcv_connect().
Re-validate connection string in libpqrcv_connect(). A superuser may create a subscription with password_required=true, but which uses a connection string without a password. Previously, if the owner of such a subscription was changed to a non-superuser, the non-superuser was able to utilize a password from another source (like a password file or the PGPASSWORD environment variable), which should not have been allowed. This commit adds a step to re-validate the connection string before connecting. Reported-by: Jeff Davis Author: Vignesh C Reviewed-by: Peter Smith, Robert Haas, Amit Kapila Discussion: https://www.postgresql.org/message-id/flat/e5892973ae2a80a1a3e0266806640dae3c428100.camel%40j-davis.com Backpatch-through: 16 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/4c03ac7e2bc46988fe4ecf3b1aef393488786f12 Modified Files -- doc/src/sgml/ref/create_subscription.sgml | 11 +-- .../libpqwalreceiver/libpqwalreceiver.c| 9 +++ src/test/subscription/t/027_nosuperuser.pl | 80 ++ 3 files changed, 95 insertions(+), 5 deletions(-)
pgsql: Re-validate connection string in libpqrcv_connect().
Re-validate connection string in libpqrcv_connect(). A superuser may create a subscription with password_required=true, but which uses a connection string without a password. Previously, if the owner of such a subscription was changed to a non-superuser, the non-superuser was able to utilize a password from another source (like a password file or the PGPASSWORD environment variable), which should not have been allowed. This commit adds a step to re-validate the connection string before connecting. Reported-by: Jeff Davis Author: Vignesh C Reviewed-by: Peter Smith, Robert Haas, Amit Kapila Discussion: https://www.postgresql.org/message-id/flat/e5892973ae2a80a1a3e0266806640dae3c428100.camel%40j-davis.com Backpatch-through: 16 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5c31669058b5550b4b3d623c07bc4203c11b8316 Modified Files -- doc/src/sgml/ref/create_subscription.sgml | 11 +-- .../libpqwalreceiver/libpqwalreceiver.c| 9 +++ src/test/subscription/t/027_nosuperuser.pl | 80 ++ 3 files changed, 95 insertions(+), 5 deletions(-)
pgsql: Cleanup for unicode-update build target and test.
Cleanup for unicode-update build target and test. In preparation for adding more Unicode tables. Discussion: https://postgr.es/m/63cd8625-68fa-4760-844a-6b7f64333...@ardentperf.com Reviewed-by: Jeremy Schneider Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/cf64d4e99f6480ad6d73af82bfbbf2b2e637a7ec Modified Files -- src/common/unicode/Makefile| 6 +++--- src/common/unicode/category_test.c | 24 ++--- src/common/unicode/meson.build | 44 +++--- 3 files changed, 37 insertions(+), 37 deletions(-)
Re: pgsql: Make all Perl warnings fatal
On Fri, 2023-12-29 at 17:46 +, Peter Eisentraut wrote: > Make all Perl warnings fatal This seems to be causing problems in the buildfarm: Use of uninitialized value $ENV{"PG_TEST_EXTRA"} in pattern match (m//) at t/001_mutated_bindpasswd.pl line 23. Regards, Jeff Davis
pgsql: Fix collate.windows.win1252 test.
Fix collate.windows.win1252 test. Do not rely on the OS recognizing a particular locale; find the right locale by querying the "en_US" collation. Author: Alexander Lakhin Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/ae73f6f5-8221-c112-4640-5cda812a6...@gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2c321ceaa904eb2722050abd35bf4eaea434c8b5 Modified Files -- src/test/regress/expected/collate.windows.win1252.out | 8 +++- src/test/regress/sql/collate.windows.win1252.sql | 9 +++-- 2 files changed, 14 insertions(+), 3 deletions(-)
pgsql: Initialize data directories with --lc-messages=C for tests.
Initialize data directories with --lc-messages=C for tests. Commit db6d9891e8 changed them to be initialized with --no-locale, but that reduced the test coverage for non-C locales. Discussion: https://postgr.es/m/0d47e5ecc037b3908149aad5f2a987793cf938bd.camel%40j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8793c60051541c8df8dbe133cb9cf8138efe3b3f Modified Files -- meson.build| 2 +- src/Makefile.global.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
pgsql: Use 64-bit atomics for xlblocks array elements.
Use 64-bit atomics for xlblocks array elements. In preparation for reading the contents of WAL buffers without a lock. Also, avoids the previously-needed comment in GetXLogBuffer() explaining why it's safe from torn reads. Author: Bharath Rupireddy Discussion: https://postgr.es/m/calj2acvffmfqd5olzzsqqzwfxijqd-ndx0_317vep6fub31...@mail.gmail.com Reviewed-by: Andres Freund Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c3a8e2a7cb16d55e3b757934b538cb8b8a0eab02 Modified Files -- src/backend/access/transam/xlog.c | 40 +++ 1 file changed, 19 insertions(+), 21 deletions(-)
pgsql: Additional write barrier in AdvanceXLInsertBuffer().
Additional write barrier in AdvanceXLInsertBuffer(). First, mark the xlblocks member with InvalidXLogRecPtr, then issue a write barrier, then initialize it. That ensures that the xlblocks member doesn't appear valid while the contents are being initialized. In preparation for reading WAL buffer contents without a lock. Author: Bharath Rupireddy Discussion: https://postgr.es/m/calj2acvffmfqd5olzzsqqzwfxijqd-ndx0_317vep6fub31...@mail.gmail.com Reviewed-by: Andres Freund Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/766571be16598b401b5527208847145edc6be1f4 Modified Files -- src/backend/access/transam/xlog.c | 8 1 file changed, 8 insertions(+)
pgsql: Cache opaque handle for GUC option to avoid repeasted lookups.
Cache opaque handle for GUC option to avoid repeasted lookups. When setting GUCs from proconfig, performance is important, and hash lookups in the GUC table are significant. Per suggestion from Robert Haas. Discussion: https://postgr.es/m/ca+tgmoypkxhr3hod9syk2xwcauvpa0+ba0xpnwwbcyxtklk...@mail.gmail.com Reviewed-by: John Naylor Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/867dd2dc8704e58636b8599f61ada3d83c7e6473 Modified Files -- src/backend/utils/fmgr/fmgr.c| 31 +- src/backend/utils/misc/guc.c | 57 +++- src/include/utils/guc.h | 9 +++ src/tools/pgindent/typedefs.list | 1 + 4 files changed, 84 insertions(+), 14 deletions(-)
pgsql: Shrink Unicode category table.
Shrink Unicode category table. Missing entries can implicitly be considered "unassigned". Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.ca...@j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/719b342d36ce9a049137817e93e6a18a711a40e4 Modified Files -- .../unicode/generate-unicode_category_table.pl | 21 +- src/common/unicode_category.c | 6 +- src/include/common/unicode_category_table.h| 711 + 3 files changed, 15 insertions(+), 723 deletions(-)
pgsql: Optimize SearchPathCache by saving the last entry.
Optimize SearchPathCache by saving the last entry. Repeated lookups are common, so it's worth it to check the last entry before doing another hash lookup. Discussion: https://postgr.es/m/04c8592dbd694e4114a3ed87139a7a04e4363030.camel%40j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a86c61c9eefaba7dcf375cd60c875c871ed60945 Modified Files -- src/backend/catalog/namespace.c | 88 ++--- 1 file changed, 57 insertions(+), 31 deletions(-)