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

2023-03-05 Thread Michael Paquier
On Sat, Mar 04, 2023 at 09:47:05AM +0530, Bharath Rupireddy wrote: > Okay, here's a patch attached. Thanks. + * When source == XLOG_FROM_ANY, this function first searches for the segment + * with a TLI in archive first, if not found, it searches in pg_wal. This way, + * if there is a WAL segment

Re: add PROCESS_MAIN to VACUUM

2023-03-05 Thread Michael Paquier
On Wed, Mar 01, 2023 at 10:53:59PM -0800, Nathan Bossart wrote: > I don't feel a strong need for that, especially now that we aren't > modifying params anymore. That was mostly OK for me, so applied after tweaking a couple of places in the tests (extra explanations, for one), the comments and the

Re: shoud be get_extension_schema visible?

2023-03-05 Thread Michael Paquier
On Mon, Mar 06, 2023 at 08:34:49AM +0100, Pavel Stehule wrote: >> Note for other reviewers / committers: this is a something actually already >> wanted for 3rd party code. As an example, here's Pavel's code in >> plpgsql_check >> extension that internally has to duplicate this function (and deal

Re: psql: Add role's membership options to the \du+ command

2023-03-05 Thread Pavel Luzanov
On 03.03.2023 19:21, David G. Johnston wrote: I'd be fine with "pg_can_admin_role" being a newly created function that provides this true/false answer but it seems indisputable that today there is no core-provided means to answer the question "can one role get ADMIN rights on another role". 

Re: shoud be get_extension_schema visible?

2023-03-05 Thread Pavel Stehule
po 6. 3. 2023 v 8:33 odesílatel Julien Rouhaud napsal: > Hi, > > On Sun, Feb 19, 2023 at 06:40:39AM +0100, Pavel Stehule wrote: > > > > pá 17. 2. 2023 v 6:45 odesílatel Pavel Stehule > > napsal: > > > > > more times I needed to get the extension's assigned namespace. There is > > > already a

Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry

2023-03-05 Thread Drouvot, Bertrand
Hi, On 2/16/23 10:21 PM, Andres Freund wrote: Hi, On 2023-02-15 09:21:48 +0100, Drouvot, Bertrand wrote: diff --git a/src/backend/utils/activity/pgstat_relation.c b/src/backend/utils/activity/pgstat_relation.c index f793ac1516..b26e2a5a7a 100644 ---

using memoize in in paralel query decreases performance

2023-03-05 Thread Pavel Stehule
Hi In one query I can see very big overhead of memoize node - unfortunately with hits = 0 The Estimate is almost very good. See details in attachment Regards Pavel slow Description: Binary data

Re: shoud be get_extension_schema visible?

2023-03-05 Thread Julien Rouhaud
Hi, On Sun, Feb 19, 2023 at 06:40:39AM +0100, Pavel Stehule wrote: > > pá 17. 2. 2023 v 6:45 odesílatel Pavel Stehule > napsal: > > > more times I needed to get the extension's assigned namespace. There is > > already a cooked function get_extension_schema, but it is static. > > > > I need to

Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)

2023-03-05 Thread Kyotaro Horiguchi
At Mon, 06 Mar 2023 15:24:25 +0900 (JST), Kyotaro Horiguchi wrote in > In any case, I think we need to avoid such concurrent autovacuum/analyze. If it is correct, I believe the attached fix works. regads. -- Kyotaro Horiguchi NTT Open Source Software Center diff --git

Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher

2023-03-05 Thread Amit Kapila
On Mon, Mar 6, 2023 at 10:12 AM Peter Smith wrote: > > 4. IdxIsRelationIdentityOrPK > > +/* > + * Given a relation and OID of an index, returns true if the > + * index is relation's replica identity index or relation's > + * primary key's index. > + * > + * Returns false otherwise. > + */ > +bool

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-03-05 Thread Masahiko Sawada
On Fri, Mar 3, 2023 at 8:04 PM John Naylor wrote: > > On Wed, Mar 1, 2023 at 6:59 PM Masahiko Sawada wrote: > > > > On Wed, Mar 1, 2023 at 3:37 PM John Naylor > > wrote: > > > > > > I think we're trying to solve the wrong problem here. I need to study > > > this more, but it seems that code

Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)

2023-03-05 Thread Kyotaro Horiguchi
At Sat, 04 Mar 2023 18:21:09 -0500, Tom Lane wrote in > Andres Freund writes: > > Just pushed the actual pg_stat_io view, the splitting of the tablespace > > test, > > and the pg_stat_io tests. > > One of the test cases is flapping a bit: > > diff -U3 >

Inaccurate comment for pg_get_partkeydef

2023-03-05 Thread Japin Li
PSA patch to fix a comment inaccurate. -- Regrads, Japin Li. ChengDu WenWu Information Technology Co.,Ltd. diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 6dc117dea8..bcb493b56c 100644 --- a/src/backend/utils/adt/ruleutils.c +++

Re: Removing unneeded self joins

2023-03-05 Thread Michał Kłeczek
Hi All, I just wanted to ask about the status and plans for this patch. I can see it being stuck at “Waiting for Author” status in several commit tests. I think this patch would be really beneficial for us as we heavily use views to structure out code. Each view is responsible for providing

Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher

2023-03-05 Thread Peter Smith
Here are some review comments for v28-0001. == doc/src/sgml/logical-replication.sgml 1. A published table must have a replica identity configured in order to be able to replicate UPDATE and DELETE operations, so that appropriate rows to update or delete can be identified on the subscriber

Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes?

2023-03-05 Thread Michael Paquier
On Mon, Feb 20, 2023 at 01:54:00PM +0530, Bharath Rupireddy wrote: > I ran some tests on my dev system [1] and I don't see much difference > between v3 and v4. So, +1 for v3 patch (+ argument order swap) from > Andres to keep the code simple and elegant. This thread has stalled for a couple of

pg_rewind: Skip log directory for file type check like pg_wal

2023-03-05 Thread Soumyadeep Chakraborty
Hello hackers, I think we should extend the "log" directory the same courtesy as was done for pg_wal (pg_xlog) in 0e42397f42b. Today, even if BOTH source and target servers have symlinked "log" directories, pg_rewind fails with: file "log" is of different type in source and target. Attached is

Re: [PATCH] Add CANONICAL option to xmlserialize

2023-03-05 Thread Thomas Munro
On Mon, Mar 6, 2023 at 11:20 AM Jim Jones wrote: > On 05.03.23 22:00, Thomas Munro wrote: > > could be something to do with > > our environment, since .cirrus.yml sets LANG=C in the 32 bit test run > > -- maybe try that locally? > Also using LANGUAGE=C the result is the same for me - all tests

Re: Refactor to introduce pg_strcoll().

2023-03-05 Thread Thomas Munro
+/* Win32 does not have UTF-8, so we need to map to UTF-16 */ I wonder if this is still true. I think in Windows 10+ you can enable UTF-8 support. Then could you use strcoll_l() directly? I struggled to understand that, but I am a simple Unix hobbit from the shire so I dunno. (Perhaps the

Re: [PATCH] Add CANONICAL option to xmlserialize

2023-03-05 Thread Jim Jones
On 05.03.23 22:00, Thomas Munro wrote: The CI run for that failed in an interesting way, only on Debian + Meson, 32 bit. The diffs appear to show that psql has a different opinion of the column width, while building its header (the "--" you get at the top of psql's output), even though the

Re: Date-Time dangling unit fix

2023-03-05 Thread Joseph Koshakow
Also I removed some dead code from the previous patch. - Joe Koshakow From 2ff08d729bca87992514d0651fdb62455e43cd8a Mon Sep 17 00:00:00 2001 From: Joseph Koshakow Date: Sat, 10 Dec 2022 18:59:26 -0500 Subject: [PATCH] Remove unknown ISO format, handle dandling units This commit removes the date

Re: Date-Time dangling unit fix

2023-03-05 Thread Joseph Koshakow
On Sun, Mar 5, 2023 at 12:54 PM Tom Lane wrote: > > We do accept this: > > => select '12:34'::time; >time > -- > 12:34:00 > (1 row) > > so that must be going through a different code path, which I didn't > try to identify yet. That query will contain a single field of "12:34" with

Re: [PATCH] Add CANONICAL option to xmlserialize

2023-03-05 Thread Thomas Munro
On Mon, Mar 6, 2023 at 7:44 AM Jim Jones wrote: > The attached version includes documentation and tests to the patch. The CI run for that failed in an interesting way, only on Debian + Meson, 32 bit. The diffs appear to show that psql has a different opinion of the column width, while building

Re: Should vacuum process config file reload more often

2023-03-05 Thread Melanie Plageman
On Thu, Mar 2, 2023 at 6:37 PM Melanie Plageman wrote: > > On Thu, Mar 2, 2023 at 2:36 AM Masahiko Sawada wrote: > > > > On Thu, Mar 2, 2023 at 10:41 AM Melanie Plageman > > wrote: > > > On another topic, I've just realized that when autovacuuming we only > > > update

[PATCH] Add CANONICAL option to xmlserialize

2023-03-05 Thread Jim Jones
On 27.02.23 14:16, I wrote: Hi, In order to compare pairs of XML documents for equivalence it is necessary to convert them first to their canonical form, as described at W3C Canonical XML 1.1.[1] This spec basically defines a standard physical representation of xml documents that have more

Re: [Question] Similar Cost but variable execution time in sort

2023-03-05 Thread Ankit Kumar Pandey
On 05/03/23 22:21, Tom Lane wrote: Ankit Kumar Pandey writes: > From my observation, we only account for data in cost computation but > not number of columns sorted. > Should we not account for number of columns in sort as well? I'm not sure whether simply charging more for 2 sort

Re: Date-Time dangling unit fix

2023-03-05 Thread Tom Lane
[ I removed Lockhart, because he's taken no part in Postgres work for more than twenty years; if that address even still works, you're just bugging him ] Alexander Lakhin writes: > In fact, > SELECT time 'h04mm05s06'; > doesn't work for many years, but > SELECT time 'h04mm05s06.0'; > still

Re: zstd compression for pg_dump

2023-03-05 Thread Justin Pryzby
On Sat, Feb 25, 2023 at 07:22:27PM -0600, Justin Pryzby wrote: > On Fri, Feb 24, 2023 at 01:18:40PM -0600, Justin Pryzby wrote: > > This is a draft patch - review is welcome and would help to get this > > ready to be considererd for v16, if desired. > > > > I'm going to add this thread to the old

Re: [Question] Similar Cost but variable execution time in sort

2023-03-05 Thread Tom Lane
Ankit Kumar Pandey writes: > From my observation, we only account for data in cost computation but > not number of columns sorted. > Should we not account for number of columns in sort as well? I'm not sure whether simply charging more for 2 sort columns than 1 would help much. The traditional

Re: Date-Time dangling unit fix

2023-03-05 Thread Joseph Koshakow
Attached is a patch for removing the discussed format of date-times. From f35284762c02ed466496e4e562b5f95a884b5ef1 Mon Sep 17 00:00:00 2001 From: Joseph Koshakow Date: Sat, 10 Dec 2022 18:59:26 -0500 Subject: [PATCH] Remove unknown ISO format, handle dandling units This commit removes the date

Re: SQL JSON path enhanced numeric literals

2023-03-05 Thread Peter Eisentraut
On 03.03.23 21:16, Dean Rasheed wrote: I think this new feature ought to be mentioned in the docs somewhere. Perhaps a sentence or two in the note below table 9.49 would suffice, since it looks like that's where jsonpath numbers are mentioned for the first time. Done. I actually put it into

Re: How does pg implement the visiblity of one tuple for specified transaction?

2023-03-05 Thread Ankit Kumar Pandey
Hi Jacktby, Did you try looking at HeapTupleSatisfiesVisibility function (in src/backend/access/heap/heapam_visibility.c) ? I think it might give you some idea. Thanks, Ankit

Re: Date-Time dangling unit fix

2023-03-05 Thread Alexander Lakhin
Hello, 05.03.2023 02:31, Joseph Koshakow wrote: I also don't have a copy of ISO 8601 and wasn't able to find anything about this variant on Google. I did find this comment in datetime.c /* * Was this an "ISO date" with embedded field labels? An * example is "y2001m02d04" - thomas 2001-02-04 */

How does pg implement the visiblity of one tuple for specified transaction?

2023-03-05 Thread jack...@gmail.com
Suppose there is a transaction running, how it knows the tuples that are visible for it? jack...@gmail.com

[Question] Similar Cost but variable execution time in sort

2023-03-05 Thread Ankit Kumar Pandey
Hi, This was noticed in https://www.postgresql.org/message-id/caaphdvo2y9s2ao-bpyo7gmpyd0xe2lo-kflnqx80fcftqbc...@mail.gmail.com I am bringing it up again. Consider the following example: Setup (tuple should be in memory to avoid overshadowing of disk I/O in the experimentation):

Re: Missing free_var() at end of accum_sum_final()?

2023-03-05 Thread Joel Jacobson
On Fri, Mar 3, 2023, at 16:11, Dean Rasheed wrote: > Attachments: > * make-result-using-vars-buf-v2.patch One suggestion: maybe add a comment explaining why the allocated buffer which size is based on strlen(cp) for the decimal digit values, is guaranteed to be large enough also for the result's

Re: [Proposal] Allow pg_dump to include all child tables with the root table

2023-03-05 Thread Gilles Darold
Le 04/03/2023 à 19:18, Tom Lane a écrit : Gilles Darold writes: But I disagree the use of --table-with-childs and --exclude-table-with-childs because we already have the --table and --exclude-table, and it will add lot of code where we just need a switch to include children tables. I quite