Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Bharath Rupireddy
On Sat, Dec 12, 2020 at 12:19 AM Fujii Masao wrote: > I was thinking that in the case of drop of user mapping or server, hash_search(ConnnectionHash) in GetConnection() cannot find the cached connection entry invalidated by that drop. Because "user->umid" used as hash key is changed. So I was thin

Re: pg_basebackup test coverage

2020-12-11 Thread Noah Misch
On Fri, Dec 11, 2020 at 12:23:10PM -0500, Robert Haas wrote: > On Fri, Dec 11, 2020 at 3:04 AM Michael Paquier wrote: > > Why don't you just use Archive::Tar [1] instead of looking for some system > > commands? Combining list_files() with extract(), it is possible to > > extract an archive, with

Re: Rethinking plpgsql's assignment implementation

2020-12-11 Thread Tom Lane
I wrote: > In any case, that approach still involves inserting some query text > that the user didn't write, so I'm not sure how much confusion it'd > remove. The "SET n:" business at least looks like it's some weird > prefix comparable to "LINE n:", so while people wouldn't understand > it I thin

Re: please update ps display for recovery checkpoint

2020-12-11 Thread Bossart, Nathan
On 12/11/20, 4:00 PM, "Michael Paquier" wrote: > On Fri, Dec 11, 2020 at 06:54:42PM +, Bossart, Nathan wrote: >> This approach seems reasonable to me. I've attached my take on it. > > + /* Reset the process title */ > + set_ps_display(""); > I would still recommend to avoid callin

Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly

2020-12-11 Thread Michael Paquier
On Fri, Dec 11, 2020 at 05:27:03PM -0300, Alvaro Herrera wrote: > By the way-- What did you think of the idea of explictly marking the > types used for bitmasks using types bits32 and friends, instead of plain > int, which is harder to spot? Right, we could just do that while the area is changed.

Re: please update ps display for recovery checkpoint

2020-12-11 Thread Michael Paquier
On Fri, Dec 11, 2020 at 06:54:42PM +, Bossart, Nathan wrote: > This approach seems reasonable to me. I've attached my take on it. + /* Reset the process title */ + set_ps_display(""); I would still recommend to avoid calling set_ps_display() if there is no need to so as we avoid u

Re: pg_basebackup caused FailedAssertion

2020-12-11 Thread Jeff Davis
Old thread: https://www.postgresql.org/message-id/512E427B.9090308%40vmware.com about commit 3a9e64aa. On Wed, 2013-02-27 at 19:29 +0200, Heikki Linnakangas wrote: > Right. I fixed that by adding WL_SOCKET_READABLE, and handling any > messages that might arrive after the frontend already sent Co

Re: Insert Documentation - Returning Clause and Order

2020-12-11 Thread David G. Johnston
On Fri, Dec 11, 2020 at 6:24 AM Ashutosh Bapat wrote: > On Thu, Dec 10, 2020 at 7:49 PM David G. Johnston > wrote: > > > Yeah, the ongoing work on parallel inserts would seem to be an issue. > We should probably document that though. And maybe as part of parallel > inserts patch provide a user-

anonymous block returning like a function

2020-12-11 Thread PegoraroF10
I would like to have an anonymous block, like DO, but having resuts, like an usual function does. I know any user can do ... create function pg_temp.run_time_bigger(numeric,numeric) returns numeric language plpgsql as $$ begin if $1 > $2 then return $1; else return $2; end if; end;$$; select * f

Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly

2020-12-11 Thread Alvaro Herrera
By the way-- What did you think of the idea of explictly marking the types used for bitmasks using types bits32 and friends, instead of plain int, which is harder to spot?

Re: PG vs LLVM 12 on seawasp, next round

2020-12-11 Thread Fabien COELHO
Hello Andres, I hadn't checked that before, but for the last few days there's been a different failure than the one I saw earlier: +ERROR: could not load library "/home/fabien/pg/build-farm-11/buildroot/HEAD/pgsql.build/tmp_install/home/fabien/pg/build-farm-11/buildroot/HEAD/inst/lib/postgr

Re: pg_waldump error message fix

2020-12-11 Thread Bossart, Nathan
On 12/10/20, 9:23 PM, "Michael Paquier" wrote: > Please note that this is documented in xlogreader.h. Hmm. I can see > your point here, still I think that what both of you are suggesting > is not completely correct. For example, switching to EndRecPtr would > cause DecodeXLogRecord() to report

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Fujii Masao
On 2020/12/12 3:01, Bharath Rupireddy wrote: On Fri, Dec 11, 2020 at 11:01 PM Fujii Masao wrote: On 2020/12/11 19:16, Bharath Rupireddy wrote: On Thu, Dec 10, 2020 at 7:14 AM Bharath Rupireddy wrote: + /* We only look for active and open remote connections. */ +

Re: Rethinking plpgsql's assignment implementation

2020-12-11 Thread Tom Lane
Chapman Flack writes: > On 12/11/20 12:21, Tom Lane wrote: >> solution I adopted was just to invent a new CoercionContext value >> COERCION_PLPGSQL, representing "use pl/pgsql's rules". (Basically >> what that means nowadays is to apply CoerceViaIO if assignment cast >> lookup doesn't find a cast

Re: Rethinking plpgsql's assignment implementation

2020-12-11 Thread Pavel Stehule
Hi It is great. I expected much more work. pá 11. 12. 2020 v 18:21 odesílatel Tom Lane napsal: > We've had complaints in the past about how plpgsql can't handle > assignments to fields in arrays of records [1], that is cases like > > arrayvar[n].field := something; > > and also complain

Re: Proposed patch for key managment

2020-12-11 Thread Bruce Momjian
On Fri, Dec 11, 2020 at 01:01:14PM -0500, Bruce Momjian wrote: > On Wed, Dec 9, 2020 at 08:40:50PM -0500, Bruce Momjian wrote: > > My next task is to write a script for Yubikey authentication. > > I know Craig Ringer wanted Yubikey support, which allows two-factor > authentication, so I have adde

Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly

2020-12-11 Thread Peter Eisentraut
On 2020-12-05 02:30, Michael Paquier wrote: On Fri, Dec 04, 2020 at 04:28:26PM -0300, Alvaro Herrera wrote: FWIW I'm with Peter on this. Okay, attached is a patch to adjust the enums for the set of utility commands that is the set of things I have touched lately. Should that be extended more?

Re: Rethinking plpgsql's assignment implementation

2020-12-11 Thread Chapman Flack
On 12/11/20 12:21, Tom Lane wrote: > solution I adopted was just to invent a new CoercionContext value > COERCION_PLPGSQL, representing "use pl/pgsql's rules". (Basically > what that means nowadays is to apply CoerceViaIO if assignment cast > lookup doesn't find a cast pathway.) That seems like a

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Bharath Rupireddy
On Fri, Dec 11, 2020 at 3:46 PM Bharath Rupireddy wrote: > If we were to show invalidated connections in the output of > postgres_fdw_get_connections(), we can ignore the entry and continue > further if the user mapping sys cache search returns null tuple: > > umaptup = SearchSysCache1(USERMAPPING

Re: pg_basebackup test coverage

2020-12-11 Thread Tom Lane
Robert Haas writes: > Well, either this or Noah's method has the disadvantage that not > everyone will get the benefit of the tests, and that those who wish to > get that benefit must install more stuff. But, all three of the > computers I have within arm's reach (yeah, I might have a problem) > h

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Bharath Rupireddy
On Fri, Dec 11, 2020 at 11:01 PM Fujii Masao wrote: > On 2020/12/11 19:16, Bharath Rupireddy wrote: > > On Thu, Dec 10, 2020 at 7:14 AM Bharath Rupireddy > > wrote: > >>> + /* We only look for active and open remote > >>> connections. */ > >>> + if (en

Re: Proposed patch for key managment

2020-12-11 Thread Bruce Momjian
On Wed, Dec 9, 2020 at 08:40:50PM -0500, Bruce Momjian wrote: > My next task is to write a script for Yubikey authentication. I know Craig Ringer wanted Yubikey support, which allows two-factor authentication, so I have added it to the most recent patch by adding a cluster_passphrase_command %d/d

Re: MultiXact\SLRU buffers configuration

2020-12-11 Thread Gilles Darold
Le 10/12/2020 à 15:45, Gilles Darold a écrit : Le 08/12/2020 à 18:52, Andrey Borodin a écrit : Hi Gilles! Many thanks for your message! 8 дек. 2020 г., в 21:05, Gilles Darold написал(а): I know that this report is not really helpful Quite contrary - this benchmarks prove that controllable

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Fujii Masao
On 2020/12/10 10:44, Bharath Rupireddy wrote: On Wed, Dec 9, 2020 at 4:49 PM Fujii Masao wrote: I started reviewing 0001 patch. Thanks! IMO the 0001 patch should be self-contained so that we can commit it at first. That is, I think that it's better to move the documents and tests for t

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Fujii Masao
On 2020/12/11 19:16, Bharath Rupireddy wrote: On Thu, Dec 10, 2020 at 7:14 AM Bharath Rupireddy wrote: + /* We only look for active and open remote connections. */ + if (entry->invalidated || !entry->conn) + continue;

Re: pg_basebackup test coverage

2020-12-11 Thread Robert Haas
On Fri, Dec 11, 2020 at 3:04 AM Michael Paquier wrote: > Why don't you just use Archive::Tar [1] instead of looking for some system > commands? Combining list_files() with extract(), it is possible to > extract an archive, with or without compression, without hoping for an > equivalent to exist o

Re: Clean up ancient test style

2020-12-11 Thread Tom Lane
Peter Eisentraut writes: > Many older tests where written in a style like > SELECT '' AS two, i.* FROM INT2_TBL ... > where the first column indicated the number of expected result rows. > This has gotten increasingly out of date, as the test data fixtures > have expanded, so a lot of these

Rethinking plpgsql's assignment implementation

2020-12-11 Thread Tom Lane
We've had complaints in the past about how plpgsql can't handle assignments to fields in arrays of records [1], that is cases like arrayvar[n].field := something; and also complaints about how plpgsql can't handle assignments to array slices [2], ie arrayvar[m:n] := something; A

Clean up ancient test style

2020-12-11 Thread Peter Eisentraut
Many older tests where written in a style like SELECT '' AS two, i.* FROM INT2_TBL ... where the first column indicated the number of expected result rows. This has gotten increasingly out of date, as the test data fixtures have expanded, so a lot of these don't match anymore and are mislead

Re: On login trigger: take three

2020-12-11 Thread Pavel Stehule
pá 11. 12. 2020 v 17:05 odesílatel Konstantin Knizhnik < k.knizh...@postgrespro.ru> napsal: > > > On 11.12.2020 18:40, Pavel Stehule wrote: > > > is not correct. It makes it not possible to superuser to disable triggers >> for all users. >> > > pg_database_ownercheck returns true for superuser alw

Re: Feature Proposal: Add ssltermination parameter for SNI-based LoadBalancing

2020-12-11 Thread Lukas Meisegeier
Hey Heikki, thanks for providing feedback :) The traffic between proxy and psql-server is unencrypted thats why I don't need to patch the server. I tried returning a fixed response on the first plain SSLRequest forwarding it to a psql-server with ssl enabled an tried to switch then on the ssl con

Re: On login trigger: take three

2020-12-11 Thread Konstantin Knizhnik
On 11.12.2020 18:40, Pavel Stehule wrote: is not correct. It makes it not possible to superuser to disable triggers for all users. pg_database_ownercheck returns true for superuser always. Sorry, but I consider different case: when normal user is connected to the database. In this

Re: Feature Proposal: Add ssltermination parameter for SNI-based LoadBalancing

2020-12-11 Thread Heikki Linnakangas
On 11/12/2020 16:46, Lukas Meisegeier wrote: Hey Heikki, thanks for providing feedback :) The traffic between proxy and psql-server is unencrypted thats why I don't need to patch the server. Ok. I tried returning a fixed response on the first plain SSLRequest forwarding it to a psql-server w

Re: On login trigger: take three

2020-12-11 Thread Pavel Stehule
pá 11. 12. 2020 v 16:07 odesílatel Konstantin Knizhnik < k.knizh...@postgrespro.ru> napsal: > > > On 09.12.2020 15:24, Pavel Stehule wrote: > > > > st 9. 12. 2020 v 13:17 odesílatel Greg Nancarrow > napsal: > >> On Tue, Dec 8, 2020 at 3:26 PM Pavel Stehule >> wrote: >> > >> > >> > There are two

Re: [HACKERS] [PATCH] Generic type subscripting

2020-12-11 Thread Tom Lane
Dmitry Dolgov <9erthali...@gmail.com> writes: >> On Wed, Dec 09, 2020 at 04:59:34PM -0500, Tom Lane wrote: >> 0001 adds the ability to attach a subscript handler to an existing >> data type with ALTER TYPE. This is clearly going to be necessary >> if we want extension types to be able to use this

Re: [HACKERS] [PATCH] Generic type subscripting

2020-12-11 Thread Dmitry Dolgov
> On Wed, Dec 09, 2020 at 04:59:34PM -0500, Tom Lane wrote: > > 0001 adds the ability to attach a subscript handler to an existing > data type with ALTER TYPE. This is clearly going to be necessary > if we want extension types to be able to use this facility. The > only thing that I think might b

Re: On login trigger: take three

2020-12-11 Thread Konstantin Knizhnik
On 09.12.2020 15:24, Pavel Stehule wrote: st 9. 12. 2020 v 13:17 odesílatel Greg Nancarrow > napsal: On Tue, Dec 8, 2020 at 3:26 PM Pavel Stehule mailto:pavel.steh...@gmail.com>> wrote: > > > There are two maybe generic questions? > >

Re: On login trigger: take three

2020-12-11 Thread Konstantin Knizhnik
On 10.12.2020 21:09, Pavel Stehule wrote: čt 10. 12. 2020 v 16:48 odesílatel Konstantin Knizhnik mailto:k.knizh...@postgrespro.ru>> napsal: On 10.12.2020 18:12, Pavel Stehule wrote: My idea was a little bit different. Inside postinit initialize some global variables with in

Re: New Table Access Methods for Multi and Single Inserts

2020-12-11 Thread Bharath Rupireddy
On Tue, Dec 8, 2020 at 6:27 PM Bharath Rupireddy < bharath.rupireddyforpostg...@gmail.com> wrote: > Hi, > > Currently, for any component (such as COPY, CTAS[1], CREATE/REFRESH > Mat View[1], INSERT INTO SELECTs[2]) multi insert logic such as buffer > slots allocation, maintenance, decision to flush

Re: Feature Proposal: Add ssltermination parameter for SNI-based LoadBalancing

2020-12-11 Thread Heikki Linnakangas
On 10/12/2020 17:49, Lukas Meisegeier wrote: I try to host multiple postgresql-servers on the same ip and the same port through SNI-based load-balancing. Currently this is not possible because of two issues: 1. The psql client won't set the tls-sni-extension correctly (https://www.postgresql.org/

Re: Insert Documentation - Returning Clause and Order

2020-12-11 Thread Ashutosh Bapat
On Thu, Dec 10, 2020 at 7:49 PM David G. Johnston wrote: > > On Thursday, December 10, 2020, Ashutosh Bapat > wrote: >> >> On Wed, Dec 9, 2020 at 9:10 PM David G. Johnston >> wrote: >> > >> > Hey, >> > >> > Would it be accurate to add the following sentence to the INSERT >> > documentation und

Re: PoC/WIP: Extended statistics on expressions

2020-12-11 Thread Dean Rasheed
On Tue, 8 Dec 2020 at 12:44, Tomas Vondra wrote: > > Possibly. But I don't think it's worth the extra complexity. I don't > expect people to have a lot of overlapping stats, so the amount of > wasted space and CPU time is expected to be fairly limited. > > So I don't think it's worth spending too

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-12-11 Thread Bharath Rupireddy
On Thu, Dec 10, 2020 at 7:14 AM Bharath Rupireddy wrote: > > + /* We only look for active and open remote > > connections. */ > > + if (entry->invalidated || !entry->conn) > > + continue; > > > > We should return even inval

Re: Fail Fast In CTAS/CMV If Relation Already Exists To Avoid Unnecessary Rewrite, Planning Costs

2020-12-11 Thread Bharath Rupireddy
On Fri, Dec 11, 2020 at 1:40 PM Michael Paquier wrote: > On Fri, Dec 11, 2020 at 12:48:49PM +0530, Bharath Rupireddy wrote: > > I'm not quite sure how other databases behave. If I go by the main > > intention of EXPLAIN without ANALYZE, that should do the planning, > > show it in the output and no

Re: pg_shmem_allocations & documentation

2020-12-11 Thread Benoit Lobréau
Would "NULL for anonymous allocations, since details related to them are not known." be ok ? Le ven. 11 déc. 2020 à 09:29, Kyotaro Horiguchi a écrit : > At Fri, 11 Dec 2020 14:42:45 +0900, Michael Paquier > wrote in > > On Fri, Dec 11, 2020 at 11:00:58AM +0900, Kyotaro Horiguchi wrote: > > > A

Re: pg_waldump error message fix

2020-12-11 Thread Kyotaro Horiguchi
At Fri, 11 Dec 2020 17:19:33 +0900 (JST), Kyotaro Horiguchi wrote in > At Fri, 11 Dec 2020 14:21:57 +0900, Michael Paquier > wrote in > > On Fri, Dec 11, 2020 at 01:30:16PM +0900, Kyotaro Horiguchi wrote: > > > currRecPtr is a private member of the struct (see the definition of > > > the stru

Re: pg_shmem_allocations & documentation

2020-12-11 Thread Kyotaro Horiguchi
At Fri, 11 Dec 2020 14:42:45 +0900, Michael Paquier wrote in > On Fri, Dec 11, 2020 at 11:00:58AM +0900, Kyotaro Horiguchi wrote: > > Although we could just rip some words off, I'd like to propose instead > > to add an explanation why it is not exposed for anonymous allocations, > > like the col

Re: pg_waldump error message fix

2020-12-11 Thread Kyotaro Horiguchi
At Fri, 11 Dec 2020 14:21:57 +0900, Michael Paquier wrote in > On Fri, Dec 11, 2020 at 01:30:16PM +0900, Kyotaro Horiguchi wrote: > > currRecPtr is a private member of the struct (see the definition of > > the struct XLogReaderState). We should instead use EndRecPtr outside > > xlog reader. >

Re: Fail Fast In CTAS/CMV If Relation Already Exists To Avoid Unnecessary Rewrite, Planning Costs

2020-12-11 Thread Michael Paquier
On Fri, Dec 11, 2020 at 12:48:49PM +0530, Bharath Rupireddy wrote: > I'm not quite sure how other databases behave. If I go by the main > intention of EXPLAIN without ANALYZE, that should do the planning, > show it in the output and no execution of the query should happen. For > EXPLAIN CTAS/CMV, o

Re: pg_basebackup test coverage

2020-12-11 Thread Michael Paquier
On Thu, Dec 10, 2020 at 10:53:51PM -0800, Noah Misch wrote: > On Thu, Dec 10, 2020 at 12:32:52PM -0500, Robert Haas wrote: >> Now, there's nothing to prevent us from running commands like this >> from the pg_basebackup tests, but it doesn't seem like we could really >> check anything meaningful. Pe