Re: logical decoding bug: segfault in ReorderBufferToastReplace()

2021-06-04 Thread Amit Kapila
On Sat, Jun 5, 2021 at 5:05 AM Alvaro Herrera wrote: > > On 2021-Jun-04, Jeremy Schneider wrote: > > > ERROR: XX000: could not open relation with OID 0 > > LOCATION: ReorderBufferToastReplace, reorderbuffer.c:305 > > Hah. > > It seems to me that this code should silently return if > rd_rel->reltoa

Re: A new function to wait for the backend exit after termination

2021-06-04 Thread Bharath Rupireddy
On Sat, Jun 5, 2021 at 7:02 AM Noah Misch wrote: > > On Tue, Jun 01, 2021 at 01:25:24PM +0530, Bharath Rupireddy wrote: > > On Tue, Jun 1, 2021 at 9:19 AM Noah Misch wrote: > > > Given that limitation, is pg_wait_for_backend_termination() useful > > > enough? If > > > waiting for procarray depa

Re: libpq debug log

2021-06-04 Thread Noah Misch
On Fri, Apr 09, 2021 at 05:16:11PM -0400, Alvaro Herrera wrote: > Pushed now. This added a PQtraceSetFlags() function. We have a dozen PQset*() functions, but this and PQresultSetInstanceData() are the only PQSomethingSet() functions. Is it okay if I rename it to PQsetTraceFlags()? I think that

Re: Are we missing (void) when return value of fsm_set_and_search is ignored?

2021-06-04 Thread Bharath Rupireddy
On Sat, Jun 5, 2021 at 1:38 AM Peter Eisentraut wrote: > > On 04.06.21 06:28, Julien Rouhaud wrote: > > Yes, but we have a lot a examples of functions without pg_nodiscard and > > callers > > still explicitly ignoring the results, like fsm_vacuum_page() in the same > > file. > > It would be more

Re: Python 3.10 breaks regression tests with traceback changes

2021-06-04 Thread Peter Eisentraut
On 24.05.21 17:52, Honza Horak wrote: Anybody had a chance to look at the proposed patch? Patch applied to master. I suppose we should backpatch this. Honza On Tue, May 11, 2021 at 11:31 PM Honza Horak > wrote: I missed Tom already started the thread, so jus

Fix a few typos in brin_minmax_multi.c

2021-06-04 Thread David Rowley
Hi, During a recent cleanup of brin_minmax_multi.c I noticed a few typos. I've attached a patch to fix these. I originally buried this in [1], but think it's likely better to have a proper thread for it. The patch does change some comments which reference parameter or variable names. I hope that

Re: alter table set TABLE ACCESS METHOD

2021-06-04 Thread Michael Paquier
On Fri, Jun 04, 2021 at 05:34:36PM -0700, Jeff Davis wrote: > I agree that a dummy AM would be good, but implementing even a dummy AM > is a fair amount of work. Not much, honestly, the largest part being to document that properly so as it could be used as a template: https://www.postgresql.org/me

Re: installcheck failure in indirect_toast with default_toast_compression = lz4

2021-06-04 Thread Michael Paquier
On Fri, Jun 04, 2021 at 08:28:59PM -0400, Tom Lane wrote: > Hmm. I'm not very clear on what that test is intending to test, > but maybe it's dependent on pglz compression, in which case the > right fix would be to force default_toast_compression = pglz > for the duration of the test. Support for

Re: A new function to wait for the backend exit after termination

2021-06-04 Thread Noah Misch
On Tue, Jun 01, 2021 at 01:25:24PM +0530, Bharath Rupireddy wrote: > On Tue, Jun 1, 2021 at 9:19 AM Noah Misch wrote: > > Given that limitation, is pg_wait_for_backend_termination() useful enough? > > If > > waiting for procarray departure is enough, should > > pg_wait_until_termination() > > c

Re: Make unlogged table resets detectable

2021-06-04 Thread Jeff Davis
On Fri, 2021-06-04 at 09:42 +0300, Heikki Linnakangas wrote: > I'd suggest using a counter rather than a flag. With a flag, if one > client clears the flag to acknowledge that a truncation happened, > others > might miss it. See also ABA problem. This feels like it's getting more complex. Stepp

Re: alter table set TABLE ACCESS METHOD

2021-06-04 Thread Jeff Davis
On Sat, 2021-06-05 at 08:45 +0900, Michael Paquier wrote: > One thing I am wondering is if we should have a dummy_table_am in > src/test/modules/ to be able to stress more this feature. That does > not seem like a hard requirement, but relying only on heap limits a > bit the coverage of this featu

Re: installcheck failure in indirect_toast with default_toast_compression = lz4

2021-06-04 Thread Tom Lane
Michael Paquier writes: > The issue is that the ordering of the tuples returned by UPDATE > RETURNING is not completely stable. Perhaps we should just enforce > the order of those tuples by wrapping the DMLs into a CTE and use an > ORDER BY in the outer query. Hmm. I'm not very clear on what th

installcheck failure in indirect_toast with default_toast_compression = lz4

2021-06-04 Thread Michael Paquier
Hi all, As said in $subject, installcheck fails once I set up a server with default_toast_compression = lz4 in the test indirect_toast. Please see the attached for the diffs. The issue is that the ordering of the tuples returned by UPDATE RETURNING is not completely stable. Perhaps we should ju

Re: logical decoding bug: segfault in ReorderBufferToastReplace()

2021-06-04 Thread Alvaro Herrera
[Resent -- apologies to those who are getting this email twice. Please be mindful to reply to this one if you do. I think the no-crosspost policy is very obnoxious and should be relaxed.) On 2019-Dec-11, Andres Freund wrote: > On 2019-12-11 08:17:01 +, Drouvot, Bertrand wrote: > > >>Cor

Re: alter table set TABLE ACCESS METHOD

2021-06-04 Thread Michael Paquier
On Fri, Jun 04, 2021 at 11:26:28AM -0700, Jeff Davis wrote: > Yes. That's a current requirement, and any AM that doesn't do that is > already broken (e.g. for INSERT INTO ... SELECT). Makes sense. I was just looking at the patch, and this was the only part of it that made my spidey sense react.

Re: logical decoding bug: segfault in ReorderBufferToastReplace()

2021-06-04 Thread Alvaro Herrera
On 2021-Jun-04, Jeremy Schneider wrote: > ERROR: XX000: could not open relation with OID 0 > LOCATION: ReorderBufferToastReplace, reorderbuffer.c:305 Hah. It seems to me that this code should silently return if rd_rel->reltoastrelid == 0; just like in the case of txn->toast_hash == NULL. It evi

Re: join pushdown and issue with foreign update

2021-06-04 Thread Tom Lane
Amit Langote writes: > On Wed, Jun 2, 2021 at 4:39 PM Andrey Lepikhov > wrote: >> I played with your patch and couldn't find any errors. But what if ROW >> operation were allowed to be pushed to a foreign server? >> Potentially, I can imagine pushed-down JOIN with arbitrary ROW function >> in its

Re: Move pg_attribute.attcompression to earlier in struct for reduced size?

2021-06-04 Thread Alvaro Herrera
On 2021-Jun-04, Tom Lane wrote: > Alvaro Herrera writes: > > Now, while this patch does seem to work correctly, it raises a number of > > weird cpluspluscheck warnings, which I think are attributable to the > > new macro definitions. I didn't look into it closely, but I suppose it > > should be

Re: Table AM modifications to accept column projection lists

2021-06-04 Thread Jacob Champion
On Tue, 2021-06-01 at 15:38 +0300, Aleksander Alekseev wrote: > I came across this patch and noticed that it rotted a little, > especially after removing inheritance_planner() in 86dc9005. I > managed to resolve the conflicts on current `master` (eb89cb43), see > the attached patch. The code compil

Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns

2021-06-04 Thread Oh, Mike
This patch should address the same problem for pglogical as well. Thanks, Mike On 6/4/21, 3:55 PM, "ahsan hadi" wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Re: [Proposal] Add accumulated statistics for wait event

2021-06-04 Thread Jehan-Guillaume de Rorthais
Hi All, I faced a few times a situation where a long running query is actually including the time the backend is waiting for the frontend to fetch all the rows (see [1] for details). See a sample code fe-time.c and its comments in attachment to reproduce this behavior. There's no simple way today

Re: Move pg_attribute.attcompression to earlier in struct for reduced size?

2021-06-04 Thread Tom Lane
Alvaro Herrera writes: > It seems to me that most of the overhead is the function call for > toast_get_compression_id(), so we should get rid of that. Nice result. I'm willing to live with 1.5% slowdown ... IME that's usually below the noise threshold anyway. > Now, while this patch does seem t

Re: PG 14 release notes, first draft

2021-06-04 Thread Bruce Momjian
On Fri, Jun 4, 2021 at 04:31:06PM -0500, Justin Pryzby wrote: > doc/src/sgml/release-14.sgml- > doc/src/sgml/release-14.sgml- > doc/src/sgml/release-14.sgml- > doc/src/sgml/release-14.sgml- > doc/src/sgml/release-14.sgml-Add system view doc/src/sgml/release-14.sgml- >

Re: Move pg_attribute.attcompression to earlier in struct for reduced size?

2021-06-04 Thread Alvaro Herrera
So I tried running vacuum full in pgbench of your 10-column table, max_wal_size=32GB. I didn't move pgdata to an in-memory pgdata, but this is on NVMe so pretty fast anyway. pgbench -c1 -t30 -n -f vacuumfull.sql. Current master: latency average = 2885.550 ms latency stddev = 1771.170 ms tps = 0.

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

2021-06-04 Thread Alvaro Herrera
On 2021-Apr-12, Melanie Plageman wrote: > As for the way I have recorded strategy writes -- it is quite inelegant, > but, I wanted to make sure that I only counted a strategy write as one > in which the backend wrote out the dirty buffer from its strategy ring > but did not check if there was any

Re: PG 14 release notes, first draft

2021-06-04 Thread Justin Pryzby
doc/src/sgml/release-14.sgml- doc/src/sgml/release-14.sgml- doc/src/sgml/release-14.sgml- doc/src/sgml/release-14.sgml- doc/src/sgml/release-14.sgml-Add system view pg_stat_wal doc/src/sgml/release-14.sgml-which reports WAL activity (Masahiro Ikeda) doc/src/sgml/releas

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

2021-06-04 Thread Melanie Plageman
On Thu, Apr 15, 2021 at 7:59 PM Andres Freund wrote: > Hi, > > On 2021-04-12 19:49:36 -0700, Melanie Plageman wrote: > > So, I took a stab at implementing this in PgBackendStatus. > > Cool! > Just a note on v2 of the patch -- the diff for the changes I made to pgstatfuncs.c is pretty atrocious a

Re: CALL versus procedures with output-only arguments

2021-06-04 Thread Tom Lane
I wrote: > It would likely not be very hard to fix pg_dump to include explicit > IN markers. I don't think this results in a compatibility problem > for existing dumps, since they won't be taken from databases in > which there are procedures with OUT arguments. Actually, all we have to do to fix

Re: DELETE CASCADE

2021-06-04 Thread David Christensen
On Fri, Jun 4, 2021 at 3:40 PM Isaac Morland wrote: > I apologize if I am deeply confused, but say I have this: > > CREATE TABLE parent ( > pid int primary key, > parent_data text > ); > > CREATE TABLE child ( > pid int REFERENCES parent, > cid int, > PRIMARY KEY (pid, cid), >

Re: DELETE CASCADE

2021-06-04 Thread Isaac Morland
On Fri, 4 Jun 2021 at 16:24, David Christensen < david.christen...@crunchydata.com> wrote: > On Fri, Jun 4, 2021 at 2:53 PM Peter Eisentraut < > peter.eisentr...@enterprisedb.com> wrote: > >> On 03.06.21 23:47, David G. Johnston wrote: >> > This behavior should require the same permissions as actu

Re: DELETE CASCADE

2021-06-04 Thread David Christensen
On Fri, Jun 4, 2021 at 2:53 PM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 03.06.21 23:47, David G. Johnston wrote: > > This behavior should require the same permissions as actually creating > > an ON DELETE CASCADE FK on the cascaded-to tables. i.e., Table Owner > > role me

Re: Support for CREATE MODULE?

2021-06-04 Thread Pavel Stehule
Hi st 2. 6. 2021 v 15:39 odesílatel Jim Mlodgenski napsal: > Working with users over the years, some have large libraries of server > side code sometimes consisting of 100k+ lines of code over 1000+ functions > and procedures. This usually comes from a migration of a commercial > database like O

Re: Are we missing (void) when return value of fsm_set_and_search is ignored?

2021-06-04 Thread Peter Eisentraut
On 04.06.21 06:28, Julien Rouhaud wrote: Yes, but we have a lot a examples of functions without pg_nodiscard and callers still explicitly ignoring the results, like fsm_vacuum_page() in the same file. It would be more consistent and make the code slightly more self explanatory. I'm not clear ho

Re: DELETE CASCADE

2021-06-04 Thread Peter Eisentraut
On 03.06.21 23:47, David G. Johnston wrote: This behavior should require the same permissions as actually creating an ON DELETE CASCADE FK on the cascaded-to tables.  i.e., Table Owner role membership (the requirement for FK permissions can be assumed by the presence of the existing FK constrai

Re: CALL versus procedures with output-only arguments

2021-06-04 Thread Tom Lane
Peter Eisentraut writes: > On 02.06.21 02:04, Tom Lane wrote: >>> It's possible that we could revert proargtypes and still accommodate >>> the spec's definition for ALTER/DROP ROUTINE/PROCEDURE. I'm imagining >>> some rules along the line of: >>> 1. If arg list contains any parameter modes, then

Re: CALL versus procedures with output-only arguments

2021-06-04 Thread Peter Eisentraut
On 03.06.21 23:29, Tom Lane wrote: Peter Eisentraut writes: On 02.06.21 02:04, Tom Lane wrote: Hmm, actually we could make step 2 a shade tighter: if a candidate routine is a function, match against proargtypes. If it's a procedure, match against coalesce(proallargtypes, proargtypes). If we

Re: Support for CREATE MODULE?

2021-06-04 Thread Jim Mlodgenski
On Thu, Jun 3, 2021 at 8:49 AM Peter Eisentraut wrote: > Given that, as you said, the concept of modules is in the SQL standard, > there is surely some guidance in there about how this is supposed to > affect name resolution. So let's start with that. Maybe we won't like > it in the end or whate

Re: alter table set TABLE ACCESS METHOD

2021-06-04 Thread Jeff Davis
On Fri, 2021-06-04 at 14:58 +0900, Michael Paquier wrote: > In short, a table AMs would receive on a rewrite with ALTER TABLE > tuples which may be toasted, still table_insert_tuple() should be > able > to handle both: > - the case where this tuple was already toasted. > - the case where this tuple

Re: RFC: Table access methods and scans

2021-06-04 Thread Jeff Davis
On Fri, 2021-06-04 at 08:23 +0200, Mats Kindahl wrote: > That is basically the question. I'm prepared to take a shot at it > unless there is a good reason not to. Sounds good, I can review. Regards, Jeff Davis

Re: Decoding of two-phase xacts missing from CREATE_REPLICATION_SLOT command

2021-06-04 Thread Jeff Davis
On Fri, 2021-06-04 at 08:36 +0530, Amit Kapila wrote: > I think we can try but not sure if we can get it by then. So, here is > my suggestion: > a. remove the change in CreateReplicationSlotCmd > b. prepare the patches for protocol change and pg_recvlogical. This > will anyway include the change we

Re: Parallel scan with SubTransGetTopmostTransaction assert coredump

2021-06-04 Thread Ranier Vilela
Em sex., 4 de jun. de 2021 às 12:07, Pavel Borisov escreveu: > Please, avoid using decimal based values. >> >> 128 is multiple of 64. >> > It's true that 128 is better to use than 120 but the main problem is not > in the value but in the fact we never get > CurrentRunningXacts->subxid_overflow =

Re: Support for NSS as a libpq TLS backend

2021-06-04 Thread Magnus Hagander
On Thu, Jun 3, 2021 at 11:14 PM Daniel Gustafsson wrote: > > > On 3 Jun 2021, at 23:11, Tom Lane wrote: > > > > Bruce Momjian writes: > >> I wonder if we should use SSL/TLS in more places in our documentation. > > > > No objection to doing that in the docs; I'm just questioning > > switching the

Re: Incorrect usage of strtol, atoi for non-numeric junk inputs

2021-06-04 Thread Alvaro Herrera
On 2021-Jun-04, Bharath Rupireddy wrote: > On Fri, Jun 4, 2021 at 8:58 PM Alvaro Herrera wrote: > > I would suggest that the best way forward in this area is to rebase both > > there patches on current master. > > Thanks. I will read both the threads [1], [2] and try to rebase the > patches. If

pg_upgrade don't echo windows commands

2021-06-04 Thread Andrew Dunstan
Here's a completely trivial command to turn of echoing of a couple of Windows commands pg_upgrade writes to cleanup scripts. This makes them behave more like the Unix equivalents. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com diff --git a/src/bin/pg_upgrade/pg_upgrade.h b

Re: Incorrect usage of strtol, atoi for non-numeric junk inputs

2021-06-04 Thread Bharath Rupireddy
On Fri, Jun 4, 2021 at 8:58 PM Alvaro Herrera wrote: > > On 2021-Jun-04, Bharath Rupireddy wrote: > > > On Thu, May 27, 2021 at 3:05 AM Alvaro Herrera > > wrote: > > > Hi, how is this related to > > > https://postgr.es/m/20191028012000.ga59...@begriffs.com ? > > > > Thanks. The proposed approach

Re: security_definer_search_path GUC

2021-06-04 Thread Pavel Stehule
pá 4. 6. 2021 v 17:43 odesílatel Joel Jacobson napsal: > Maybe this could work: > CREATE SCHEMA schema_name UNQUALIFIED; > Which would explicitly make all the objects created in the schema > accessible unqualified, but also enforce there are no conflicts with other > objects in existence in all u

Re: security_definer_search_path GUC

2021-06-04 Thread Joel Jacobson
Maybe this could work: CREATE SCHEMA schema_name UNQUALIFIED; Which would explicitly make all the objects created in the schema accessible unqualified, but also enforce there are no conflicts with other objects in existence in all unqualified schemas, upon the creation of new objects. /Joel

Re: Incorrect usage of strtol, atoi for non-numeric junk inputs

2021-06-04 Thread Alvaro Herrera
On 2021-Jun-04, Bharath Rupireddy wrote: > On Thu, May 27, 2021 at 3:05 AM Alvaro Herrera > wrote: > > Hi, how is this related to > > https://postgr.es/m/20191028012000.ga59...@begriffs.com ? > > Thanks. The proposed approach there was to implement postgres's own > strtol i.e. string parsing, c

Re: Update maintenance_work_mem/autovacuum_work_mem to reflect the 1GB limitation with VACUUM

2021-06-04 Thread Greg Sabino Mullane
Should we say "currently has"?

Re: Add ZSON extension to /contrib/

2021-06-04 Thread Aleksander Alekseev
Hi hackers, Many thanks for the feedback and all the great suggestions! I decided to add the patch to the nearest commitfest. You will find it in the attachment. Differences from the GitHub version: - Code formatting changed; - More comments added to the code; - SGML documentation added; - Plus

Re: Parallel scan with SubTransGetTopmostTransaction assert coredump

2021-06-04 Thread Pavel Borisov
> > Please, avoid using decimal based values. > > 128 is multiple of 64. > It's true that 128 is better to use than 120 but the main problem is not in the value but in the fact we never get CurrentRunningXacts->subxid_overflow = suboverflowed; with value more than 120. This solves the problem but i

Re: Race condition in recovery?

2021-06-04 Thread Robert Haas
On Fri, Jun 4, 2021 at 5:25 AM Kyotaro Horiguchi wrote: > I think that's right. And the test script detects the issue for me > both on Linux but doesn't work for Windows. > > '"C:/../Documents/work/postgresql/src/test/recovery/t/cp_history_files"' is > not recognized as an internal command or ext

Re: Parallel scan with SubTransGetTopmostTransaction assert coredump

2021-06-04 Thread Ranier Vilela
>Just a note here. After examining the core dump I did notice something. >While in XidInMVCCSnapshot call the snapshot->suboverflowed is set true >although subxip == NULL and subxcnt == 0. As far as I understand, >snapshot->suboverflowed is set true in the GetRunningTransactionData >call. >And th

Re: Incorrect usage of strtol, atoi for non-numeric junk inputs

2021-06-04 Thread Bharath Rupireddy
On Thu, May 27, 2021 at 3:05 AM Alvaro Herrera wrote: > > On 2021-May-19, Bharath Rupireddy wrote: > > > While working on [1], I found that some parts of the code is using > > strtol and atoi without checking for non-numeric junk input strings. I > > found this strange. Most of the time users prov

Re: fdatasync performance problem with large number of DB files

2021-06-04 Thread Justin Pryzby
On Fri, Jun 04, 2021 at 04:24:02PM +0900, Michael Paquier wrote: > On Sat, May 29, 2021 at 02:23:21PM -0500, Justin Pryzby wrote: > > On Tue, May 25, 2021 at 07:13:59PM -0500, Justin Pryzby wrote: > >> On Sat, Mar 20, 2021 at 12:16:27PM +1300, Thomas Munro wrote: > >> > > > + { > >> > > > +

Re: Race condition in recovery?

2021-06-04 Thread Robert Haas
On Fri, Jun 4, 2021 at 3:51 AM Dilip Kumar wrote: > I could not reproduce this but I think I got the issue, I think I used > the wrong target LSN in wait_for_catchup, instead of checking the last > "insert LSN" of the standby I was waiting for last "replay LSN" of > standby which was wrong. Chang

Re: when the startup process doesn't

2021-06-04 Thread Nitin Jadhav
Hi, As nobody opposed the log based approach, I thought of creating a patch using this approach. Please find the patch attached. Introduced the new GUC variable 'log_min_duration_startup_process' which indicates the time period after every time period it logs the progress of the process startup w

Re: Fixup some appendStringInfo and appendPQExpBuffer calls

2021-06-04 Thread Tom Lane
David Rowley writes: > I did happen to find one other in mcv.c which dates back to 2019. I > was wondering if we should bother with that one since it's already out > there in PG13. Maybe not. Per Peter's point, it's just cosmetic really. regards, tom lane

Re: security_definer_search_path GUC

2021-06-04 Thread Joel Jacobson
On Fri, Jun 4, 2021, at 11:45, Pavel Stehule wrote: > > > pá 4. 6. 2021 v 11:17 odesílatel Joel Jacobson napsal: >> __ >> On Fri, Jun 4, 2021, at 08:58, Pavel Stehule wrote: >>> It is the same as using the command line without the possibility to >>> customize the PATH variable. The advantages

Re: pg_stat_progress_create_index vs. parallel index builds

2021-06-04 Thread Greg Nancarrow
On Fri, Jun 4, 2021 at 5:25 PM Greg Nancarrow wrote: > > What is slightly puzzling to me (and perhaps digging deeper will > reveal it) is why this "sorting live tuples" phase seems so short in > the serial case compared to the parallel case? > For example, in my test I created an index on a column

Re: Failures with gcd functions with GCC snapshots GCC and -O3 (?)

2021-06-04 Thread Fabien COELHO
serinus has been complaining about the new gcd functions in 13~: moonjelly, which also runs a bleeding-edge gcc, started to fail the same way at about the same time. Given that none of our code in that area has changed, it's hard to think it's anything but a broken compiler. Maybe somebod

Re: Transactions involving multiple postgres foreign servers, take 2

2021-06-04 Thread Masahiko Sawada
On Fri, Jun 4, 2021 at 5:16 PM Masahiko Sawada wrote: > > On Fri, Jun 4, 2021 at 3:58 PM ikeda...@oss.nttdata.com > wrote: > > > > > > > > 2021/06/04 12:28、Masahiko Sawada のメール: > > > > > > Thank you for pointing it out. This idea has been proposed several > > times and there were discussions. I'

Re: Parallel scan with SubTransGetTopmostTransaction assert coredump

2021-06-04 Thread Maxim Orlov
Just a note here. After examining the core dump I did notice something. While in XidInMVCCSnapshot call the snapshot->suboverflowed is set true although subxip == NULL and subxcnt == 0. As far as I understand, snapshot->suboverflowed is set true in the GetRunningTransactionData call. And the

Re: postgres_fdw batching vs. (re)creating the tuple slots

2021-06-04 Thread Tomas Vondra
Argh! I forgot the attachments, of course. On 6/4/21 1:48 PM, Tomas Vondra wrote: > Hi, > > Here's two WIP patches that fixes the regression for me. The first part > is from [1], so make large batches work, 0002 just creates a copy of the > tupledesc to not cause issues in resource owner, 0003 en

Re: postgres_fdw batching vs. (re)creating the tuple slots

2021-06-04 Thread Tomas Vondra
Hi, Here's two WIP patches that fixes the regression for me. The first part is from [1], so make large batches work, 0002 just creates a copy of the tupledesc to not cause issues in resource owner, 0003 ensures we only initialize the slots once (not per batch). With the patches applied, the timin

Re: Skip partition tuple routing with constant partition key

2021-06-04 Thread Amit Langote
On Fri, Jun 4, 2021 at 6:05 PM Amit Langote wrote: > On Fri, Jun 4, 2021 at 4:38 PM Amit Langote wrote: > > On Thu, Jun 3, 2021 at 8:48 PM Amit Langote wrote: > > > On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com > > > wrote: > > > > So, If we want to share the cached partition between st

Re: Are we missing (void) when return value of fsm_set_and_search is ignored?

2021-06-04 Thread Bharath Rupireddy
On Fri, Jun 4, 2021 at 9:58 AM Julien Rouhaud wrote: > > so this is not a generally applicable strategy. > > > > We have pg_nodiscard for functions where you explicitly want callers to > > check the return value. In all other cases, callers are free to ignore > > return values. > > Yes, but we ha

Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options

2021-06-04 Thread Bharath Rupireddy
On Wed, Jun 2, 2021 at 6:11 PM Bharath Rupireddy < bharath.rupireddyforpostg...@gmail.com> wrote: > > On Wed, Jun 2, 2021 at 11:43 AM Peter Smith wrote: > > Yes, it looks better, but (since the masks are all 1 bit) I was only > > asking why not do like: > > > > if (supported_opts & SUBOPT_CONNECT)

Re: A few random typos in the docs

2021-06-04 Thread David Rowley
On Fri, 4 Jun 2021 at 20:17, Daniel Gustafsson wrote: > Found a few small typos in the docs as per the attached. The patch looks good. These all seem to be new as of PG14. I can take care of this. David

Re: Teaching users how they can get the most out of HOT in Postgres 14

2021-06-04 Thread Masahiko Sawada
On Fri, Jun 4, 2021 at 3:15 PM Michael Paquier wrote: > > On Mon, May 31, 2021 at 10:30:08AM +0900, Masahiko Sawada wrote: > > On Fri, May 28, 2021 at 9:53 AM Peter Geoghegan wrote: > >> Another concern with this approach is what it > >> means for the VACUUM command itself. I haven't added an 'au

Re: Transactions involving multiple postgres foreign servers, take 2

2021-06-04 Thread Masahiko Sawada
On Fri, Jun 4, 2021 at 5:59 PM tsunakawa.ta...@fujitsu.com wrote: > > From: Masahiko Sawada > > On Fri, Jun 4, 2021 at 5:04 PM tsunakawa.ta...@fujitsu.com > > wrote: > > > Why does the user have to get an error? Once the local transaction has > > > been > > prepared, which means all remote one

Re: Fixup some appendStringInfo and appendPQExpBuffer calls

2021-06-04 Thread David Rowley
On Thu, 3 Jun 2021 at 16:17, Tom Lane wrote: > > David Rowley writes: > > There are quite a few other places in that file that should be using > > DatumGetCString() instead of DatumGetPointer(). > > Should we fix those too for PG14? > > +1. I'm surprised we are not getting compiler warnings. I

Re: Asynchronous Append on postgres_fdw nodes.

2021-06-04 Thread Etsuro Fujita
On Tue, Jun 1, 2021 at 6:30 PM Etsuro Fujita wrote: > On Fri, May 28, 2021 at 10:53 PM Etsuro Fujita > wrote: > > On Fri, May 28, 2021 at 5:29 PM Kyotaro Horiguchi > > wrote: > > > The patch drops some "= NULL" (initial) initializations when > > > nasyncplans == 0. AFAICS makeNode() fills the r

Re: [bug?] Missed parallel safety checks, and wrong parallel safety

2021-06-04 Thread Amit Kapila
On Tue, May 11, 2021 at 12:28 PM houzj.f...@fujitsu.com wrote: > > Temporarily, Just in case someone want to take a look at the patch for the > safety check. > I am not sure still there is a consensus on which cases exactly need to be dealt with. Let me try to summarize the discussion and see if

Re: security_definer_search_path GUC

2021-06-04 Thread Pavel Stehule
pá 4. 6. 2021 v 11:17 odesílatel Joel Jacobson napsal: > On Fri, Jun 4, 2021, at 08:58, Pavel Stehule wrote: > > It is the same as using the command line without the possibility to > customize the PATH variable. The advantages and disadvantages are exactly > the same. > > > The reason why we even

Re: Race condition in recovery?

2021-06-04 Thread Kyotaro Horiguchi
At Fri, 4 Jun 2021 13:21:08 +0530, Dilip Kumar wrote in > On Fri, Jun 4, 2021 at 2:03 AM Robert Haas wrote: > > > > On Thu, May 27, 2021 at 2:26 AM Dilip Kumar wrote: > > > Changed as suggested. > > > > I don't think the code as written here is going to work on Windows, > > because your code do

Re: security_definer_search_path GUC

2021-06-04 Thread Joel Jacobson
On Fri, Jun 4, 2021, at 08:58, Pavel Stehule wrote: > It is the same as using the command line without the possibility to customize > the PATH variable. The advantages and disadvantages are exactly the same. The reason why we even have PATH in the *nix world, is not because they *wanted* to separ

Re: Skip partition tuple routing with constant partition key

2021-06-04 Thread Amit Langote
On Fri, Jun 4, 2021 at 4:38 PM Amit Langote wrote: > On Thu, Jun 3, 2021 at 8:48 PM Amit Langote wrote: > > On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com > > wrote: > > > So, If we want to share the cached partition between statements, we seems > > > cannot > > > use ExecPartitionCheck.

Re: Decoding of two-phase xacts missing from CREATE_REPLICATION_SLOT command

2021-06-04 Thread Ajin Cherian
On Fri, Jun 4, 2021 at 1:06 PM Amit Kapila wrote: > I think we can try but not sure if we can get it by then. So, here is > my suggestion: > a. remove the change in CreateReplicationSlotCmd > b. prepare the patches for protocol change and pg_recvlogical. This > will anyway include the change we r

RE: Transactions involving multiple postgres foreign servers, take 2

2021-06-04 Thread tsunakawa.ta...@fujitsu.com
From: Masahiko Sawada > On Fri, Jun 4, 2021 at 5:04 PM tsunakawa.ta...@fujitsu.com > wrote: > > Why does the user have to get an error? Once the local transaction has been > prepared, which means all remote ones also have been prepared, the whole > transaction is determined to commit. So, the u

RE: Fast COPY FROM based on batch insert

2021-06-04 Thread tsunakawa.ta...@fujitsu.com
From: Andrey Lepikhov > We still have slow 'COPY FROM' operation for foreign tables in current master. > Now we have a foreign batch insert operation And I tried to rewrite the patch > [1] > with this machinery. I haven't looked at the patch, but nice performance. However, I see the following p

Re: Transactions involving multiple postgres foreign servers, take 2

2021-06-04 Thread Masahiko Sawada
On Fri, Jun 4, 2021 at 5:04 PM tsunakawa.ta...@fujitsu.com wrote: > > From: Masahiko Sawada > 1. the backend continues attempting to commit all prepared foreign > > transactions until all of them are committed. > > 2. the backend attempts to commit all prepared foreign transactions > > once. If a

detailed error message of pg_waldump

2021-06-04 Thread Kyotaro Horiguchi
In a very common operation of accidentally specifying a recycled segment, pg_waldump often returns the following obscure message. $ pg_waldump 0001002D pg_waldump: fatal: could not find a valid record after 0/2D00 The more detailed message is generated internally and we can us

Fast COPY FROM based on batch insert

2021-06-04 Thread Andrey Lepikhov
Hi, We still have slow 'COPY FROM' operation for foreign tables in current master. Now we have a foreign batch insert operation And I tried to rewrite the patch [1] with this machinery. The patch (see in attachment) smaller than [1] and no changes required in FDW API. Benchmarking =

A few random typos in the docs

2021-06-04 Thread Daniel Gustafsson
Found a few small typos in the docs as per the attached. -- Daniel Gustafsson https://vmware.com/ 0001-docs-fix-a-few-typos.patch Description: Binary data

Re: Transactions involving multiple postgres foreign servers, take 2

2021-06-04 Thread Masahiko Sawada
On Fri, Jun 4, 2021 at 3:58 PM ikeda...@oss.nttdata.com wrote: > > > > 2021/06/04 12:28、Masahiko Sawada のメール: > > > Thank you for pointing it out. This idea has been proposed several > times and there were discussions. I'd like to summarize the proposed > ideas and those pros and cons before reply

RE: Transactions involving multiple postgres foreign servers, take 2

2021-06-04 Thread tsunakawa.ta...@fujitsu.com
From: Masahiko Sawada 1. the backend continues attempting to commit all prepared foreign > transactions until all of them are committed. > 2. the backend attempts to commit all prepared foreign transactions > once. If an error happens, leave them for the resolver. > 3. the backend asks the resolve

Re: Race condition in recovery?

2021-06-04 Thread Dilip Kumar
On Fri, Jun 4, 2021 at 2:03 AM Robert Haas wrote: > > On Thu, May 27, 2021 at 2:26 AM Dilip Kumar wrote: > > Changed as suggested. > > I don't think the code as written here is going to work on Windows, > because your code doesn't duplicate enable_restoring's call to > perl2host or its backslash-

Re: Skip partition tuple routing with constant partition key

2021-06-04 Thread Amit Langote
On Thu, Jun 3, 2021 at 8:48 PM Amit Langote wrote: > On Tue, Jun 1, 2021 at 5:43 PM houzj.f...@fujitsu.com > wrote: > > So, If we want to share the cached partition between statements, we seems > > cannot > > use ExecPartitionCheck. Instead, I tried directly invoke the partition > > support > >

Re: pg_stat_progress_create_index vs. parallel index builds

2021-06-04 Thread Greg Nancarrow
On Thu, Jun 3, 2021 at 1:49 AM Matthias van de Meent wrote: > > On Wed, 2 Jun 2021 at 17:42, Tomas Vondra > wrote: > > > > Nice. I gave it a try on the database I'm experimenting with, and it > > seems to be working fine. Please add it to the next CF. > > Thanks, cf available here: https://commi

Re: fdatasync performance problem with large number of DB files

2021-06-04 Thread Michael Paquier
On Sat, May 29, 2021 at 02:23:21PM -0500, Justin Pryzby wrote: > On Tue, May 25, 2021 at 07:13:59PM -0500, Justin Pryzby wrote: >> On Sat, Mar 20, 2021 at 12:16:27PM +1300, Thomas Munro wrote: >> > > > + { >> > > > + {"recovery_init_sync_method", PGC_POSTMASTER, >> > > > ERROR_HAND

Re: Duplicate history file?

2021-06-04 Thread Kyotaro Horiguchi
At Thu, 03 Jun 2021 21:52:08 +0900 (JST), Kyotaro Horiguchi wrote in > > https://www.postgresql.org/docs/14/continuous-archiving.html > > The archive command should generally be designed to refuse to > > overwrite any pre-existing archive file. This is an important safety > > feature to preserv