pgsql: Use strchr instead of strstr for single-char lookups

2025-07-22 Thread David Rowley
bother with. Author: Dmitry Mityugov Reviewed-by: Corey Huinker Reviewed-by: David Rowley Discussion: https://postgr.es/m/9c1beea6c7a5e9fb6677f26620f1f257%40postgrespro.ru Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/039f7ee0fe9a25cf26d915d4b68091e080c6c6ec

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-07-20 Thread David Rowley
On Thu, 17 Jul 2025 at 16:20, Tom Lane wrote: > > David Rowley writes: > > Unsure what other repercussions there are of compiling with C11 and > > have not looked into what it would take to adjust the meson build > > scripts to default to that for MSVC builds. > >

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-07-16 Thread David Rowley
On Thu, 17 Jul 2025 at 15:19, Tom Lane wrote: > > David Rowley writes: > > I spent a bit more time searching for a solution and did find > > something that works well enough for this case in [1]. Unfortunately, > > it only works with C11. See attached .c file and output b

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-07-16 Thread David Rowley
On Thu, 17 Jul 2025 at 02:56, Tom Lane wrote: > Looking again at the code for ereport_domain(), I wondered if > something like this would help MSVC see through it: > > #define ereport_domain(elevel, domain, ...)\ > do { \ > const int elevel_ = (elevel); \ > + const bool is_e

pgsql: Fix possible Assert failure in verify_compact_attribute()

2025-06-16 Thread David Rowley
te so that we're not trying to Assert against a shared copy of it. Author: David Rowley Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/7195e408-758c-4031-8e61-4f842c716...@gmail.com Branch -- master Details --- https://git.postgresql.or

pgsql: Improve comments for TidRangeEval

2025-06-13 Thread David Rowley
Improve comments for TidRangeEval Here we provide a bit more detail on why TidRangeEval() does return false when trss_mintid is greater than trss_maxtid. Reported-by: Junwang Zhao Author: David Rowley Reviewed-by: Junwang Zhao Discussion: https://postgr.es/m/CAEG8a3KUbUUqQgfK5X8Sj

pgsql: Change internal queryid type from uint64 to int64

2025-05-30 Thread David Rowley
n this adjustment as some extensions may wish to adjust their code. Author: David Rowley Suggested-by: Peter Eisentraut Reviewed-by: Sami Imseih Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/50cb0c8b-994b-48f9-a1c4-13039eb35...@eisentraut.org Branch -- master D

Re: pgsql: Add missing string terminator

2025-04-30 Thread David Rowley
On Thu, 1 May 2025 at 00:44, Peter Eisentraut wrote: > > On 30.04.25 13:56, David Rowley wrote: > > In case you're looking for inspiration on a standard to follow, > > commits such as 586dd5d6a did seem to favour memcpy() when the length > > was known and only use str

Re: pgsql: Add missing string terminator

2025-04-30 Thread David Rowley
On Wed, 30 Apr 2025 at 23:43, David Rowley wrote: > memcpy() would make more sense IMO, since the length is > known already. I'm fine with either, however. In case you're looking for inspiration on a standard to follow, commits such as 586dd5d6a did seem to favour memcpy() whe

Re: pgsql: Add missing string terminator

2025-04-30 Thread David Rowley
On Wed, 30 Apr 2025 at 23:27, Daniel Gustafsson wrote: > How about using strlcpy as suggested by Peter? > > - strncpy(nameptr, "Remaining Totals", namelen); > - nameptr[namelen] = '\0'; > + strlcpy(nameptr, "Remaining Totals", namel

Re: pgsql: Add missing string terminator

2025-04-30 Thread David Rowley
On Wed, 30 Apr 2025 at 21:36, Daniel Gustafsson wrote: > Add missing string terminator A possible minor niggle. Would memcpy not be a more suitable function for this? It's just there've been a few efforts in the past to try and minimise the usage of strncpy(). There should really just be a smal

pgsql: Add 918e7287e to .git-blame-ignore-revs

2025-04-30 Thread David Rowley
Add 918e7287e to .git-blame-ignore-revs Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/991407ae86785ef38bb1ebfea679a70bcd76574d Modified Files -- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+)

pgsql: Fix broken indentation

2025-04-30 Thread David Rowley
Fix broken indentation I forgot to run pgindent in d8555e522. Reported-by: Fujii Masao Discussion: https://postgr.es/m/156083c9-eac0-418d-9667-92dec4d6d...@oss.nttdata.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/918e7287ed20eb1fe280ab6c4056ccf94dcd53a8 M

pgsql: Fix a couple of comment typos

2025-04-29 Thread David Rowley
Fix a couple of comment typos Author: Junwang Zhao Discussion: https://postgr.es/m/caeg8a3+mrwdkc4ysfkkpkq7y+vmufvc5u94wm5kzpb2cbgc...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d8555e522eca00f1b4b6cd0b75269b7176fb7931 Modified Files -

pgsql: Eliminate divide in new fast-path locking code

2025-04-26 Thread David Rowley
more clear that the value being set is a power-of-two. Also, adjust some comments in the area which contained some magic numbers. It seems better to justify the 1024 upper limit in the location where the #define is made instead of where it is used. Author: David Rowley Reviewed-by: Tomas Vondra

pgsql: Doc: reword text explaining the --maintenance-db option

2025-04-21 Thread David Rowley
Doc: reword text explaining the --maintenance-db option The previous text was a little clumsy. Here we improve that. Author: David Rowley Reported-by: Noboru Saito Reviewed-by: David G. Johnston Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz

pgsql: Doc: reword text explaining the --maintenance-db option

2025-04-21 Thread David Rowley
Doc: reword text explaining the --maintenance-db option The previous text was a little clumsy. Here we improve that. Author: David Rowley Reported-by: Noboru Saito Reviewed-by: David G. Johnston Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz

pgsql: Doc: reword text explaining the --maintenance-db option

2025-04-21 Thread David Rowley
Doc: reword text explaining the --maintenance-db option The previous text was a little clumsy. Here we improve that. Author: David Rowley Reported-by: Noboru Saito Reviewed-by: David G. Johnston Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz

pgsql: Doc: reword text explaining the --maintenance-db option

2025-04-21 Thread David Rowley
Doc: reword text explaining the --maintenance-db option The previous text was a little clumsy. Here we improve that. Author: David Rowley Reported-by: Noboru Saito Reviewed-by: David G. Johnston Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz

pgsql: Doc: reword text explaining the --maintenance-db option

2025-04-21 Thread David Rowley
Doc: reword text explaining the --maintenance-db option The previous text was a little clumsy. Here we improve that. Author: David Rowley Reported-by: Noboru Saito Reviewed-by: David G. Johnston Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz

pgsql: Doc: reword text explaining the --maintenance-db option

2025-04-21 Thread David Rowley
Doc: reword text explaining the --maintenance-db option The previous text was a little clumsy. Here we improve that. Author: David Rowley Reported-by: Noboru Saito Reviewed-by: David G. Johnston Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz

pgsql: Doc: various fixups

2025-04-21 Thread David Rowley
Doc: various fixups * Use tags for CONNECTION_* #defines We were using an inconsistent mix of and sometimes tags. * Use tag for libpq There was a mix of and Also fix a whitespace issue. None of these seem critical enough mistakes to backpatch. Author: Noboru Saito Discussion: https:/

pgsql: Doc: fix incorrect punctuation

2025-04-21 Thread David Rowley
Doc: fix incorrect punctuation Author: Noboru Saito Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz...@mail.gmail.com Backpatch-through: 17 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/12bf43410aba58a577a8519e031a0e24631e

pgsql: Doc: fix incorrect punctuation

2025-04-21 Thread David Rowley
Doc: fix incorrect punctuation Author: Noboru Saito Discussion: https://postgr.es/m/caam3qnjtv5ybjpwdfvoyn2gz9zgslfm1ugjgptsxmwfifoz...@mail.gmail.com Backpatch-through: 17 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d010cc6ccacf88926255d3ae2d67dad3e332ae8a M

pgsql: Fix a few more duplicate words in comments

2025-04-20 Thread David Rowley
Fix a few more duplicate words in comments Similar to 84fd3bc14 but these ones were found using a regex that can span multiple lines. Author: David Rowley Discussion: https://postgr.es/m/CAApHDvrMcr8XD107H3NV=WHgyBcu=sx5+7=warr-n_cwuqd...@mail.gmail.com Branch -- master Details

pgsql: Fix a few duplicate words in comments

2025-04-20 Thread David Rowley
Fix a few duplicate words in comments These are all new to v18 Author: David Rowley Discussion: https://postgr.es/m/CAApHDvrMcr8XD107H3NV=WHgyBcu=sx5+7=warr-n_cwuqd...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Fix issue with ORDER BY / DISTINCT aggregates and FILTER

2025-04-20 Thread David Rowley
ins from 1349d2790 due to presorted results coming in from an Index Scan. Backpatch to 16, where 1349d2790 was introduced Author: David Rowley Reported-by: Kaimeh Diagnosed-by: Tom Lane Discussion: https://postgr.es/m/CAK-%2BJz9J%3DQ06-M7cDJoPNeYbz5EZDqkjQbJnmRyQyzkbRGsYkA%40mail.gmail.com Back

pgsql: Fix issue with ORDER BY / DISTINCT aggregates and FILTER

2025-04-20 Thread David Rowley
ins from 1349d2790 due to presorted results coming in from an Index Scan. Backpatch to 16, where 1349d2790 was introduced Author: David Rowley Reported-by: Kaimeh Diagnosed-by: Tom Lane Discussion: https://postgr.es/m/CAK-%2BJz9J%3DQ06-M7cDJoPNeYbz5EZDqkjQbJnmRyQyzkbRGsYkA%40mail.gmail.com Back

pgsql: Fix issue with ORDER BY / DISTINCT aggregates and FILTER

2025-04-20 Thread David Rowley
ins from 1349d2790 due to presorted results coming in from an Index Scan. Backpatch to 16, where 1349d2790 was introduced Author: David Rowley Reported-by: Kaimeh Diagnosed-by: Tom Lane Discussion: https://postgr.es/m/CAK-%2BJz9J%3DQ06-M7cDJoPNeYbz5EZDqkjQbJnmRyQyzkbRGsYkA%40mail.gmail.com Back

pgsql: Make levels 1-based in pg_log_backend_memory_contexts()

2025-04-18 Thread David Rowley
() in regards to the max_level. Previously it would stop at 1 level before the maximum requested level rather than at that level. Reported-by: Atsushi Torikoshi Author: Atsushi Torikoshi Author: David Rowley Reviewed-by: Rahila Syed Discussion: https://postgr.es/m/395ea5d4fe190480efa95bf533485

pgsql: Improve comments for estimate_multivariate_ndistinct()

2025-04-18 Thread David Rowley
t easier to follow. Author: David Rowley Discussion: https://postgr.es/m/caaphdvoczcuhm9w9mj39d6oqz7epkoqfnao_347mvc-a7qa...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f3281f9f9395099724b55ddc52991a92795c6068 Modified Files -- src

pgsql: Fixup various older misuses of appendPQExpBuffer

2025-04-17 Thread David Rowley
rms of released versions that the misuses exist in. Author: David Rowley Discussion: https://postgr.es/m/caaphdvoarmvpexttc0hnparbhn-wgvstc8xfcymgozvgu_1...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1bd08f6ba56ac9b23dc46ab634d82327395e882e

pgsql: Fixup various new-to-v18 usages of appendPQExpBuffer

2025-04-16 Thread David Rowley
Fixup various new-to-v18 usages of appendPQExpBuffer Use appendPQExpBufferStr when there are no parameters and appendPQExpBufferChar when the string length is 1. Author: David Rowley Discussion: https://postgr.es/m/caaphdvoarmvpexttc0hnparbhn-wgvstc8xfcymgozvgu_1...@mail.gmail.com Branch

pgsql: Doc: use "an SQL" consistently rather than "a SQL"

2025-04-13 Thread David Rowley
Doc: use "an SQL" consistently rather than "a SQL" Per the precedent set by 04539e73f, adjust article prefixes for "SQL" to use "an" consistently rather than "a", i.e., "an es-que-ell" rather than "a sequel". Both of these are new to v18. Also see b1b13d2b5, d866f0374 and 7bdd489d3. Branch -

pgsql: Add code comment explaining ins_since_vacuum and aborted inserts

2025-04-10 Thread David Rowley
ami Imseih Author: David Rowley Reviewed-by: Sami Imseih Discussion: https://postgr.es/m/caaphdvpgv3a-r2egmpoh0l-x3phbzpm3y4dyswfy+uquazw...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/530050d8d2850d0453bb56e2bfa7cae216ee8a18 Modi

pgsql: Improve various new-to-v18 appendStringInfo calls

2025-04-10 Thread David Rowley
Improve various new-to-v18 appendStringInfo calls Similar to 8461424fd, here we adjust a few new locations which were not using the most suitable appendStringInfo* function for the intended purpose. Author: David Rowley https://postgr.es/m/CAApHDvqJnNjueb=eoj8k+8n0g7nj_acpwsicj5rnv4fdeja

pgsql: Update wording in optimizer/README for EquivalenceClasses

2025-04-09 Thread David Rowley
to reflect the new storage location for child members. Reported-by: Amit Langote Author: Amit Langote Author: David Rowley Discussion: https://postgr.es/m/CA+HiwqE8v=EuAP_3F_A2xn8zWx+nG_etW_Fe_DvKO-Fkx=+d...@mail.gmail.com Branch -- master Details --- https

Re: pgsql: Rename argument in pg_get_process_memory_contexts().

2025-04-08 Thread David Rowley
On Wed, 9 Apr 2025 at 09:22, Daniel Gustafsson wrote: > Rename argument in pg_get_process_memory_contexts(). > src/include/catalog/pg_proc.dat | 2 +- I think this should have done a catversion bump. I suspect we'll get one soon enough, but you never know... David

pgsql: Speedup child EquivalenceMember lookup in planner

2025-04-07 Thread David Rowley
: David Rowley Reviewed-by: David Rowley Reviewed-by: Tom Lane Reviewed-by: Andrey Lepikhov Reviewed-by: Alena Rybakina Reviewed-by: Dmitry Dolgov <9erthali...@gmail.com> Reviewed-by: Amit Langote Reviewed-by: Ashutosh Bapat Tested-by: Thom Brown Tested-by: newtglobal postgresql_contri

Re: pgsql: Transfer statistics during pg_upgrade.

2025-04-07 Thread David Rowley
On Thu, 20 Feb 2025 at 22:29, Jeff Davis wrote: > Add support to pg_dump for dumping stats, and use that during > pg_upgrade so that statistics are transferred during upgrade. In most > cases this removes the need for a costly re-analyze after upgrade. I was surprised to see when I did pg_dump -T

Re: pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate

2025-04-07 Thread David Rowley
On Mon, 7 Apr 2025 at 19:39, Melanie Plageman wrote: > +++ > C:/cirrus/build/testrun/pg_upgrade/002_pg_upgrade/data/results/subselect.out > 2025-04-04 14:47:20.358393500 + > @@ -2769,15 +2769,16 @@ > EXPLAIN (COSTS OFF) > SELECT c.oid,c.relname FROM pg_class c JOIN pg_am a USING (oid) > WH

pgsql: Fix planner's failure to identify multiple hashable ScalarArrayO

2025-04-05 Thread David Rowley
Fix planner's failure to identify multiple hashable ScalarArrayOpExprs 50e17ad28 (v14) and 29f45e299 (v15) made it so the planner could identify IN and NOT IN clauses which have Const lists as right-hand arguments and when an appropriate hash function is available for the data types, mark the Scal

Re: pgsql: Add vacuum_truncate configuration parameter.

2025-04-05 Thread David Rowley
On Fri, 21 Mar 2025 at 04:30, Tom Lane wrote: > > Nathan Bossart writes: > > Since there's presently no way to determine whether a Boolean > > storage parameter is explicitly set or has just picked up the > > default value, this commit also introduces an isset_offset member > > to relopt_parse_el

pgsql: Doc: add information about partition locking

2025-04-05 Thread David Rowley
Doc: add information about partition locking The documentation around locking of partitions for the executor startup phase of run-time partition pruning wasn't clear about which partitions were being locked. Fix that. Reviewed-by: Tender Wang Discussion: https://postgr.es/m/CAApHDvp738G75HfkKc

Re: pgsql: Improve accounting for memory used by shared hash tables

2025-04-03 Thread David Rowley
On Thu, 3 Apr 2025 at 04:16, Tomas Vondra wrote: > Improve accounting for memory used by shared hash tables I've not looked into why, but this is causing an issue in the join_rel_hash during add_join_rel(). See the attached script. ERROR: pfree called with invalid pointer 0x60a15edc44e0 (header

pgsql: Doc: add information about partition locking

2025-04-01 Thread David Rowley
Doc: add information about partition locking The documentation around locking of partitions for the executor startup phase of run-time partition pruning wasn't clear about which partitions were being locked. Fix that. Reviewed-by: Tender Wang Discussion: https://postgr.es/m/CAApHDvp738G75HfkKc

pgsql: Doc: add information about partition locking

2025-04-01 Thread David Rowley
Doc: add information about partition locking The documentation around locking of partitions for the executor startup phase of run-time partition pruning wasn't clear about which partitions were being locked. Fix that. Reviewed-by: Tender Wang Discussion: https://postgr.es/m/CAApHDvp738G75HfkKc

pgsql: Doc: add information about partition locking

2025-04-01 Thread David Rowley
Doc: add information about partition locking The documentation around locking of partitions for the executor startup phase of run-time partition pruning wasn't clear about which partitions were being locked. Fix that. Reviewed-by: Tender Wang Discussion: https://postgr.es/m/CAApHDvp738G75HfkKc

pgsql: Doc: add information about partition locking

2025-04-01 Thread David Rowley
Doc: add information about partition locking The documentation around locking of partitions for the executor startup phase of run-time partition pruning wasn't clear about which partitions were being locked. Fix that. Reviewed-by: Tender Wang Discussion: https://postgr.es/m/CAApHDvp738G75HfkKc

pgsql: Doc: add information about partition locking

2025-04-01 Thread David Rowley
Doc: add information about partition locking The documentation around locking of partitions for the executor startup phase of run-time partition pruning wasn't clear about which partitions were being locked. Fix that. Reviewed-by: Tender Wang Discussion: https://postgr.es/m/CAApHDvp738G75HfkKc

pgsql: Fix planner's failure to identify multiple hashable ScalarArrayO

2025-04-01 Thread David Rowley
Fix planner's failure to identify multiple hashable ScalarArrayOpExprs 50e17ad28 (v14) and 29f45e299 (v15) made it so the planner could identify IN and NOT IN clauses which have Const lists as right-hand arguments and when an appropriate hash function is available for the data types, mark the Scal

pgsql: Fix planner's failure to identify multiple hashable ScalarArrayO

2025-04-01 Thread David Rowley
Fix planner's failure to identify multiple hashable ScalarArrayOpExprs 50e17ad28 (v14) and 29f45e299 (v15) made it so the planner could identify IN and NOT IN clauses which have Const lists as right-hand arguments and when an appropriate hash function is available for the data types, mark the Scal

pgsql: Fix planner's failure to identify multiple hashable ScalarArrayO

2025-04-01 Thread David Rowley
Fix planner's failure to identify multiple hashable ScalarArrayOpExprs 50e17ad28 (v14) and 29f45e299 (v15) made it so the planner could identify IN and NOT IN clauses which have Const lists as right-hand arguments and when an appropriate hash function is available for the data types, mark the Scal

pgsql: Fix planner's failure to identify multiple hashable ScalarArrayO

2025-04-01 Thread David Rowley
Fix planner's failure to identify multiple hashable ScalarArrayOpExprs 50e17ad28 (v14) and 29f45e299 (v15) made it so the planner could identify IN and NOT IN clauses which have Const lists as right-hand arguments and when an appropriate hash function is available for the data types, mark the Scal

pgsql: Fix failing regression test on x86-32 machines

2025-03-31 Thread David Rowley
Fix failing regression test on x86-32 machines 95d6e9af0 added code to display the tuplestore storage type for WindowAgg nodes and added a test to ensure the "Disk" storage method was working correctly by setting work_mem to 64 and running a test which caused the WindowAgg to go to disk. Seemingl

pgsql: Optimize Query jumble

2025-03-26 Thread David Rowley
Optimize Query jumble f31aad9b0 adjusted query jumbling so it no longer ignores NULL nodes during the jumble. This added some overhead. Here we tune a few things to make jumbling faster again. This makes jumbling perform similar or even slightly faster than prior to that change. Author: David

pgsql: Fix query jumbling to account for NULL nodes

2025-03-26 Thread David Rowley
jumble buffer. This fixes the issue as the order that the NULL is recorded isn't the same in the above two queries. Author: Bykov Ivan Author: Michael Paquier Author: David Rowley Discussion: https://postgr.es/m/aafce7966e234372b2ba876c0193f1e9%40localhost.localdomain Branch -- master De

pgsql: Add tests for POSITION(bytea, bytea)

2025-03-24 Thread David Rowley
Add tests for POSITION(bytea, bytea) Previously there was no coverage for this function. Author: Aleksander Alekseev Reviewed-by: Peter Smith Reviewed-by: Rustam ALLAKOV Discussion: https://postgr.es/m/caj7c6tmt6xcoomvkncd_tr2obdgcnjefsecdcv8jzky9vkw...@mail.gmail.com Branch -- master D

Re: pgsql: Add vacuum_truncate configuration parameter.

2025-03-23 Thread David Rowley
On Sat, 22 Mar 2025 at 05:40, David G. Johnston wrote: > Not seeing much point in trying to get rid of the on/off switch. It just > won't make sense to choose a tunable value of zero to disable something, and > probably should be prohibited. Can you explain what does not make sense about it?

pgsql: Simplify EXPLAIN code for Memoize

2025-03-20 Thread David Rowley
code. It seems like a good idea to fix this to help prevent future changes in this area from copying the same pattern. Author: Ilia Evdokimov Reported-by: David Rowley Discussion: https://postgr.es/m/88a71bcd-0b5c-4d0b-8107-757e96f40...@tantorlabs.com Branch -- master Details ---

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-03-20 Thread David Rowley
On Thu, 13 Mar 2025 at 21:33, Peter Eisentraut wrote: > Ok, this is weird, because we have pg_unreachable() support for MSVC: > > #if defined(HAVE__BUILTIN_UNREACHABLE) && !defined(USE_ASSERT_CHECKING) > #define pg_unreachable() __builtin_unreachable() > #elif defined(_MSC_VER) && !defined(USE_ASS

pgsql: Add b955df443 to .git-blame-ignore-revs

2025-03-12 Thread David Rowley
Add b955df443 to .git-blame-ignore-revs Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/cdc1471cc7626ffd44416abe92d37de038a0a0ec Modified Files -- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+)

pgsql: Fix indentation issue

2025-03-12 Thread David Rowley
Fix indentation issue Introduced recently by 9e088f7dd Per buildfarm member koel Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b955df443405e056fd9047ef819a1465654f9d79 Modified Files -- contrib/pg_logicalinspect/pg_logicalinspect.c | 2 +- 1 file chan

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-03-12 Thread David Rowley
On Wed, 12 Mar 2025 at 18:18, Tom Lane wrote: > I don't know of an easy way. I experimented with doing this: > > diff --git a/src/include/c.h b/src/include/c.h > index a14c6315162..467b1f58ae8 100644 > --- a/src/include/c.h > +++ b/src/include/c.h > @@ -315,7 +315,7 @@ > #elif defined(_MSC_VER)

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-03-12 Thread David Rowley
On Wed, 12 Mar 2025 at 21:15, Peter Eisentraut wrote: > > On 12.03.25 03:08, David Rowley wrote: > > This introduces a new compiler warning for compilers that don't know > > the ereport(ERROR) does not return. > > Which compiler is that? C:\Users\drowley\pg_src>c

Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

2025-03-11 Thread David Rowley
On Wed, 12 Mar 2025 at 05:57, Masahiko Sawada wrote: > contrib/pg_logicalinspect/pg_logicalinspect.c | 55 --- This introduces a new compiler warning for compilers that don't know the ereport(ERROR) does not return. The attached is enough to fix it. David fix_parse_snapshot_fi

pgsql: Fix incorrect #endif comment

2025-03-09 Thread David Rowley
Fix incorrect #endif comment Noticed while reading code in this area. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e033696596566d422a0eae47adca371a210ed730 Modified Files -- src/include/partitioning/partdesc.h | 2 +- 1 file changed, 1 insertion(+), 1

pgsql: Fix poorly written regression test

2025-02-18 Thread David Rowley
djust the tests added by that commit to use the t2 table instead. That's defined with a non-deferrable primary key. Author: songjinzhou Author: David Rowley Reviewed-by: Japin Li Discussion: https://postgr.es/m/tencent_cd414c79d39668455df80d35143b87634...@qq.com Branch -- master D

pgsql: Make verify_compact_attribute available in non-assert builds

2025-01-10 Thread David Rowley
that function being unavailable in core. To fix this, make verify_compact_attribute() available unconditionally, but make it do nothing unless building with USE_ASSERT_CHECKING. Author: Andrew Kane Reviewed-by: David Rowley Reviewed-by: Tom Lane Discussion: https://postgr.es/m

pgsql: Fix UNION planner datatype issue

2025-01-09 Thread David Rowley
Fix UNION planner datatype issue 66c0185a3 gave the planner the ability to have union child queries provide the union planner with pre-sorted input so that UNION queries could be more efficiently implemented using Merge Append. That commit overlooked checking that the UNION target list and the un

pgsql: Fix UNION planner datatype issue

2025-01-09 Thread David Rowley
Fix UNION planner datatype issue 66c0185a3 gave the planner the ability to have union child queries provide the union planner with pre-sorted input so that UNION queries could be more efficiently implemented using Merge Append. That commit overlooked checking that the UNION target list and the un

pgsql: Fix outdated CHUNKHDRSZ value in nodeAgg.c

2025-01-02 Thread David Rowley
Fix outdated CHUNKHDRSZ value in nodeAgg.c CHUNKHDRSZ was defined as 16 bytes, which was true when that code went in, but since c6e0fe1f2, 8 is a more accurate value. Here we adjust it to use sizeof(MemoryChunk), which is normally 8, or 16 for cassert builds. c6e0fe1f2 first appeared in v16, so

pgsql: Fix an assortment of spelling mistakes and typos

2025-01-01 Thread David Rowley
Fix an assortment of spelling mistakes and typos Author: Alexander Lakhin Discussion: https://postgr.es/m/5812a0b9-b0cf-4151-9a14-d9f00e4f2...@gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/11012c503759f8018d8831bc6eb1f998eba7ad25 Modified Files ---

pgsql: Fix overly large values/nulls arrays

2024-12-29 Thread David Rowley
Fix overly large values/nulls arrays These arrays were sized with Natts_pg_trigger (19) when they should have been sized with Natts_pg_event_trigger (7). We'd better fix this as it's clearly a mistake and it could become problematic if pg_event_trigger were to gain a dozen or so more columns in t

pgsql: Speedup tuple deformation with additional function inlining

2024-12-27 Thread David Rowley
emove comparisons for const-true ones. This commit has shown overall query performance increases of around 5-20% in deform-heavy OLAP-type workloads. Author: David Rowley Reviewed-by: Victor Yegorov Discussion: https://postgr.es/m/CAGnEbog92Og2CpC2S8=g_hozgswtt_3krs1sxjlz0jk

pgsql: Remove unused totalrows parameter in compute_expr_stats

2024-12-26 Thread David Rowley
Remove unused totalrows parameter in compute_expr_stats The totalrows parameter in compute_expr_stats is unused, so remove it. This is a static function, so the parameter can easily be added again if it's ever needed. Author: Ilia Evdokimov Discussion: https://postgr.es/m/667b92d2-f953-4fcb-937

pgsql: Fix race condition in TupleDescCompactAttr assert code

2024-12-23 Thread David Rowley
Fix race condition in TupleDescCompactAttr assert code 5983a4cff added CompactAttribute as an abbreviated alternative to FormData_pg_attribute to allow more cache-friendly processing in tasks related to TupleDescs. That commit contained some assert-only code to check that the CompactAttribute had

pgsql: Fix incorrect source filename references

2024-12-22 Thread David Rowley
Fix incorrect source filename references Jian He reported the src/include/utility/tcop.h one and the remainder were found by using a script to look for src/* and check that we have a filename or directory of that name. In passing, fix some out-date comments. Reported-by: Jian He Reviewed-by: To

pgsql: Optimize alignment calculations in tuple form/deform

2024-12-20 Thread David Rowley
imple arithmetic with some bit-twiddling. The removed branches were often mispredicted by CPUs, especially so in real-world tables which often contain a mishmash of different types with different alignment requirements. Author: David Rowley Reviewed-by: Andres Freund, Victor Yegorov Discussion:

pgsql: Remove pg_attribute.attcacheoff column

2024-12-20 Thread David Rowley
Remove pg_attribute.attcacheoff column The column is no longer needed as the offset is now cached in the CompactAttribute struct per commit 5983a4cff. Author: David Rowley Reviewed-by: Andres Freund, Victor Yegorov Discussion: https://postgr.es/m/CAApHDvrBztXP3yx=NKNmo3xwFAFhEdyPnvrDg3=m0rhds+4

pgsql: Introduce CompactAttribute array in TupleDesc, take 2

2024-12-20 Thread David Rowley
pg_attribute.attcacheoff redundant. A follow-on commit will remove it, thus shrinking the FormData_pg_attribute struct by 4 bytes. Author: David Rowley Reviewed-by: Andres Freund, Victor Yegorov Discussion: https://postgr.es/m/CAApHDvrBztXP3yx=NKNmo3xwFAFhEdyPnvrDg3=m0rhds+4...@mail.gmail.com Branch -- master

pgsql: Optimize grouping equality checks with virtual slots

2024-12-18 Thread David Rowley
adding the EEOP_INNER_FETCHSOME ExprEvalStep. This should increase the performance of hashed subplans very slightly. Author: Tom Lane, David Rowley Discussion: https://postgr.es/m/2543667.1734483...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: Fix Assert failure in WITH RECURSIVE UNION queries

2024-12-18 Thread David Rowley
Fix Assert failure in WITH RECURSIVE UNION queries If the non-recursive part of a recursive CTE ended up using TTSOpsBufferHeapTuple as the table slot type, then a duplicate value could cause an Assert failure in CheckOpSlotCompatibility() when checking the hash table for the duplicate value. The

pgsql: Fix Assert failure in WITH RECURSIVE UNION queries

2024-12-18 Thread David Rowley
Fix Assert failure in WITH RECURSIVE UNION queries If the non-recursive part of a recursive CTE ended up using TTSOpsBufferHeapTuple as the table slot type, then a duplicate value could cause an Assert failure in CheckOpSlotCompatibility() when checking the hash table for the duplicate value. The

pgsql: Fix Assert failure in WITH RECURSIVE UNION queries

2024-12-18 Thread David Rowley
Fix Assert failure in WITH RECURSIVE UNION queries If the non-recursive part of a recursive CTE ended up using TTSOpsBufferHeapTuple as the table slot type, then a duplicate value could cause an Assert failure in CheckOpSlotCompatibility() when checking the hash table for the duplicate value. The

pgsql: Fix Assert failure in WITH RECURSIVE UNION queries

2024-12-18 Thread David Rowley
Fix Assert failure in WITH RECURSIVE UNION queries If the non-recursive part of a recursive CTE ended up using TTSOpsBufferHeapTuple as the table slot type, then a duplicate value could cause an Assert failure in CheckOpSlotCompatibility() when checking the hash table for the duplicate value. The

pgsql: Fix Assert failure in WITH RECURSIVE UNION queries

2024-12-18 Thread David Rowley
Fix Assert failure in WITH RECURSIVE UNION queries If the non-recursive part of a recursive CTE ended up using TTSOpsBufferHeapTuple as the table slot type, then a duplicate value could cause an Assert failure in CheckOpSlotCompatibility() when checking the hash table for the duplicate value. The

pgsql: Fix Assert failure in WITH RECURSIVE UNION queries

2024-12-18 Thread David Rowley
Fix Assert failure in WITH RECURSIVE UNION queries If the non-recursive part of a recursive CTE ended up using TTSOpsBufferHeapTuple as the table slot type, then a duplicate value could cause an Assert failure in CheckOpSlotCompatibility() when checking the hash table for the duplicate value. The

pgsql: Fix incorrect slot type in BuildTupleHashTableExt

2024-12-17 Thread David Rowley
Fix incorrect slot type in BuildTupleHashTableExt 0f5738202 adjusted the execGrouping.c code so it made use of ExprStates to generate hash values. That commit made a wrong assumption that the slot type to pass to ExecBuildHash32FromAttrs() is always &TTSOpsMinimalTuple. That's not the case as the

pgsql: Detect redundant GROUP BY columns using UNIQUE indexes

2024-12-11 Thread David Rowley
h originally by Zhang Mingli and later worked on by jian he, but after I (David) worked on it, there was very little of the original left. Author: Zhang Mingli, jian he, David Rowley Reviewed-by: jian he, Andrei Lepikhov Discussion: https://postgr.es/m/327990c8-b9b2-4b0c-bffb-462249f82de0%

pgsql: Defer remove_useless_groupby_columns() work until query_planner(

2024-12-11 Thread David Rowley
Defer remove_useless_groupby_columns() work until query_planner() Traditionally, remove_useless_groupby_columns() was called during grouping_planner() directly after the call to preprocess_groupclause(). While in many ways, it made sense to populate the field and remove the functionally dependent

Re: pgsql: Enable BUFFERS with EXPLAIN ANALYZE by default

2024-12-11 Thread David Rowley
On Thu, 12 Dec 2024 at 08:13, Peter Geoghegan wrote: > FYI, I saw a harmless Cirrus CI failure which is likely tied to this > commit, affecting pg_stat_statements -- see attached diffs file. I had been holding off pushing the fix for that one until I could verify that was the last issue with a co

pgsql: Fix further fallout from EXPLAIN ANALYZE BUFFERS change

2024-12-11 Thread David Rowley
Fix further fallout from EXPLAIN ANALYZE BUFFERS change c2a4078eb adjusted EXPLAIN ANALYZE to default the BUFFERS to ON. This (hopefully) fixes the last remaining issue with regression test failures with -D RELCACHE_FORCE_RELEASE -D CATCACHE_FORCE_RELEASE builds, where the planner accesses more b

pgsql: Add missing BUFFERS OFF in regression tests, take 2

2024-12-11 Thread David Rowley
Add missing BUFFERS OFF in regression tests, take 2 Similar to 9fa1aaa65, but running with -D RELCACHE_FORCE_RELEASE and -D CATCACHE_FORCE_RELEASE yielded some additional missing places that needed BUFFERS OFF. Discussion: https://postgr.es/m/CANNMO++W7MM8T0KyXN3ZheXXt-uLVM3aEtZd+WNfZ=obxff...@m

pgsql: Add missing BUFFERS OFF in select_into regression tests

2024-12-11 Thread David Rowley
Add missing BUFFERS OFF in select_into regression tests c2a4078eb adjusted EXPLAIN ANALYZE to include BUFFERS by default, but a few tests in select_into.sql neglected to add BUFFERS OFF. The failing tests seem unlikely to ever access buffers during execution, but they certainly could during plann

pgsql: Enable BUFFERS with EXPLAIN ANALYZE by default

2024-12-11 Thread David Rowley
idea. There were two patches independently submitted to achieve this goal, one by me and the other by Guillaume. This commit is a mix of both of these patches with some additional work done by me to adjust various additional places in the documentation which include EXPLAIN ANALYZE output. Author: G

pgsql: Use ExprStates for hashing in GROUP BY and SubPlans

2024-12-10 Thread David Rowley
Use ExprStates for hashing in GROUP BY and SubPlans This speeds up obtaining hash values for GROUP BY and hashed SubPlans by using the ExprState support for hashing, thus allowing JIT compilation for obtaining hash values for these operations. This, even without JIT compilation, has been shown to

pgsql: Speedup Hash Joins with dedicated functions for ExprState hashin

2024-12-10 Thread David Rowley
Speedup Hash Joins with dedicated functions for ExprState hashing Hashing of a single Var is a very common operation for ExprState to perform. Here we add dedicated ExecJust* functions which helps speed up Hash Joins by removing the interpretation overhead in ExecInterpExpr(). This change curren

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

pgsql: Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes

2024-12-09 Thread David Rowley
Doc: fix incorrect EXPLAIN ANALYZE output for bloom indexes It looks like the example case was once modified to increase the number of rows but the EXPLAIN ANALYZE output wasn't updated to reflect that. Also adjust the text which discusses the index sizes. With the example table size, the bloom

  1   2   3   4   5   6   7   8   9   10   >