Re: Some regression tests for the pg_control_*() functions

2022-10-25 Thread Bharath Rupireddy
On Tue, Oct 25, 2022 at 11:07 AM Michael Paquier wrote: > > Hi all, > > As mentioned in [1], there is no regression tests for the SQL control > functions: pg_control_checkpoint, pg_control_recovery, > pg_control_system and pg_control_init. > > It would be minimal to check their execution, as of a

Re: proposal: possibility to read dumped table's name from file

2022-10-25 Thread Pavel Stehule
Hi út 18. 10. 2022 v 11:33 odesílatel Julien Rouhaud napsal: > On Thu, Oct 13, 2022 at 11:46:34AM -0700, Andres Freund wrote: > > Hi, > > > > On 2022-10-07 07:26:08 +0200, Pavel Stehule wrote: > > > I am sending version with handy written parser and meson support > > > > Given this is a new

Re: Allow file inclusion in pg_hba and pg_ident files

2022-10-25 Thread Michael Paquier
On Wed, Oct 26, 2022 at 11:19:48AM +0800, Julien Rouhaud wrote: > That wouldn't be overdoing anymore if we remove the line number / filename > from > the fill_*_line prototypes right? Yeah, but there is a twist: HbaLine or IdentLine can be passed as NULL when entering in fill_hba_line() or

Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()

2022-10-25 Thread Bharath Rupireddy
On Tue, Oct 18, 2022 at 1:03 PM Amul Sul wrote: > > On Tue, Oct 18, 2022 at 12:01 PM Bharath Rupireddy > wrote: > > > > Hi, > > > > In standby mode, the state machine in WaitForWALToBecomeAvailable() > > reads WAL from pg_wal after failing to read from the archive. This is > > currently

Re: Allow file inclusion in pg_hba and pg_ident files

2022-10-25 Thread Julien Rouhaud
On Tue, Oct 25, 2022 at 08:59:57PM +0900, Michael Paquier wrote: > > Hmm. I would be tempted to keep track of the file name and the line > number as well in IdentLine. One reason is that this can become > useful for debugging. A second is that this can reduce a bit the > arguments of

Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options

2022-10-25 Thread David Rowley
On Sun, 23 Oct 2022 at 03:03, Vik Fearing wrote: > Shouldn't it be able to detect that these two windows are the same and > only do one WindowAgg pass? > > > explain (verbose, costs off) > select row_number() over w1, > lag(amname) over w2 > from pg_am > window w1 as (order by amname), >

Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering

2022-10-25 Thread Michael Paquier
On Tue, Oct 25, 2022 at 09:37:08AM +0200, Alvaro Herrera wrote: > Okay, so if we follow this argument, then the logical conclusion is that > this *should* be backpatched, after all. After sleeping on it and looking at all the stable branches involved, backpatched down to v10. -- Michael

Re: [PATCH] Fix build with LLVM 15 or above

2022-10-25 Thread Thomas Munro
On Wed, Oct 26, 2022 at 4:28 AM Devrim Gündüz wrote: > On Tue, 2022-10-18 at 22:06 +1300, Thomas Munro wrote: > > Will do first thing tomorrow. > > Just wanted to confirm that I pushed Fedora RPMs built against LLVM 15 > by adding these patches. > > Thanks Thomas. Cool. FTR I still have to

Re: parse partition strategy string in gram.y

2022-10-25 Thread Alvaro Herrera
On 2022-Oct-26, Alvaro Herrera wrote: > On 2022-Oct-25, Finnerty, Jim wrote: > > > Or if you know the frequencies of the highly frequent values of the > > partitioning key at the time the partition bounds are defined, you > > could define hash ranges that contain approximately the same number of

Re: parse partition strategy string in gram.y

2022-10-25 Thread Alvaro Herrera
On 2022-Oct-25, Finnerty, Jim wrote: > Or if you know the frequencies of the highly frequent values of the > partitioning key at the time the partition bounds are defined, you > could define hash ranges that contain approximately the same number of > rows in each partition. A parallel sequential

Re: [PATCH] CF app: add "Returned: Needs more interest"

2022-10-25 Thread Jacob Champion
On Mon, Aug 8, 2022 at 8:45 AM Andres Freund wrote: > On 2022-08-08 08:37:41 -0700, Jacob Champion wrote: > > Agreed. This probably bleeds over into the other documentation thread > > a bit -- how do we want to communicate the subtle points to people in > > a CF? > > We should write a docs patch

Re: [PATCH] Improve tab completion for ALTER TABLE on identity columns

2022-10-25 Thread Matheus Alcantara
> Hi Hackers, > > I noticed that psql has no tab completion around identity columns in > ALTER TABLE, so here's some patches for that. > > In passing, I also added completion for ALTER SEQUECNE … START, which was > missing for some reason. > > - ilmari Hi ilmari I've tested all 4 of your

Reducing duplicativeness of EquivalenceClass-derived clauses

2022-10-25 Thread Tom Lane
While fooling with my longstanding outer-join variables changes (I am making progress on that, honest), I happened to notice that equivclass.c is leaving some money on the table by generating redundant RestrictInfo clauses. It already attempts to not generate the same clause twice, which can save

Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert

2022-10-25 Thread Jacob Champion
On Tue, Oct 25, 2022 at 7:26 AM Andrew Dunstan wrote: > I don't find too much difficulty in having one option's default depend > on another's value, as long as it's documented. My patch is definitely missing the documentation for that part right now; I wanted to get feedback on the approach

Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert

2022-10-25 Thread Jacob Champion
On Tue, Oct 25, 2022 at 4:01 AM wrote: > Yeah I agree that not forcing verify-full when using system CAs is a > giant foot-gun, and many will stop configuring just until it works. > > Is there any argument for not checking hostname when using a CA pool > for which literally anyone can create a

Re: GUC values - recommended way to declare the C variables?

2022-10-25 Thread Justin Pryzby
+#ifdef USE_ASSERT_CHECKING + sanity_check_GUC_C_var(hentry->gucvar); +#endif => You can conditionally define that as an empty function so #ifdefs aren't needed in the caller: void sanity_check_GUC_C_var() { #ifdef USE_ASSERT_CHECKING ... #endif } + /* Skip checking

Re: Confused about TransactionIdSetTreeStatus

2022-10-25 Thread Heikki Linnakangas
On 25/10/2022 18:09, Japin Li wrote: On Tue, 25 Oct 2022 at 22:46, Heikki Linnakangas wrote: On 25/10/2022 12:02, Japin Li wrote: However, the code marks the main transaction and subtransactions directly to the committed. Hmm, yeah, step 2 in this example doesn't match reality. We actually

Re: Add tracking of backend memory allocated to pg_stat_activity

2022-10-25 Thread Reid Thompson
On Tue, 2022-10-25 at 14:51 -0400, Reid Thompson wrote: > patch rebased to current master > actually attach the patch -- Reid Thompson Senior Software Engineer Crunchy Data, Inc. reid.thomp...@crunchydata.com www.crunchydata.com From ab654a48ec7bfbc3bc377c5757a04f1756e72e79 Mon Sep 17 00:00:00

Re: Add tracking of backend memory allocated to pg_stat_activity

2022-10-25 Thread Reid Thompson
patch rebased to current master -- Reid Thompson Senior Software Engineer Crunchy Data, Inc. reid.thomp...@crunchydata.com www.crunchydata.com

Re: parse partition strategy string in gram.y

2022-10-25 Thread Finnerty, Jim
Or if you know the frequencies of the highly frequent values of the partitioning key at the time the partition bounds are defined, you could define hash ranges that contain approximately the same number of rows in each partition. A parallel sequential scan of all partitions would then perform

Re: Add the ability to limit the amount of memory that can be allocated to backends.

2022-10-25 Thread Reid Thompson
Hi Arne, On Mon, 2022-10-24 at 15:27 +, Arne Roland wrote: > Hello Reid, > > could you rebase the patch again? It doesn't apply currently > (http://cfbot.cputube.org/patch_40_3867.log). Thanks! rebased patches attached. > You mention, that you want to prevent the compiler from getting >

Re: [PATCH] Fix build with LLVM 15 or above

2022-10-25 Thread Devrim Gündüz
Hi, On Tue, 2022-10-18 at 22:06 +1300, Thomas Munro wrote: > Will do first thing tomorrow. Just wanted to confirm that I pushed Fedora RPMs built against LLVM 15 by adding these patches. Thanks Thomas. Regards, -- Devrim Gündüz Open Source Solution Architect, Red Hat Certified Engineer

Re: Confused about TransactionIdSetTreeStatus

2022-10-25 Thread Japin Li
On Tue, 25 Oct 2022 at 22:46, Heikki Linnakangas wrote: > On 25/10/2022 12:02, Japin Li wrote: >> However, the code marks the main transaction and subtransactions directly >> to the committed. > > Hmm, yeah, step 2 in this example doesn't match reality. We actually > set t and t1 directly as

Re: [PATCHES] Post-special page storage TDE support

2022-10-25 Thread David Christensen
> > Explicitly > > locking (assuming you stay in your lane) should only need to guard > > against access from other > > backends of this type if using shared buffers, so will be use-case > > dependent. > > I'm not sure what you mean here? I'm mainly pointing out that the specific code that

Re: Confused about TransactionIdSetTreeStatus

2022-10-25 Thread Heikki Linnakangas
On 25/10/2022 12:02, Japin Li wrote: I'm a bit confused about TransactionIdSetTreeStatus, the comment says if subtransactions cross multiple CLOG pages, it will mark the subxids, that are on the same page as the main transaction, as sub-committed, and then set main transaction and

Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert

2022-10-25 Thread Andrew Dunstan
On 2022-10-25 Tu 07:01, tho...@habets.se wrote: > On Tue, 25 Oct 2022 01:03:23 +0100, Jacob Champion > said: >> I'd like to try to get this conversation started again. To pique >> interest I've attached a new version of 0001, which implements >> `sslrootcert=system` instead as suggested

Re: Fix gin index cost estimation

2022-10-25 Thread Tom Lane
Alexander Korotkov writes: > I think Tom's point was that it's wrong to add a separate entry-tree CPU > cost estimation to another estimation, which tries (very inadequately) to > estimate the whole scan cost. Instead, I propose writing better estimations > for both entry-tree CPU cost and

Re: parse partition strategy string in gram.y

2022-10-25 Thread Finnerty, Jim
It will often happen that some hash keys are more frequently referenced than others. Consider a scenario where customer_id is the hash key, and one customer is very large in terms of their activity, like IBM, and other keys have much less activity. This asymmetry creates a noisy neighbor

Re: Fix gin index cost estimation

2022-10-25 Thread Alexander Korotkov
Hi, Ronan! On Wed, Oct 12, 2022 at 10:15 AM Ronan Dunklau wrote: > > > You're right, I was too eager to try to raise the CPU cost proportionnally > to > > > the number of array scans (scalararrayop). I'd really like to understand > where > > > this equation comes from though... > > > > So,

Re: [PATCH] Add `verify-system` sslmode to use system CA pool for server cert

2022-10-25 Thread thomas
On Tue, 25 Oct 2022 01:03:23 +0100, Jacob Champion said: > I'd like to try to get this conversation started again. To pique > interest I've attached a new version of 0001, which implements > `sslrootcert=system` instead as suggested upthread. In 0002 I went > further and switched the default

Re: explain_regress, explain(MACHINE), and default to explain(BUFFERS) (was: BUFFERS enabled by default in EXPLAIN (ANALYZE))

2022-10-25 Thread Laurenz Albe
On Thu, 2022-10-20 at 21:09 -0500, Justin Pryzby wrote: > Rebased. I had a look at the patch set. It applies and builds cleanly and passes the regression tests. 0001: Add GUC: explain_regress I like the idea of the "explain_regress" GUC. That should simplify the regression tests. ---

Re: Allow file inclusion in pg_hba and pg_ident files

2022-10-25 Thread Michael Paquier
On Tue, Oct 25, 2022 at 03:08:59PM +0800, Julien Rouhaud wrote: > On Tue, Oct 25, 2022 at 03:43:21PM +0900, Michael Paquier wrote: >> Another advantage is that it minimizes the presence of the hardcoded >> HbaFileName and IdentFileName in hba.c, which is one thing we are >> trying to achieve here

Re: Question about "compound" queries.

2022-10-25 Thread Anton A. Melnikov
Thanks a lot for the reply and timely help! On 25.10.2022 01:36, David G. Johnston wrote: I suspect they came about out of simplicity - being able to simply take a text file with a bunch of SQL commands in a script and send them as-is to the server without any client-side parsing and let the

Re: Make EXPLAIN generate a generic plan for a parameterized query

2022-10-25 Thread Julien Rouhaud
Hi, On Tue, Oct 25, 2022 at 11:08:27AM +0200, Laurenz Albe wrote: > > Here is a patch that > implements it with an EXPLAIN option named GENERIC_PLAN. I only have a quick look at the patch for now. Any reason why you don't rely on the existing explain_filter() function for emitting stable output

Re: Make EXPLAIN generate a generic plan for a parameterized query

2022-10-25 Thread Laurenz Albe
On Wed, 2022-10-12 at 00:03 +0800, Julien Rouhaud wrote: > On Tue, Oct 11, 2022 at 09:49:14AM -0400, Tom Lane wrote: > > I think it might be better to drive it off an explicit EXPLAIN option, > > perhaps > > > > EXPLAIN (GENERIC_PLAN) SELECT * FROM tab WHERE col = $1; > > > > If you're trying to

Confused about TransactionIdSetTreeStatus

2022-10-25 Thread Japin Li
Hi, hackers I'm a bit confused about TransactionIdSetTreeStatus, the comment says if subtransactions cross multiple CLOG pages, it will mark the subxids, that are on the same page as the main transaction, as sub-committed, and then set main transaction and subtransactions to committed (step 2).

Re: Proposal: Adding isbgworker column to pg_stat_activity

2022-10-25 Thread Alvaro Herrera
Hello, I just noticed that this proposal from 2020 didn't get any backers: On 2020-Dec-01, Paul Martinez wrote: > It is currently slightly difficult to determine how many background worker > processes are currently running, which is useful when trying to manage > the max_worker_processes

Re: fixing typo in comment for restriction_is_or_clause

2022-10-25 Thread Richard Guo
On Tue, Oct 25, 2022 at 3:37 PM Alvaro Herrera wrote: > On 2022-Oct-25, Richard Guo wrote: > > > Agree with your point. Do you think we can further make the one-line > > function a macro or an inline function in the .h file? > > We can, but should we? > > > I think this function is called quite

Re: fixing typo in comment for restriction_is_or_clause

2022-10-25 Thread Richard Guo
On Tue, Oct 25, 2022 at 2:25 PM John Naylor wrote: > > On Tue, Oct 25, 2022 at 9:48 AM Richard Guo > wrote: > > > > > > On Tue, Oct 25, 2022 at 10:05 AM John Naylor < > john.nay...@enterprisedb.com> wrote: > >> > >> It's perfectly clear and simple now, even if it doesn't win at "code > golf". >

Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering

2022-10-25 Thread Alvaro Herrera
On 2022-Oct-25, Tom Lane wrote: > Michael Paquier writes: > > On Mon, Oct 24, 2022 at 02:22:16PM +0200, Alvaro Herrera wrote: > >> I confess I don't understand why is it important that XLogBeginInsert is > >> called inside the critical section. It seems to me that that part is > >> only a

Re: fixing typo in comment for restriction_is_or_clause

2022-10-25 Thread Alvaro Herrera
On 2022-Oct-25, Richard Guo wrote: > Agree with your point. Do you think we can further make the one-line > function a macro or an inline function in the .h file? We can, but should we? > I think this function is called quite frequently during planning, so > maybe doing that would bring a

Re: Allow file inclusion in pg_hba and pg_ident files

2022-10-25 Thread Julien Rouhaud
On Tue, Oct 25, 2022 at 03:43:21PM +0900, Michael Paquier wrote: > > Another advantage is that it minimizes the presence of the hardcoded > HbaFileName and IdentFileName in hba.c, which is one thing we are > trying to achieve here for the inclusion of more files. I found a bit > strange that

Re: Allow file inclusion in pg_hba and pg_ident files

2022-10-25 Thread Michael Paquier
On Mon, Oct 24, 2022 at 04:03:03PM +0800, Julien Rouhaud wrote: > It would also require to bring HbaLine->sourcefile. I'm afraid it would be > weird to introduce such a refactoring in a separate commit just to pass a > constant down multiple level of indirection, as all the macro will remain >

Re: Perform streaming logical transactions by background workers and parallel apply

2022-10-25 Thread Peter Smith
FYI - After a recent push, the v40-0001 patch no longer applies on the latest HEAD. [postgres@CentOS7-x64 oss_postgres_misc]$ git apply ../patches_misc/v40-0001-Perform-streaming-logical-transactions-by-parall.patch error: patch failed: src/backend/replication/logical/launcher.c:54 error:

Re: fixing typo in comment for restriction_is_or_clause

2022-10-25 Thread John Naylor
On Tue, Oct 25, 2022 at 9:48 AM Richard Guo wrote: > > > On Tue, Oct 25, 2022 at 10:05 AM John Naylor wrote: >> >> It's perfectly clear and simple now, even if it doesn't win at "code golf". > > > Agree with your point. Do you think we can further make the one-line > function a macro or an

Re: GUC values - recommended way to declare the C variables?

2022-10-25 Thread Peter Smith
On Tue, Oct 25, 2022 at 4:09 PM Michael Paquier wrote: > > On Tue, Oct 25, 2022 at 02:43:43PM +1100, Peter Smith wrote: > > This is essentially the same as before except now, utilizing the > > GUC_DEFAULT_COMPILE flag added by Justin's patch [1], the sanity-check > > skips over any dynamic