pgsql: Doc: fix missing comma at the end of a line.

2025-04-17 Thread Tatsuo Ishii
Doc: fix missing comma at the end of a line. Backpatch to 17, where the line was added. Reported by Noboru Saito while he was working on translating the file into Japanese. Discussion: https://postgr.es/m/20250417.203047.1321297410457834775.ishii%40postgresql.org Reported-by: Noboru Saito Revi

pgsql: Doc: fix missing comma at the end of a line.

2025-04-17 Thread Tatsuo Ishii
Doc: fix missing comma at the end of a line. Backpatch to 17, where the line was added. Reported by Noboru Saito while he was working on translating the file into Japanese. Discussion: https://postgr.es/m/20250417.203047.1321297410457834775.ishii%40postgresql.org Reported-by: Noboru Saito Revi

pgsql: Fixup various older misuses of appendPQExpBuffer

2025-04-17 Thread David Rowley
Fixup various older misuses of appendPQExpBuffer Use appendPQExpBufferStr when there are no parameters and appendPQExpBufferChar when the string length is 1. Unlike 3fae25cbb, which fixed this issue for code that was new to v18, this one fixes up instances which exist in the backbranches. We've

pgsql: Suppress "may be used uninitialized" warnings from older compile

2025-04-17 Thread Tom Lane
Suppress "may be used uninitialized" warnings from older compilers. The "children" list won't be used until "got_children" has been set true, but older compilers don't get that; about half a dozen buildfarm animals are warning about this. Issue added by 11ff192b5. While here, improve slightly-sh

pgsql: Portability fix: isdigit() must be passed an unsigned char.

2025-04-17 Thread Tom Lane
Portability fix: isdigit() must be passed an unsigned char. Oversight in commit 40b9c2701, per buildfarm member mamba. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4aad2cb7707dfb239eaaad29a8a7155027d8e8b8 Modified Files -- src/bin/pg_dump/pg_restore.

Re: pgsql: Make SQLFunctionCache long-lived again.

2025-04-17 Thread Tom Lane
I wrote: > Make SQLFunctionCache long-lived again. Drat ... immediately after pushing these patches, I realized I'd forgotten to adjust the commit messages to include a discussion link. For the archives' sake: Discussion: https://postgr.es/m/1112592.1744572...@sss.pgh.pa.us

pgsql: Minor performance improvement for SQL-language functions.

2025-04-17 Thread Tom Lane
Minor performance improvement for SQL-language functions. Late in the development of commit 0dca5d68d, I added a step to copy the result tlist we extract from the cached final query, because I was afraid that that might not last as long as the JunkFilter that we're passing it off to. However, tha

pgsql: Make SQLFunctionCache long-lived again.

2025-04-17 Thread Tom Lane
Make SQLFunctionCache long-lived again. At this point, the only data structures we allocate directly in fcontext are the SQLFunctionCache struct itself, the ParamListInfo struct, and the execution_state array, all of which are small and perfectly capable of being re-used across executions of the s

pgsql: Cache typlens of a SQL function's input arguments.

2025-04-17 Thread Tom Lane
Cache typlens of a SQL function's input arguments. This gets rid of repetitive get_typlen calls in postquel_sub_params, which show up as costing a few percent of the runtime in simple test cases (more with more parameters). In combination with the preceding patches, this gets us most of the way b

pgsql: Split some storage out to separate subcontexts of fcontext.

2025-04-17 Thread Tom Lane
Split some storage out to separate subcontexts of fcontext. Put the JunkFilter and its result slot (and thence also some subsidiary data such as the result tupledesc) into a separate subcontext "jfcontext". This doesn't accomplish a lot at this point, because we make a new JunkFilter each time th

pgsql: Make functions.c mostly run in a short-lived memory context.

2025-04-17 Thread Tom Lane
Make functions.c mostly run in a short-lived memory context. Previously, much of this code ran with CurrentMemoryContext set to be the function's fcontext, so that we tended to leak a lot of stuff there. Commit 0dca5d68d dealt with that by releasing the fcontext at the completion of each SQL func

pgsql: Assert lack of hazardous buffer locks before possible catalog re

2025-04-17 Thread Noah Misch
Assert lack of hazardous buffer locks before possible catalog read. Commit 0bada39c83a150079567a6e97b1a25a198f30ea3 fixed a bug of this kind, which existed in all branches for six days before detection. While the probability of reaching the trouble was low, the disruption was extreme. No new bac

pgsql: pg_dump: Set private_date pointer to NULL in callback

2025-04-17 Thread Daniel Gustafsson
pg_dump: Set private_date pointer to NULL in callback The end callback for ZStandard compression frees the private_data but didn't set the pointer to NULL after freeing. This is not a bug as the code is right now, since nothing is dereferencing the pointer upon returning from the callback but it