pgsql: Fix INITCAP() word boundaries for PG_UNICODE_FAST.

2025-04-21 Thread Jeff Davis
Fix INITCAP() word boundaries for PG_UNICODE_FAST. Word boundaries are based on whether a character is alphanumeric or not. For the PG_UNICODE_FAST collation, alphanumeric includes non-ASCII digits; whereas for the PG_C_UTF8 collation, it only includes digits 0-9. Pass down the right information f

pgsql: Improve comment in regc_pg_locale.c.

2025-04-16 Thread Jeff Davis
Improve comment in regc_pg_locale.c. Reported-by: Noah Misch Reviewed-by: Noah Misch Discussion: https://postgr.es/m/20250412123430.8c.nmi...@google.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b107744ce73782a996aaa65dfd9d1bb3c543503d Modified Files --

pgsql: Another unintentional behavior change in commit e9931bfb75.

2025-04-16 Thread Jeff Davis
Another unintentional behavior change in commit e9931bfb75. Reported-by: Noah Misch Reviewed-by: Noah Misch Discussion: https://postgr.es/m/20250412123430.8c.nmi...@google.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2e5353be2534aed99a714f99c8a193f85777e64a

Re: pgsql: Transfer statistics during pg_upgrade.

2025-04-08 Thread Jeff Davis
ame: mytable3; Type: STATISTICS DATA; ... If you still see a problem, please let me know. Regards, Jeff Davis

Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-04-06 Thread Jeff Davis
to where 2a083ab807db has been applied. My mistake, backported through 16 now. Regards, Jeff Davis

pgsql: Fix unintentional 'NULL' string literal in pg_upgrade.

2025-04-06 Thread Jeff Davis
Fix unintentional 'NULL' string literal in pg_upgrade. Introduced in 2a083ab807. Note: backport of commit 945126234b, which was missed at the time. Discussion: https://postgr.es/m/e852442da35b4f31acc600ed98bbee0f12e65e0c.ca...@j-davis.com Reviewed-by: Michael Paquier Backpatch-through: 16 Bra

pgsql: Fix unintentional 'NULL' string literal in pg_upgrade.

2025-04-06 Thread Jeff Davis
Fix unintentional 'NULL' string literal in pg_upgrade. Introduced in 2a083ab807. Note: backport of commit 945126234b, which was missed at the time. Discussion: https://postgr.es/m/e852442da35b4f31acc600ed98bbee0f12e65e0c.ca...@j-davis.com Reviewed-by: Michael Paquier Backpatch-through: 16 Bra

pgsql: Create accessor functions for TupleHashEntry.

2025-04-05 Thread Jeff Davis
Create accessor functions for TupleHashEntry. Refactor for upcoming optimizations. Reviewed-by: David Rowley Discussion: https://postgr.es/m/1cc3b400a0e8eead18ff967436fa9e42c0c14cfb.ca...@j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4d143509cbfae02

pgsql: Oversight in commit b81ffa13e3.

2025-04-04 Thread Jeff Davis
Oversight in commit b81ffa13e3. Should warn if a materialized view may be affected, as well. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3556c89321e8baa2242288bd4f015efd1e9d6be0 Modified Files -- src/bin/pg_upgrade/check.c | 4 1 file changed, 4

pgsql: Fix unintentional 'NULL' string literal in pg_upgrade.

2025-04-03 Thread Jeff Davis
Fix unintentional 'NULL' string literal in pg_upgrade. Introduced in 2a083ab807. Discussion: https://postgr.es/m/e852442da35b4f31acc600ed98bbee0f12e65e0c.ca...@j-davis.com Reviewed-by: Michael Paquier Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/945126234bbc03

pgsql: pg_upgrade check for Unicode-dependent relations.

2025-04-03 Thread Jeff Davis
pg_upgrade check for Unicode-dependent relations. This check will not cause an upgrade failure, only a warning. Discussion: https://postgr.es/m/ef03d678b39a64392f4b12e0f59d1495c740969e.camel%40j-davis.com Reviewed-by: Peter Eisentraut Branch -- master Details --- https://git.postgresq

pgsql: Add relallfrozen to pg_dump statistics.

2025-03-30 Thread Jeff Davis
Add relallfrozen to pg_dump statistics. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=descuf3dvhasadvduvrmb-5go0mhmo5u9nzgv6i7u...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4694aedf63bf5b5d91f766cb6d6d6d14a9e4434b Modified File

Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-03-30 Thread Jeff Davis
back more versions successfully. I'm not sure what all of the reasons are, though. Regards, Jeff Davis From 64b895188c164795e0419c76470fb8c1aa5bfd06 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Sun, 30 Mar 2025 09:22:03 -0700 Subject: [PATCH] fixup --- src/bin/pg_upgrade/pg_

Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing

2025-03-29 Thread Jeff Davis
like you failed 1 test of 16. Looking at the commit, it seems you are escaping NULL as a literal. Regards, Jeff Davis

pgsql: Matview statistics depend on matview data.

2025-03-28 Thread Jeff Davis
Matview statistics depend on matview data. REFRESH MATERIALIZED VIEW replaces the storage, which resets statistics, so statistics must be restored afterward. If both statistics and data are being dumped for a materialized view, add a dependency from the former to the latter. Defer the statistics

pgsql: Add pg_dump --with-{schema|data|statistics} options.

2025-03-25 Thread Jeff Davis
Add pg_dump --with-{schema|data|statistics} options. By adding the positive variants of options, in addition to the negative variants that already exist, users can be explicit about what pg_dump should produce. Discussion: https://postgr.es/m/bd0513e4b1ea2b2f2d06f02720c6579711cb62a6.ca...@j-davi

pgsql: Stats: use schemaname/relname instead of regclass.

2025-03-25 Thread Jeff Davis
Stats: use schemaname/relname instead of regclass. For import and export, use schemaname/relname rather than regclass. This is more natural during export, fits with the other arguments better, and it gives better control over error handling in case we need to downgrade more errors to warnings. A

pgsql: Minor doc update for commit 99f8f3fbbc.

2025-03-25 Thread Jeff Davis
Minor doc update for commit 99f8f3fbbc. Author: Corey Huinker Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2a420f7995e415f4813fccf1c42ab29a3a32182f Modified Files -- doc/src/sgml/func.sgml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

pgsql: Add ExecCopySlotMinimalTupleExtra().

2025-03-24 Thread Jeff Davis
Add ExecCopySlotMinimalTupleExtra(). Allows an "extra" argument that allocates extra memory at the end of the MinimalTuple. This is important for callers that need to store additional data, but do not want to perform an additional allocation. Suggested-by: David Rowley Discussion: https://postg

pgsql: Remove 'additional' pointer from TupleHashEntryData.

2025-03-24 Thread Jeff Davis
Remove 'additional' pointer from TupleHashEntryData. Reduces memory required for hash aggregation by avoiding an allocation and a pointer in the TupleHashEntryData structure. That structure is used for all buckets, whether occupied or not, so the savings is substantial. Discussion: https://postg

pgsql: HashAgg: use Bump allocator for hash TupleHashTable entries.

2025-03-24 Thread Jeff Davis
HashAgg: use Bump allocator for hash TupleHashTable entries. The entries aren't freed until the entire hash table is destroyed, so use the Bump allocator to improve allocation speed, avoid wasting space on the chunk header, and avoid wasting space due to the power-of-two allocations. Discussion:

pgsql: Fix headerscheck warning.

2025-03-18 Thread Jeff Davis
Fix headerscheck warning. Reported-by: Tom Lane Discussion: https://postgr.es/m/93731.1742310...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/549ea06e4217aca10d3a73dc09cf5018c51bc23a Modified Files -- src/common/unicode/generate-unicod

pgsql: Optimization for lower(), upper(), casefold() functions.

2025-03-15 Thread Jeff Davis
Optimization for lower(), upper(), casefold() functions. Improve performance and reduce table sizes for case mapping. The main case mapping table stores only 16-bit offsets, which can be used to look up the mapped code point in any of the case tables (fold, lower, upper, or title case). Simple ca

pgsql: Organize and deduplicate statistics import tests.

2025-03-15 Thread Jeff Davis
Organize and deduplicate statistics import tests. Author: Corey Huinker Reported-by: Melanie Plageman Discussion: https://postgr.es/m/CAAKRu_bWEqUfxhODfJ-XbZC75vq=P6DYOKK6biyey=ym1ah...@mail.gmail.com Discussion: https://postgr.es/m/CADkLM=f1n2_Vomq0gKab7xdxDHmJGgn=de48p8fzqop3mrs...@mail.gmai

pgsql: Refactor convert_case() to prepare for optimizations.

2025-03-12 Thread Jeff Davis
Refactor convert_case() to prepare for optimizations. Upcoming optimizations will add complexity to convert_case(). This patch reorganizes slightly so that the complexity can be contained within the logic to convert the case of a single character, rather than mixing it in with logic to iterate thr

pgsql: Don't convert to and from floats in pg_dump.

2025-03-08 Thread Jeff Davis
Don't convert to and from floats in pg_dump. Commit 8f427187db improved performance by remembering relation stats as native types rather than issuing a new query for each relation. Using native types is fine for integers like relpages; but reltuples is floating point. The commit controllled for t

pgsql: Address stats export review comments.

2025-03-07 Thread Jeff Davis
Address stats export review comments. Per discussion, did not use Jian He's patch exactly. Reported-by: jian he Reviewed-by: Corey Huinker Discussion: https://postgr.es/m/CACJufxFVq=tq9u1zrhwysbmi1t07gs9ff0ljscmco4hzmtz...@mail.gmail.com Discussion: https://postgr.es/m/CADkLM=f1n2_Vomq0gKab7x

pgsql: CREATE INDEX: don't update table stats if autovacuum=off.

2025-03-07 Thread Jeff Davis
CREATE INDEX: don't update table stats if autovacuum=off. We previously fixed this for binary upgrade in 71b66171d0, but a similar problem remained when dumping statistics without data. Fix by not opportunistically updating table stats during CREATE INDEX when autovacuum is disabled. For stats to

pgsql: Address stats import review comments.

2025-03-05 Thread Jeff Davis
Address stats import review comments. Reported-by: jian he Discussion: https://postgr.es/m/cacjufxhg9mbqozbjq4jrbcrbuo+t+sx4qlzx092rs_9b4sr...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/298944e8d80252820531309e5b73d7de7d85e2df Modified Files -

pgsql: Adjust pg_dump tag for relation stats.

2025-02-27 Thread Jeff Davis
Adjust pg_dump tag for relation stats. Do not use fmtId(), just use dobj->name directly, like for table data. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/424ededc580b03e1bcf8aff18a735e519c80061f Modified Files -- src/bin/pg_dump/pg_dump.c | 7 +-

pgsql: Remove stray diff introduced by a5cbdeb98a.

2025-02-26 Thread Jeff Davis
Remove stray diff introduced by a5cbdeb98a. Reported-by: Michael Paquier Discussion: https://postgr.es/m/z77ikjmmfbffn...@paquier.xyz Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/15df9d7b5123b2b478886175c17cd0c0359d9996 Modified Files -- src/include

pgsql: Avoid unnecessary relation stats query in pg_dump.

2025-02-25 Thread Jeff Davis
Avoid unnecessary relation stats query in pg_dump. The few fields we need can be easily collected in getTables() and getIndexes() and stored in RelStatsInfo. Reviewed-by: Tom Lane Reported-by: Andres Freund Co-authored-by: Corey Huinker Co-authored-by: Jeff Davis Discussion: https

pgsql: pg_dump: prepare attribute stats query.

2025-02-25 Thread Jeff Davis
pg_dump: prepare attribute stats query. Follow precedent in pg_dump for preparing queries to improve performance. Also, simplify the query by removing unnecessary joins. Reviewed-by: Tom Lane Reported-by: Andres Freund Co-authored-by: Corey Huinker Co-authored-by: Jeff Davis Discussion

pgsql: Remove redundant pg_set_*_stats() variants.

2025-02-25 Thread Jeff Davis
Remove redundant pg_set_*_stats() variants. After commit f3dae2ae58, the primary purpose of separating the pg_set_*_stats() from the pg_restore_*_stats() variants was eliminated. Leave pg_restore_relation_stats() and pg_restore_attribute_stats(), which satisfy both purposes, and remove pg_set_rel

pgsql: Missing doc update for f3dae2ae58.

2025-02-24 Thread Jeff Davis
Missing doc update for f3dae2ae58. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/15601fa21a5509b83a871c39ab98671f560da905 Modified Files -- doc/src/sgml/func.sgml | 8 1 file changed, 8 deletions(-)

pgsql: Do not use in-place updates for statistics import.

2025-02-24 Thread Jeff Davis
Do not use in-place updates for statistics import. The use of in-place updates was originally there to follow the precedent of ANALYZE and to reduce the potential for bloat on pg_class. Per discussion, it's not worth the risks. Reported-by: Andres Freund Discussion: https://postgr.es/m/cpdanvzy

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-24 Thread Jeff Davis
x27;ll submit a patch to the -hackers thread. There are a few minor choices here that might get some discussion. Regards, Jeff Davis

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-22 Thread Jeff Davis
xversion-upgrade-REL_12_STABLE-HEAD I was puzzling through whether the attribute name uniqueness logic was doing something strange, but it's very simple. And the table and index should both be locked at the point of the syscache lookup. Regards, Jeff Davis

pgsql: Documentation fixups for dumping statistics.

2025-02-22 Thread Jeff Davis
Documentation fixups for dumping statistics. Reported-by: Hayato Kuroda (Fujitsu) Reported-by: Andrew Dunstan Discussion: https://postgr.es/m/oscpr01mb149665630030e7f54fda8b27bf5...@oscpr01mb14966.jpnprd01.prod.outlook.com Discussion: https://postgr.es/m/25d26774-25fa-46f2-9888-c6a707d1f...@du

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-21 Thread Jeff Davis
ormation to know which branches still work. That's a good idea and would be a big help. Regards, Jeff Davis

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-21 Thread Jeff Davis
cluster, autovacuum did have a chance to run, just not after the first dumpall. Regards, Jeff Davis

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-21 Thread Jeff Davis
On Thu, 2025-02-20 at 13:17 -0800, Jeff Davis wrote: > On Thu, 2025-02-20 at 18:30 +0000, Jeff Davis wrote: > > Trial fix for old cross-version upgrades. > > That fixed one problem, but there are other problems with 9.2 > upgrades. The version that I committed had the f

pgsql: Fix for pg_restore_attribute_stats().

2025-02-20 Thread Jeff Davis
Fix for pg_restore_attribute_stats(). Use RelationGetIndexExpressions() rather than rd_indexprs directly. Author: Corey Huinker Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b50a554cc84066577f0f0a3baafe2f1fac302006 Modified Files -- src/backend/stat

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-20 Thread Jeff Davis
On Thu, 2025-02-20 at 18:30 +, Jeff Davis wrote: > Trial fix for old cross-version upgrades. That fixed one problem, but there are other problems with 9.2 upgrades. And it looks like there's also a problem with upgrades from 12. Investigating... Regards, Jeff Davis

pgsql: Trial fix for old cross-version upgrades.

2025-02-20 Thread Jeff Davis
Trial fix for old cross-version upgrades. Per buildfarm and reports, it seems that 9.X to 18 upgrades were failing after commit 1fd1bd8710 due to an incorrect regex. Loosen the regex to accommodate older versions. Reported-by: vignesh C Reported-by: Andrew Dunstan Discussion: https://postgr.es

pgsql: Transfer statistics during pg_upgrade.

2025-02-20 Thread Jeff Davis
previous --schema-only and --data-only options. Statistics are in SECTION_DATA, unless the object itself is in SECTION_POST_DATA. The stats are represented as calls to pg_restore_relation_stats() and pg_restore_attribute_stats(). Author: Corey Huinker, Jeff Davis Reviewed-by: Jian He Discussion

pgsql: Update outdated comments in nodeAgg.c.

2025-02-18 Thread Jeff Davis
Update outdated comments in nodeAgg.c. Author: Zhang Mingli Reviewed-by: Richard Guo Discussion: https://postgr.es/m/198a8d1e-0792-4e7f-828e-902aa342f36e@Spark Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a1f7f80bfef105c8c02153e8832d4106df3cf459 Modified Files -

pgsql: Injection points for hash aggregation.

2025-02-11 Thread Jeff Davis
Injection points for hash aggregation. Requires adding a guard against shift-by-32. Previously, that was impossible because the number of partitions was always greater than 1, but a new injection point can force the number of partitions to 1. Discussion: https://postgr.es/m/ff4e59305e5d689e03cd2

pgsql: Lock table in ShareUpdateExclusive when importing index stats.

2025-02-10 Thread Jeff Davis
Lock table in ShareUpdateExclusive when importing index stats. Follow locking behavior of ANALYZE when importing statistics. In particular, when importing index statistics, the table must be locked in ShareUpdateExclusive mode. Fixes bug reportd by Jian He. ANALYZE doesn't update statistics on pa

pgsql: Fix PDF doc build.

2025-01-25 Thread Jeff Davis
Fix PDF doc build. Reported-by: Tom Lane Discussion: https://postgr.es/m/608525.1737781...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d2ca16bb509c453eac181c1ef805ff55289df779 Modified Files -- doc/src/sgml/func.sgml | 12

pgsql: Add SQL function CASEFOLD().

2025-01-24 Thread Jeff Davis
Add SQL function CASEFOLD(). Useful for caseless matching. Similar to LOWER(), but avoids edge-case problems with using LOWER() for caseless matching. For collations that support it, CASEFOLD() handles characters with more than two case variations or multi-character case variations. Some characte

pgsql: Add support for Unicode case folding.

2025-01-23 Thread Jeff Davis
Add support for Unicode case folding. Expand case mapping tables to include entries for case folding, which are parsed from CaseFolding.txt. Discussion: https://postgr.es/m/a1886ddfcd8f60cb3e905c93009b646b4cfb74c5.camel%40j-davis.com Branch -- master Details --- https://git.postgresql.

pgsql: Support Unicode full case mapping and conversion.

2025-01-17 Thread Jeff Davis
Support Unicode full case mapping and conversion. Generate tables from Unicode SpecialCasing.txt to support more sophisticated case mapping behavior: * support case mappings to multiple codepoints, such as "ß" uppercasing to "SS" * support conditional case mappings, such as the "final sigma"

pgsql: Support PG_UNICODE_FAST locale in the builtin collation provider

2025-01-17 Thread Jeff Davis
Support PG_UNICODE_FAST locale in the builtin collation provider. The PG_UNICODE_FAST locale uses code point sort order (fast, memcmp-based) combined with Unicode character semantics. The character semantics are based on Unicode full case mapping. Full case mapping can map a single codepoint to m

pgsql: Revert "TupleHashTable: store additional data along with tuple."

2025-01-13 Thread Jeff Davis
Revert "TupleHashTable: store additional data along with tuple." This reverts commit e0ece2a981ee9068f50c4423e303836c2585eb02 due to performance regressions. Reported-by: David Rowley Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b4a07f532b40a64fb4714a3f7ab606343

pgsql: Fix redefinition of type in commit e0ece2a981.

2025-01-10 Thread Jeff Davis
Fix redefinition of type in commit e0ece2a981. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ceb2855522940d5aaae4c6e5eed493d60e3196ce Modified Files -- src/backend/executor/execGrouping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

pgsql: TupleHashTable: store additional data along with tuple.

2025-01-10 Thread Jeff Davis
TupleHashTable: store additional data along with tuple. Previously, the caller needed to allocate the memory and the TupleHashTable would store a pointer to it. That wastes space for the palloc overhead as well as the size of the pointer itself. Now, the TupleHashTable relies on the caller to cor

pgsql: Fix duplicate typedef from commit a2f17f004d.

2025-01-08 Thread Jeff Davis
Fix duplicate typedef from commit a2f17f004d. Reported-by: Thomas Munro Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/229e7793d96954739d3fb9b37e2ccf77c2803f07 Modified Files -- src/include/utils/pg_locale.h | 2 -- 1 file changed, 2 deletions(-)

pgsql: Control collation behavior with a method table.

2025-01-08 Thread Jeff Davis
Control collation behavior with a method table. Previously, behavior branched based on the provider. A method table is less error-prone and more flexible. The ctype behavior will be addressed in an upcoming commit. Reviewed-by: Andreas Karlsson Discussion: https://postgr.es/m/2830211e1b6e6a2e26

pgsql: Move code for collation version into provider-specific files.

2025-01-08 Thread Jeff Davis
Move code for collation version into provider-specific files. Author: Andreas Karlsson Discussion: https://postgr.es/m/4548a168-62cd-457b-8d06-9ba7b985c477%40proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4f5cef2607c1f8804d4b54250642aaf586745b0e Modified

pgsql: ExecInitAgg: update aggstate->numaggs and ->numtrans earlier.

2025-01-07 Thread Jeff Davis
ExecInitAgg: update aggstate->numaggs and ->numtrans earlier. Functions hash_agg_entry_size() and build_hash_tables() make use of those values for memory size estimates. Because this change only affects memory estimates, don't backpatch. Discussion: https://postgr.es/m/7530bd8783b1a78d53a3c7038

pgsql: nodeSetOp.c: missing additionalsize for BuildTupleHashTable().

2025-01-07 Thread Jeff Davis
nodeSetOp.c: missing additionalsize for BuildTupleHashTable(). Provide additionalsize argument, which can affect the calculations for 'nbuckets'. Also, future work for Hash Aggregation will rely on the correct additionalsize. Discussion: https://postgr.es/m/7530bd8783b1a78d53a3c70383e38d8da0a5ff

pgsql: Remove unused TupleHashTableData->entrysize.

2025-01-07 Thread Jeff Davis
Remove unused TupleHashTableData->entrysize. Discussion: https://postgr.es/m/7530bd8783b1a78d53a3c70383e38d8da0a5ffe5.camel%40j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8a96faedc408b447acd1570d2f51300bcec34959 Modified Files -- src/bac

pgsql: Add missing typedefs.list entry for AggStatePerGroupData.

2025-01-07 Thread Jeff Davis
Add missing typedefs.list entry for AggStatePerGroupData. Discussion: https://postgr.es/m/7530bd8783b1a78d53a3c70383e38d8da0a5ffe5.camel%40j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/834c9e807cf12e355f06479a8b1f7a82aba77315 Modified Files -

pgsql: Refactor string case conversion into provider-specific files.

2024-12-16 Thread Jeff Davis
Refactor string case conversion into provider-specific files. Create API entry points pg_strlower(), etc., that work with any provider and give the caller control over the destination buffer. Then, move provider-specific logic into pg_locale_builtin.c, pg_locale_icu.c, and pg_locale_libc.c as appr

pgsql: Use in-place updates for pg_restore_relation_stats().

2024-12-10 Thread Jeff Davis
Use in-place updates for pg_restore_relation_stats(). This matches the behavior of vac_update_relstats(), which is important to avoid bloating pg_class. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=fc3je+ufv3gshqjjssf+t8674rxpuxw62el55mueq...@mail.gmail.com Branch -- master

pgsql: Comment fix: "buffer context lock" to "buffer content lock".

2024-12-06 Thread Jeff Davis
Comment fix: "buffer context lock" to "buffer content lock". The term "buffer context lock" is outdated as of commit 5d5087363d. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ffe003cae1ff28b698f1769e46e3dc14b5516070 Modified Files -- src/backend/acces

pgsql: Move check for ucol_strcollUTF8 to pg_locale_icu.c

2024-12-03 Thread Jeff Davis
Move check for ucol_strcollUTF8 to pg_locale_icu.c The result of the check is only used by pg_locale_icu.c. Author: Andreas Karlsson Discussion: https://postgr.es/m/4548a168-62cd-457b-8d06-9ba7b985c...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7167e

pgsql: Perform provider-specific initialization in new functions.

2024-12-02 Thread Jeff Davis
Perform provider-specific initialization in new functions. Reviewed-by: Andreas Karlsson Discussion: https://postgr.es/m/4548a168-62cd-457b-8d06-9ba7b985c...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1ba0782ce90cb4261098de59b49ae5cb2326566b Modified

pgsql: Fix unintentional behavior change in commit e9931bfb75.

2024-12-02 Thread Jeff Davis
Fix unintentional behavior change in commit e9931bfb75. Prior to that commit, there was special case to use ASCII case mapping behavior for the libc provider with a single-byte encoding when that's the default collation. Commit e9931bfb75 mistakenly eliminated that special case; this commit restor

pgsql: Disallow modifying statistics on system columns.

2024-11-22 Thread Jeff Davis
Disallow modifying statistics on system columns. Reported-by: Heikki Linnakangas Discussion: https://postgr.es/m/df3e1c41-4e6c-40ad-9636-98deefe48...@iki.fi Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/869ee4f10eca2acda3d2210198a46d5029a569fc Modified Files

pgsql: Fix lc_collate_is_c() when LC_COLLATE != LC_CTYPE.

2024-11-06 Thread Jeff Davis
Fix lc_collate_is_c() when LC_COLLATE != LC_CTYPE. An unfortunate typo in commit 2d819a08a1 can cause wrong results when the default collation provider is libc, LC_CTYPE=C, and LC_COLLATE is a real locale. Users with this combination of settings must REINDEX all affected indexes. The same typo ca

pgsql: Add missing CommandCounterIncrement() in stats import functions.

2024-10-29 Thread Jeff Davis
Add missing CommandCounterIncrement() in stats import functions. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/98b2fcf0-f701-369e-d63d-6be9739ce...@gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f22e436bff779fee4e1ce49733ba5791d4634fb1 Mo

pgsql: Refactor the code to create a pg_locale_t into new function.

2024-10-25 Thread Jeff Davis
Refactor the code to create a pg_locale_t into new function. Reviewed-by: Andreas Karlsson Discussion: https://postgr.es/m/59da7ee4-5e1a-4727-b464-a603c6ed8...@proxel.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3aa2373c114124f62e80016d8939331fcb4d5586 Modifi

pgsql: Add functions pg_restore_relation_stats(), pg_restore_attribute_

2024-10-24 Thread Jeff Davis
Add functions pg_restore_relation_stats(), pg_restore_attribute_stats(). Similar to the pg_set_*_stats() functions, except with a variadic signature that's designed to be more future-proof. Additionally, most problems are reported as WARNINGs rather than ERRORs, allowing most stats to be restored

pgsql: Improve pg_set_attribute_stats() error message.

2024-10-23 Thread Jeff Davis
Improve pg_set_attribute_stats() error message. Previously, an invalid attribute name was caught, but the error message was unhelpful. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4b096c67e0eed81e287094b9692fff72b9ea3eef Modified Files -- src/backend

pgsql: Another documentation fixup.

2024-10-23 Thread Jeff Davis
Another documentation fixup. Reported-by: Erik Rijkers Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0a3f9838218f6f7ff825bb0af00177681fef83ce Modified Files -- doc/src/sgml/func.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Fix compiler warning.

2024-10-23 Thread Jeff Davis
Fix compiler warning. Some buildfarm members complained about an always-true test in the SOFT_ERROR_OCCURRED macro. Fix by reading the field directly rather than using the macro. Reported-by: Tom Lane Discussion: https://postgr.es/m/2144895.1729653...@sss.pgh.pa.us Branch -- master Details

pgsql: Documentation fixup.

2024-10-23 Thread Jeff Davis
Documentation fixup. Wrong return type for pg_clear_attribute_stats(). Author: Noriyoshi Shinoda Discussion: https://postgr.es/m/dm4pr84mb17347944f27a552f0ccdf84cee...@dm4pr84mb1734.namprd84.prod.outlook.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/07d00692

pgsql: Add functions pg_set_attribute_stats() and pg_clear_attribute_st

2024-10-22 Thread Jeff Davis
Add functions pg_set_attribute_stats() and pg_clear_attribute_stats(). Enable manipulation of attribute statistics. Only superficial validation is performed, so it's possible to add nonsense, and it's up to the planner (or other users of statistics) to behave reasonably in that case. Bump catalog

pgsql: Change pg_*_relation_stats() functions to return type to void.

2024-10-22 Thread Jeff Davis
Change pg_*_relation_stats() functions to return type to void. These functions will either raise an ERROR or run to normal completion, so no return value is necessary. Bump catalog version. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=cbf8rnphutyhfi3kyzb9bydgx57hwk9rz2yp7s+om...

pgsql: Allow pg_set_relation_stats() to set relpages to -1.

2024-10-18 Thread Jeff Davis
Allow pg_set_relation_stats() to set relpages to -1. While the default value for relpages is 0, if a partitioned table with at least one child has been analyzed, then the partititoned table will have a relpages value of -1. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=fajh1Lpcyr_

pgsql: Disable autovacuum for tables in stats import tests.

2024-10-18 Thread Jeff Davis
Disable autovacuum for tables in stats import tests. While we haven't observed any test instability, it seems like a good idea to disable autovacuum during the stats import tests. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=fajh1Lpcyr_XsMmq-9Z=sgk-u+_zeac7pt0ran3ui...@mail.gmail

pgsql: Improve ThrowErrorData() comments for use with soft errors.

2024-10-17 Thread Jeff Davis
Improve ThrowErrorData() comments for use with soft errors. Reviewed-by: Corey Huinker Discussion: https://postgr.es/m/901ab7cf01957f92ea8b30b6feeb0eacfb7505fc.ca...@j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/eecd9138a0ef565366427a88866d0651530f7da

pgsql: Whitespace fixup from generated unicode tables.

2024-10-16 Thread Jeff Davis
Whitespace fixup from generated unicode tables. When running the 'update-unicode' build target, generate files that conform to pgindent whitespace rules. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a7f2f6adc240a2823c2344b89e90bb630dea8803 Modified Files ---

Re: pgsql: Create functions pg_set_relation_stats, pg_clear_relation_stats.

2024-10-16 Thread Jeff Davis
On Tue, 2024-10-15 at 02:00 +0300, Alexander Korotkov wrote: > Please, check the alphabetical order of includes in stat_utils.c. Thank you, fixed. Did you use a tool or just happen to notice? Regards, Jeff Davis

pgsql: Fix #include order from e839c8ecc9.

2024-10-16 Thread Jeff Davis
Fix #include order from e839c8ecc9. Reported-by: Alexander Korotkov Discussion: https://postgr.es/m/capphfduaigssvuc614z-jonyqffcmejncwmf2hnul8wfy4f...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b360d1762b55c3ff36e8b14c6a2286e5d4f61974 Modified

pgsql: Move libc-specific code from pg_locale.c into pg_locale_libc.c.

2024-10-14 Thread Jeff Davis
Move libc-specific code from pg_locale.c into pg_locale_libc.c. Move implementation of pg_locale_t code for libc collations into pg_locale_libc.c. Other locale-related code, such as pg_perm_setlocale(), remains in pg_locale.c for now. Discussion: https://postgr.es/m/flat/2830211e1b6e6a2e26d84578

pgsql: Move ICU-specific code from pg_locale.c into pg_locale_icu.c.

2024-10-14 Thread Jeff Davis
Move ICU-specific code from pg_locale.c into pg_locale_icu.c. Discussion: https://postgr.es/m/flat/2830211e1b6e6a2e26d845780b03e125281ea17b.ca...@j-davis.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f244a2bb4c5520fc0271e638598abcbe7c9bc8cf Modified Files --

pgsql: Fixup for pg_set_relation_stats().

2024-10-13 Thread Jeff Davis
Fixup for pg_set_relation_stats(). Reported-by: Noriyoshi Shinoda Discussion: https://postgr.es/m/dm4pr84mb17345e2dff28a5557b7cbc3cee...@dm4pr84mb1734.namprd84.prod.outlook.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/35a015a60045c2daa532c7a9545818856f09d57a

pgsql: Fix missed case for builtin collation provider.

2024-10-13 Thread Jeff Davis
Fix missed case for builtin collation provider. A missed check for the builtin collation provider could result in falling through to call isalpha(). This does not appear to have practical consequences because it only happens for characters in the ASCII range. Regardless, the builtin provider shou

pgsql: Create functions pg_set_relation_stats, pg_clear_relation_stats.

2024-10-13 Thread Jeff Davis
Create functions pg_set_relation_stats, pg_clear_relation_stats. These functions are used to tweak statistics on any relation, provided that the user has MAINTAIN privilege on the relation, or is the database owner. Bump catalog version. Author: Corey Huinker Discussion: https://postgr.es/m/CAD

pgsql: Fix missed case for builtin collation provider.

2024-10-13 Thread Jeff Davis
Fix missed case for builtin collation provider. A missed check for the builtin collation provider could result in falling through to call isalpha(). This does not appear to have practical consequences because it only happens for characters in the ASCII range. Regardless, the builtin provider shou

pgsql: Fix search_path cache initialization.

2024-10-07 Thread Jeff Davis
Fix search_path cache initialization. The cache needs to be available very early, so don't rely on InitializeSearchPath() to initialize the it. Reported-by: Murat Efendioğlu Discussion: https://postgr.es/m/CACbCzujQ4zS8MM1bx-==+tr+D3Hk5G1cjN4XkUQ+Q=cepwh...@mail.gmail.com Backpatch-through: 17

pgsql: Fix search_path cache initialization.

2024-10-07 Thread Jeff Davis
Fix search_path cache initialization. The cache needs to be available very early, so don't rely on InitializeSearchPath() to initialize the it. Reported-by: Murat Efendioğlu Discussion: https://postgr.es/m/CACbCzujQ4zS8MM1bx-==+tr+D3Hk5G1cjN4XkUQ+Q=cepwh...@mail.gmail.com Backpatch-through: 17

pgsql: Allow length=-1 for NUL-terminated input to pg_strncoll(), etc.

2024-09-24 Thread Jeff Davis
Allow length=-1 for NUL-terminated input to pg_strncoll(), etc. Like ICU, allow a length of -1 to be specified for NUL-terminated arguments to pg_strncoll(), pg_strnxfrm(), and pg_strnxfrm_prefix(). Simplifies the code and comments. Discussion: https://postgr.es/m/2d758e07dff26bcc7cbe2aec574313

pgsql: Tighten up make_libc_collator() and make_icu_collator().

2024-09-24 Thread Jeff Davis
Tighten up make_libc_collator() and make_icu_collator(). Ensure that error paths within these functions do not leak a collator, and return the result rather than using an out parameter. (Error paths in the caller may still result in a leaked collator, which will be addressed separately.) In make_

pgsql: Simplify checks for deterministic collations.

2024-09-12 Thread Jeff Davis
Simplify checks for deterministic collations. Remove redundant checks for locale->collate_is_c now that we always have a valid pg_locale_t. Also, remove pg_locale_deterministic() wrapper, which is no longer useful after commit e9931bfb75. Just check the field directly, consistent with other field

pgsql: Remove redundant check for default collation.

2024-09-12 Thread Jeff Davis
Remove redundant check for default collation. The operative check is for a deterministic collation, so the check for DEFAULT_COLLATION is redundant. Furthermore, it will be wrong if we ever support a non-deterministic default collation. Author: Andreas Karlsson Discussion: https://postgr.es/m/609

pgsql: Remove lc_ctype_is_c().

2024-09-06 Thread Jeff Davis
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_collat

  1   2   3   4   5   >