Re: pgsql: Allow pgoutput to send logical decoding messages.

2021-04-06 Thread Amit Kapila
On Tue, Apr 6, 2021 at 8:55 AM Amit Kapila wrote: > > Allow pgoutput to send logical decoding messages. > One of the tests added by this commit is failing: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2021-04-06%2005%3A45%3A20 I think there is a race condition in one of

pgsql: Fix the tests added by commit ac4645c015.

2021-04-06 Thread Amit Kapila
Fix the tests added by commit ac4645c015. In the tests, after disabling the subscription, we were not waiting for the replication connection to drop from the publisher. So when the test was trying to use the same slot to fetch the messages via SQL API, it sometimes gives an error that the replicat

Re: pgsql: Allow pgoutput to send logical decoding messages.

2021-04-06 Thread Amit Kapila
On Tue, Apr 6, 2021 at 2:12 PM Amit Kapila wrote: > > On Tue, Apr 6, 2021 at 8:55 AM Amit Kapila wrote: > > > > Allow pgoutput to send logical decoding messages. > > > > One of the tests added by this commit is failing: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2021-

pgsql: ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION

2021-04-06 Thread Peter Eisentraut
ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION At present, if we want to update publications in a subscription, we can use SET PUBLICATION. However, it requires supplying all publications that exists and the new publications. If we want to add new publications, it's inconvenient. The new syntax on

pgsql: Adjust input value to WaitEventSetWait() in ExecAppendAsyncEvent

2021-04-06 Thread Etsuro Fujita
Adjust input value to WaitEventSetWait() in ExecAppendAsyncEventWait(). Adjust the number of events given to WaitEventSetWait() so that it doesn't exceed the maximum number of events in the WaitEventSet given to that function (set->nevents_space) in hopes of making the buildfarm green. Per valgri

Re: pgsql: Implement pipeline mode in libpq

2021-04-06 Thread David Rowley
On Tue, 30 Mar 2021 at 20:19, David Rowley wrote: > On Tue, 16 Mar 2021 at 10:20, Alvaro Herrera wrote: > > > > Implement pipeline mode in libpq > > > src/test/modules/libpq_pipeline/libpq_pipeline.c | 1303 > > > > I'm wondering if you meant to leave the "#define DEBUG" li

pgsql: pgbench: Function to generate random permutations.

2021-04-06 Thread Dean Rasheed
pgbench: Function to generate random permutations. This adds a new function, permute(), that generates pseudorandom permutations of arbitrary sizes. This can be used to randomly shuffle a set of values to remove unwanted correlations. For example, permuting the output from a non-uniform random dis

pgsql: Mark test_enc_conversion() as STRICT.

2021-04-06 Thread Heikki Linnakangas
Mark test_enc_conversion() as STRICT. Reported-by: Jaime Casanova, using SQLsmith Discussion: https://www.postgresql.org/message-id/20210402235337.GA4082@ahch-to Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c4c393b3ec83ceb4b4d7f37cdd5302126377d069 Modified Files

Re: pgsql: Add 'noError' argument to encoding conversion functions.

2021-04-06 Thread Heikki Linnakangas
On 03/04/2021 05:53, Michael Paquier wrote: On Fri, Apr 02, 2021 at 06:53:37PM -0500, Jaime Casanova wrote: sqlsmith thinks that test_enc_conversion() must be marked as STRICT. It crashes with something like this: This one has won an open item. Fixed by adding STRICT. Thanks! - Heikki

Re: pgsql: Implement pipeline mode in libpq

2021-04-06 Thread Alvaro Herrera
On 2021-Apr-06, David Rowley wrote: > I'm still not really sure why this code does #define directly followed > by an #ifdef for that define. However, just to clear up the final > compiler warning that's currently being produced on MSVC, I've > attached a proposed patch to fix it. Hi David, sorry

pgsql: Stop archive recovery if WAL generated with wal_level=minimal is

2021-04-06 Thread Fujii Masao
Stop archive recovery if WAL generated with wal_level=minimal is found. Previously if hot standby was enabled, archive recovery exited with an error when it found WAL generated with wal_level=minimal. But if hot standby was disabled, it just reported a warning and continued in that case. Which cou

pgsql: Clean up treatment of missing default and CHECK-constraint recor

2021-04-06 Thread Tom Lane
Clean up treatment of missing default and CHECK-constraint records. Andrew Gierth reported that it's possible to crash the backend if no pg_attrdef record is found to match an attribute that has atthasdef set. AttrDefaultFetch warns about this situation, but then leaves behind a relation tupdesc t

pgsql: Refactor lazy_scan_heap() loop.

2021-04-06 Thread Peter Geoghegan
Refactor lazy_scan_heap() loop. Add a lazy_scan_heap() subsidiary function that handles heap pruning and tuple freezing: lazy_scan_prune(). This is a great deal cleaner. The code that remains in lazy_scan_heap()'s per-block loop can now be thought of as code that either comes before or after the

pgsql: Fix handling of clauses incompatible with extended statistics

2021-04-06 Thread Tomas Vondra
Fix handling of clauses incompatible with extended statistics Handling of incompatible clauses while applying extended statistics was a bit confused - while handling a mix of compatible and incompatible clauses it sometimes incorrectly treated the incompatible clauses as compatible, resulting in a

Re: pgsql: Extended statistics on expressions

2021-04-06 Thread Tomas Vondra
On 4/1/21 4:24 AM, David Rowley wrote: > On Thu, 1 Apr 2021 at 14:49, Tomas Vondra > wrote: >> I think that's probably sufficient for now. More testing may be useful >> once I refactor the code a bit to make it more readable. > > Just to let you know, I left it running a bit longer. About 70 min

pgsql: psql: Show all query results by default

2021-04-06 Thread Peter Eisentraut
psql: Show all query results by default Previously, psql printed only the last result if a command string returned multiple result sets. Now it prints all of them. The previous behavior can be obtained by setting the psql variable SHOW_ALL_RESULTS to off. Author: Fabien COELHO Reviewed-by: "Iw

pgsql: Fix missing #include in nodeResultCache.h.

2021-04-06 Thread Tom Lane
Fix missing #include in nodeResultCache.h. Per cpluspluscheck. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/789d81de8a50d9a23cc1a3b8ea5d839246020689 Modified Files -- src/backend/executor/nodeResultCache.c | 1 - src/include/executor/nodeResultCache.h

pgsql: Remove tupgone special case from vacuumlazy.c.

2021-04-06 Thread Peter Geoghegan
Remove tupgone special case from vacuumlazy.c. Retry the call to heap_prune_page() in rare cases where there is disagreement between the heap_prune_page() call and the call to HeapTupleSatisfiesVacuum() that immediately follows. Disagreement is possible when a concurrently-aborted transaction mak

pgsql: Increment xactCompletionCount during subtransaction abort.

2021-04-06 Thread Andres Freund
Increment xactCompletionCount during subtransaction abort. Snapshot caching, introduced in 623a9ba79b, did not increment xactCompletionCount during subtransaction abort. That could lead to an older snapshot being reused. That is, at least as far as I can see, not a correctness issue (for MVCC snap

pgsql: postgres_fdw: Allow partitions specified in LIMIT TO to be impor

2021-04-06 Thread Fujii Masao
postgres_fdw: Allow partitions specified in LIMIT TO to be imported. Commit f49bcd4ef3 disallowed postgres_fdw to import table partitions. Because all data can be accessed through the partitioned table which is the root of the partitioning hierarchy, importing only partitioned table should allow a

pgsql: Postpone some stuff out of ExecInitModifyTable.

2021-04-06 Thread Tom Lane
Postpone some stuff out of ExecInitModifyTable. Arrange to do some things on-demand, rather than immediately during executor startup, because there's a fair chance of never having to do them at all: * Don't open result relations' indexes until needed. * Don't initialize partition tuple routing,

Re: pgsql: postgres_fdw: Allow partitions specified in LIMIT TO to be impor

2021-04-06 Thread Peter Geoghegan
On Tue, Apr 6, 2021 at 10:32 AM Fujii Masao wrote: > postgres_fdw: Allow partitions specified in LIMIT TO to be imported. I suspect (though have not verified) that this commit is the cause of various "recoveryCheck" failures on the buildfarm. Thanks -- Peter Geoghegan

pgsql: Fix compiler warning for MSVC in libpq_pipeline.c

2021-04-06 Thread David Rowley
Fix compiler warning for MSVC in libpq_pipeline.c DEBUG was already defined by the MSVC toolchain for "Debug" builds. On these systems the unconditional #define DEBUG was causing a 'DEBUG': macro redefinition warning. Here we rename DEBUG to DEBUG_OUPUT and also get rid of the #define which defin

Re: pgsql: Implement pipeline mode in libpq

2021-04-06 Thread David Rowley
On Wed, 7 Apr 2021 at 01:53, Alvaro Herrera wrote: > I did not intend to have the define defined at all times. Leaving it > there was an oversight. Let's just remove the #define line; users > interested in that output can turn it on when they need it. Removing it > means less clutter in the bui

pgsql: Postpone some more stuff out of ExecInitModifyTable.

2021-04-06 Thread Tom Lane
Postpone some more stuff out of ExecInitModifyTable. Delay creation of the projections for INSERT and UPDATE tuples until they're needed. This saves a pretty fair amount of work when only some of the partitions are actually touched. The logic associated with identifying junk columns in UPDATE/DE

Re: pgsql: postgres_fdw: Allow partitions specified in LIMIT TO to be impor

2021-04-06 Thread Michael Paquier
On Tue, Apr 06, 2021 at 01:02:58PM -0700, Peter Geoghegan wrote: > On Tue, Apr 6, 2021 at 10:32 AM Fujii Masao wrote: > > postgres_fdw: Allow partitions specified in LIMIT TO to be imported. > > I suspect (though have not verified) that this commit is the cause of > various "recoveryCheck" failur

pgsql: Fix test added by commit 9de9294b0c.

2021-04-06 Thread Fujii Masao
Fix test added by commit 9de9294b0c. The buildfarm members "drongo" and "fairywren" reported that the regression test (024_archive_recovery.pl) added by commit 9de9294b0c failed. The cause of this failure is that the test calls $node->init() without "allows_streaming => 1" and which doesn't add pg

pgsql: Add some information about authenticated identity via log_connec

2021-04-06 Thread Michael Paquier
Add some information about authenticated identity via log_connections The "authenticated identity" is the string used by an authentication method to identify a particular user. In many common cases, this is the same as the PostgreSQL username, but for some third-party authentication methods, the

Re: pgsql: Add some information about authenticated identity via log_connec

2021-04-06 Thread Michael Paquier
On Wed, Apr 07, 2021 at 01:17:34AM +, Michael Paquier wrote: > Add some information about authenticated identity via log_connections > > The "authenticated identity" is the string used by an authentication > method to identify a particular user. In many common cases, this is the > same as the

pgsql: Remove redundant memset(0) calls for page init of some index AMs

2021-04-06 Thread Michael Paquier
Remove redundant memset(0) calls for page init of some index AMs Bloom, GIN, GiST and SP-GiST rely on PageInit() to initialize the contents of a page, and this routine fills entirely a page with zeros for a size of BLCKSZ, including the special space. Those index AMs have been using an extra mems

pgsql: Message improvement

2021-04-06 Thread Peter Eisentraut
Message improvement The previous wording contained a superfluous comma. Adjust phrasing for grammatical correctness and clarity. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0b5e8245283eef67e88fb5380836cdc2c743d848 Modified Files -- contrib/test_dec

pgsql: Fix use of cursor sensitivity terminology

2021-04-06 Thread Peter Eisentraut
Fix use of cursor sensitivity terminology Documentation and comments in code and tests have been using the terms sensitive/insensitive cursor incorrectly relative to the SQL standard. (Cursor sensitivity is only relevant for changes made in the same transaction as the cursor, not for concurrent ch