Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjeoN-0006rJ-8S for pgsql-announce@arkaria.postgresql.org; Mon, 30 Nov 2020 08:45:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjeoM-0006oN-7Z for pgsql-announce@arkaria.postgresql.org; Mon, 30 Nov 2020 08:45:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjeoL-0006oA-Ei for pgsql-announce@lists.postgresql.org; Mon, 30 Nov 2020 08:45:29 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjenz-0000Zm-71 for pgsql-announce@lists.postgresql.org; Mon, 30 Nov 2020 08:45:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:From:To:Subject: MIME-Version:Content-Type:Sender:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=jpdAoc2q8695xtlhr09HBHvIqyeLBGZk39rDwANkmm4=; b=Gu2/49ZXc/ORg/Z0LPl3YpPhsS ZbctDY2GZ1E52f/ft67R7QvPJWmC/lYMqUc+zTg4hm4UEVMreJxXFET5Qhe1Lmmb4WEF+wjaaCL8t VbuTnCbYEg86dEirqNSvZRY5nyC45dlpWANXOsRmvjZBsQNFVXXVuVctQnGoyTTt62z5Rs7tcBM7e Gy3xx1VPhA6iAlb4hmVyriQ08vSthQCNkMYOsUo66ftO6rRtojSkI1yo6vqoB/1plZtjHKChWNmOO DF3iICzzO+zOuPYa+8DEOs7Dd3gr1N/IKriMs1nP5f9VR6llvrKtDyP77OrjzvfZGWdV4LWkm03D3 PVTih4Ig==; Received: from wrigleys.postgresql.org ([2a02:c0:301:0:ffff::34]) by mahout.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjenw-0004qE-8U for pgsql-announce@lists.postgresql.org; Mon, 30 Nov 2020 08:45:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjenu-00021I-Sq for pgsql-announce@lists.postgresql.org; Mon, 30 Nov 2020 08:45:02 +0000 Content-Type: multipart/mixed; boundary="===============8125541594290523673==" MIME-Version: 1.0 Subject: PostgreSQL Weekly News - November 29, 2020 To: PostgreSQL Announce From: PWN via PostgreSQL Announce Reply-To: david@fetter.org Date: Mon, 30 Nov 2020 08:44:02 +0000 Message-ID: <160672584285.25817.15033539324493694314@wrigleys.postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-pglister-tags: pwn X-pglister-tagsig: fe385af61493c2aa7b69317d1fb8d777e2a709e27002d1abeb28067662c135e7 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --===============8125541594290523673== Content-Type: multipart/alternative; boundary="===============2891852917865834123==" MIME-Version: 1.0 --===============2891852917865834123== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable # PostgreSQL Weekly News - November 29, 2020 # PostgreSQL Product News Pgpool-II 4.2.0, a connection pooler and statement replication system for PostgreSQL, released. [https://www.pgpool.net/docs/42/en/html/release-4-2-0.html](https://www.pgp= ool.net/docs/42/en/html/release-4-2-0.html) pgBadger v11.4, a PostgreSQL log analyzer and graph tool written in Perl, released. [https://github.com/darold/pgbadger/releases](https://github.com/darold/pgb= adger/releases) Database Lab 2.0, a tool for fast cloning of large PostgreSQL databases to build non-production environments, released: [https://postgres.ai/blog/dle-2.0-release/](https://postgres.ai/blog/dle-2.= 0-release/) pgagroal 1.0.0, a high-performance protocol-native connection pool for PostgreSQL, released. [https://agroal.github.io/pgagroal/release/announcement/2020/11/24/pgagroal= -1.0.0.html](https://agroal.github.io/pgagroal/release/announcement/2020/11= /24/pgagroal-1.0.0.html) # PostgreSQL Jobs for November [http://archives.postgresql.org/pgsql-jobs/2020-11/](http://archives.postgr= esql.org/pgsql-jobs/2020-11/) # PostgreSQL in the News Planet PostgreSQL: [http://planet.postgresql.org/](http://planet.postgresql= .org/) PostgreSQL Weekly News is brought to you this week by David Fetter Submit news and announcements by Sunday at 3:00pm PST8PDT to david@fetter.o= rg. # Applied Patches Tom Lane pushed: - Allow a multi-row INSERT to specify DEFAULTs for a generated column. One = can say "INSERT INTO tab(generated_col) VALUES (DEFAULT)" and not draw an err= or. But the equivalent case for a multi-row VALUES list always threw an error, even if one properly said DEFAULT in each row. Fix that. While here, imp= rove the test cases for nearby logic about OVERRIDING SYSTEM/USER values. Dean Rasheed Discussion: [https://postgr.es/m/9q0sgcr416t.fsf@gmx.us](https:/= /postgr.es/m/9q0sgcr416t.fsf@gmx.us) [https://git.postgresql.org/pg/commitdiff/17958972fe3bb03454a4b53756b29d6= 5dc285efa](https://git.postgresql.org/pg/commitdiff/17958972fe3bb03454a4b53= 756b29d65dc285efa) - Improve wording of two error messages related to generated columns. Clari= fy that you can "insert" into a generated column as long as what you're inse= rting is a DEFAULT placeholder. Also, use ERRCODE_GENERATED_ALWAYS in place of ERRCODE_SYNTAX_ERROR; there doesn't seem to be any reason to use the less specific errcode. Discussion: [https://postgr.es/m/9q0sgcr416t.fsf@gmx.u= s](https://postgr.es/m/9q0sgcr416t.fsf@gmx.us) [https://git.postgresql.org/pg/commitdiff/d36228a9fcdccd57a7dc332572eb983= 7c7c301e6](https://git.postgresql.org/pg/commitdiff/d36228a9fcdccd57a7dc332= 572eb9837c7c301e6) - Rename the "point is strictly above/below point" comparison operators. Historically these were called >^ and <^, but that is inconsistent with t= he similar box, polygon, and circle operators, which are named |>> and <<| respectively. Worse, the >^ and <^ names are used for *not* strict above/below tests for the box type. Hence, invent new operators followin= g the more common naming. The old operators remain available for now, and are = still accepted by the relevant index opclasses too. But there's a deprecation notice, so maybe we can get rid of them someday. Emre Hasegeli, reviewed= by Pavel Borisov Discussion: [https://postgr.es/m/24348.1587444160@sss.pgh.= pa.us](https://postgr.es/m/24348.1587444160@sss.pgh.pa.us) [https://git.postgresql.org/pg/commitdiff/0cc99327888840f2bf572303b68438e= 4caf62de9](https://git.postgresql.org/pg/commitdiff/0cc99327888840f2bf57230= 3b68438e4caf62de9) - Remove unnecessary #include. Justin Pryzby Discussion: [https://postgr.es/m/20201123205505.GJ24052@telsasoft.com](https://postgr= .es/m/20201123205505.GJ24052@telsasoft.com) [https://git.postgresql.org/pg/commitdiff/3b9b01f75d6e2d7bf9e0bf8ec958ce4= 20aa037c2](https://git.postgresql.org/pg/commitdiff/3b9b01f75d6e2d7bf9e0bf8= ec958ce420aa037c2) - Centralize logic for skipping useless ereport/elog calls. While ereport()= and elog() themselves are quite cheap when the error message level is too low= to be printed, some places need to do substantial work before they can call = those macros at all. To allow optimizing away such setup work when nothing is = to be printed, make elog.c export a new function message_level_is_interesting(elevel) that reports whether ereport/elog wi= ll do anything. Make use of that in various places that had ad-hoc direct test= s of log_min_messages etc. Also teach ProcSleep to use it to avoid some work. (There may well be other places that could usefully use this; I didn't se= arch hard.) Within elog.c, refactor a little bit to avoid having duplicate co= pies of the policy-setting logic. When that code was written, we weren't rely= ing on the availability of inline functions; so it had some duplications in t= he name of efficiency, which I got rid of. Alvaro Herrera and Tom Lane Discussion: [https://postgr.es/m/129515.1606166429@sss.pgh.pa.us](https:/= /postgr.es/m/129515.1606166429@sss.pgh.pa.us) [https://git.postgresql.org/pg/commitdiff/789b938bf2b8e38d0894261eae6bc84= bbbb4714e](https://git.postgresql.org/pg/commitdiff/789b938bf2b8e38d0894261= eae6bc84bbbb4714e) - Put "inline" marker on declarations of inline functions. I'm having a hard time telling whether the letter of the C standard requires this, but we do have a couple of buildfarm members that throw warnings when this is not d= one. Oversight in c532d15dd. [https://git.postgresql.org/pg/commitdiff/ec05bafdbbf474bf0a1416772da31f9= f1f27fa1e](https://git.postgresql.org/pg/commitdiff/ec05bafdbbf474bf0a14167= 72da31f9f1f27fa1e) - Avoid spamming the client with multiple ParameterStatus messages. Up to n= ow, we sent a ParameterStatus message to the client immediately upon any chan= ge in the active value of any GUC_REPORT variable. This was only barely okay w= hen the feature was designed; now that we have things like function SET claus= es, there are very plausible use-cases where a GUC_REPORT variable might chan= ge many times within a query --- and even end up back at its original value, perhaps. Fortunately most of our GUC_REPORT variables are unlikely to be changed often; but there are proposals in play to enlarge that set, or ev= en make it user-configurable. Hence, let's fix things to not generate more = than one ParameterStatus message per variable per query, and to not send any message at all unless the end-of-query value is different from what we la= st reported. Discussion: [https://postgr.es/m/5708.1601145259@sss.pgh.pa.us= ](https://postgr.es/m/5708.1601145259@sss.pgh.pa.us) [https://git.postgresql.org/pg/commitdiff/2432b1a04087edc2fd9536c7c9aa4ca= 03fd1b363](https://git.postgresql.org/pg/commitdiff/2432b1a04087edc2fd9536c= 7c9aa4ca03fd1b363) - Doc: minor improvements for section 11.2 "Index Types". Break the per-index-type discussions into 's so as to make them more visually separate and easier to find. Improve the markup, and make a couple of sm= all wording adjustments. This also fixes one stray reference to the now-deprecated point operators <^ and >^. Dagfinn Ilmari Manns=C3=A5ker,= reviewed by David Johnston and J=C3=BCrgen Purtz Discussion: [https://postgr.es/m/877dukhvzg.fsf@wibble.ilmari.org](https://postgr.es/= m/877dukhvzg.fsf@wibble.ilmari.org) [https://git.postgresql.org/pg/commitdiff/85b4ba73423b480902206ca04330c1c= bea371c3c](https://git.postgresql.org/pg/commitdiff/85b4ba73423b480902206ca= 04330c1cbea371c3c) - In psql's \d commands, don't truncate attribute default values. Historica= lly, psql has truncated the text of a column's default expression at 128 characters. This is unlike any other behavior in describe.c, and it's be= come particularly confusing now that the limit is only applied to the expressi= on proper and not to the "generated always as (...) stored" text that may get wrapped around it. Excavation in our git history suggests that the origi= nal motivation for this limit was not really to limit the display width (as I= 'd long supposed), but to make it safe to use a fixed-width output buffer to store the result. That implementation restriction is long gone of course= , but the limit remained. Let's just get rid of it. While here, rearrange the logic about when to free the output string so that it's not so dependent = on unstated assumptions about the possible values of attidentity and attgenerated. Per bug #16743 from David Turon. Back-patch to v12 where GENERATED came in. (Arguably we could take it back further, but I'm hesi= tant to change the behavior of long-stable branches for this.) Discussion: [https://postgr.es/m/16743-7b1bacc4af76e7ad@postgresql.org](https://postg= r.es/m/16743-7b1bacc4af76e7ad@postgresql.org) [https://git.postgresql.org/pg/commitdiff/314fb9baeacb3426a5d9a26132aae8d= 828cc0ad7](https://git.postgresql.org/pg/commitdiff/314fb9baeacb3426a5d9a26= 132aae8d828cc0ad7) - Fix a recently-introduced race condition in LISTEN/NOTIFY handling. Commit 566372b3d fixed some race conditions involving concurrent SimpleLruTrunca= te calls, but it introduced new ones in async.c. A newly-listening backend c= ould attempt to read Notify SLRU pages that were in process of being truncated, possibly causing an error. Also, the QUEUE_TAIL pointer could become set= to a value that's not equal to the queue position of any backend. While that's fairly harmless in v13 and up (thanks to commit 51004c717), in older bran= ches it resulted in near-permanent disabling of the queue truncation logic, so= that continued use of NOTIFY led to queue-fill warnings and eventual inability= to send any more notifies. (A server restart is enough to make that go away= , but it's still pretty unpleasant.) The core of the problem is confusion about whether QUEUE_TAIL represents the "logical" tail of the queue (i.e., the oldest still-interesting data) or the "physical" tail (the oldest data we= 've not yet truncated away). To fix, split that into two variables. QUEUE_TA= IL regains its definition as the logical tail, and we introduce a new variab= le to track the oldest un-truncated page. Per report from Mikael Gustavsson. = Like the previous patch, back-patch to all supported branches. Discussion: [https://postgr.es/m/1b8561412e8a4f038d7a491c8b922788@smhi.se](https://po= stgr.es/m/1b8561412e8a4f038d7a491c8b922788@smhi.se) [https://git.postgresql.org/pg/commitdiff/9c83b54a9ccdb111ce693ada2309475= 197c19d70](https://git.postgresql.org/pg/commitdiff/9c83b54a9ccdb111ce693ad= a2309475197c19d70) - Clean up after tests in src/test/locale/. Oversight in 257836a75, which a= dded these tests. [https://git.postgresql.org/pg/commitdiff/b90a7fe15f78b1e2513cbcb27a33f4a= dc47bcd3d](https://git.postgresql.org/pg/commitdiff/b90a7fe15f78b1e2513cbcb= 27a33f4adc47bcd3d) - Doc: clarify behavior of PQconnectdbParams(). The documentation omitted t= he critical tidbit that a keyword-array entry is simply ignored if its corresponding value-array entry is NULL or an empty string; it will *not* override any previously-obtained value for the parameter. (See conninfo_array_parse().) I'd supposed that would force the setting back = to default, which is what led me into bug #16746; but it doesn't. While her= e, I couldn't resist the temptation to do some copy-editing, both in the description of PQconnectdbParams() and in the section about connection URI syntax. Discussion: [https://postgr.es/m/931505.1606618746@sss.pgh.pa.us= ](https://postgr.es/m/931505.1606618746@sss.pgh.pa.us) [https://git.postgresql.org/pg/commitdiff/d5e2bdf7dda712a60234f08e036ec9d= e28085a2d](https://git.postgresql.org/pg/commitdiff/d5e2bdf7dda712a60234f08= e036ec9de28085a2d) Heikki Linnakangas pushed: - Split copy.c into four files. Copy.c has grown really large. Split it into more manageable parts: - copy.c now contains only a few functions that a= re common to COPY FROM and COPY TO. - copyto.c contains code for COPY TO.= - copyfrom.c contains code for initializing COPY FROM, and inserting the tuples to the correct table. - copyfromparse.c contains code for reading= from the client/file/program, and parsing the input text/CSV/binary format i= nto tuples. All of these parts are fairly complicated, and fairly independen= t of each other. There is a patch being discussed to implement parallel COPY F= ROM, which will add a lot of new code to the COPY FROM path, and another patch which would allow INSERTs to use the same multi-insert machinery as COPY = FROM, both of which will require refactoring that code. With those two patches, there's going to be a lot of code churn in copy.c anyway, so now seems li= ke a good time to do this refactoring. The CopyStateData struct is also split= . All the formatting options, like FORMAT, QUOTE, ESCAPE, are put in a new CopyFormatOption struct, which is used by both COPY FROM and TO. Other st= ate data are kept in separate CopyFromStateData and CopyToStateData structs. Reviewed-by: Soumyadeep Chakraborty, Erik Rijkers, Vignesh C, Andres Freu= nd Discussion: [https://www.postgresql.org/message-id/8e15b560-f387-7acc-ac90-763986617b= fb%40iki.fi](https://www.postgresql.org/message-id/8e15b560-f387-7acc-ac90-= 763986617bfb%40iki.fi) [https://git.postgresql.org/pg/commitdiff/c532d15dddff14b01fe9ef1d465013c= b8ef186df](https://git.postgresql.org/pg/commitdiff/c532d15dddff14b01fe9ef1= d465013cb8ef186df) - Fix a few comments that referred to copy.c. Missed these in the previous commit. [https://git.postgresql.org/pg/commitdiff/68b1a4877ef54f5ee6e05c64876655d= d13d2c73b](https://git.postgresql.org/pg/commitdiff/68b1a4877ef54f5ee6e05c6= 4876655dd13d2c73b) - Move per-agg and per-trans duplicate finding to the planner. This has the advantage that the cost estimates for aggregates can count the number of = calls to transition and final functions correctly. Bump catalog version, becau= se views can contain Aggrefs. Reviewed-by: Andres Freund Discussion: [https://www.postgresql.org/message-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a= 48%40iki.fi](https://www.postgresql.org/message-id/b2e3536b-1dbc-8303-c97e-= 89cb0b4a9a48%40iki.fi) [https://git.postgresql.org/pg/commitdiff/0a2bc5d61e713e3fe72438f020eea5f= cc90b0f0b](https://git.postgresql.org/pg/commitdiff/0a2bc5d61e713e3fe72438f= 020eea5fcc90b0f0b) - Fix expected output: the order of agg permission checks changed. Commit 0a2bc5d61e changed the order that permissions on the final and transition functions of an aggregate are checked in. That shows up as a difference i= n the order the LOG messages in this sepgsql regression test are printed. Adjus= t the expected output. Per buildfarm failure in rhinoceros. [https://git.postgresql.org/pg/commitdiff/8818ad5b1557d42cd58e5196fac7084= a2389bdad](https://git.postgresql.org/pg/commitdiff/8818ad5b1557d42cd58e519= 6fac7084a2389bdad) =C3=81lvaro Herrera pushed: - Make some sanity-check elogs more verbose. A few sanity checks in funcapi= .c were not mentioning all the possible clauses for failure, confusing devel= opers who fat-fingered catalog data additions. Make the errors more detailed to avoid wasting time in pinpointing mistakes. Per complaint from Craig Rin= ger. Reviewed-by: Tom Lane Discussion: [https://postgr.es/m/CAMsr+YH7Kd87A3cU5m_wKo46HPQ46zFv5wesFNL0YWxkGhGv3g@= mail.gmail.com](https://postgr.es/m/CAMsr+YH7Kd87A3cU5m_wKo46HPQ46zFv5wesFN= L0YWxkGhGv3g@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/fe051291550ab88267ce3104e983392= 5bf757393](https://git.postgresql.org/pg/commitdiff/fe051291550ab88267ce310= 4e9833925bf757393) - Don't hold ProcArrayLock longer than needed in rare cases. While cancelli= ng an autovacuum worker, we hold ProcArrayLock while formatting a debugging log string. We can make this shorter by saving the data we need to produce t= he message and doing the formatting outside the locked region. This isn't terribly critical, as it only occurs pretty rarely: when a backend runs deadlock detection and it happens to be blocked by a autovacuum running autovacuum. Still, there's no need to cause a hiccup in ProcArrayLock processing, which can be very high-traffic in some cases. While at it, r= ework code so that we only print the string when it is really going to be used,= as suggested by Michael Paquier. Discussion: [https://postgr.es/m/20201118214127.GA3179@alvherre.pgsql](https://postgr= .es/m/20201118214127.GA3179@alvherre.pgsql) Reviewed-by: Michael Paquier [https://git.postgresql.org/pg/commitdiff/450c8230b1f7eed1e927c44fb710d80= 502bea1d2](https://git.postgresql.org/pg/commitdiff/450c8230b1f7eed1e927c44= fb710d80502bea1d2) - Avoid spurious waits in concurrent indexing. In the various waiting phase= s of CREATE INDEX CONCURRENTLY (CIC) and REINDEX CONCURRENTLY (RC), we wait for other processes to release their snapshots; this is necessary in general = for correctness. However, processes doing CIC in other tables cannot possibly affect CIC or RC done in "this" table, so we don't need to wait for those. This commit adds a flag in MyProc->statusFlags to indicate that the curre= nt process is doing CIC, so that other processes doing CIC or RC can ignore = it when waiting. Note that this logic is only valid if the index does not a= ccess other tables. For simplicity we avoid setting the flag if the index has a column that's an expression, or has a WHERE predicate. (It is possible to have expressional or partial indexes that do not access other tables, but figuring that out would require more work.) This flag can potentially al= so be used by processes doing REINDEX CONCURRENTLY to be skipped; and by VACUUM= to ignore processes in CIC or RC for the purposes of computing an Xmin. Tha= t's left for future commits. Author: =C3=81lvaro Herrera Author: Dimitry Dolgov <9erthalion6@gmail.com> Reviewed-by: Michael Paqui= er Discussion: [https://postgr.es/m/20200810233815.GA18970@alvherre.pgsql](https://postg= r.es/m/20200810233815.GA18970@alvherre.pgsql) [https://git.postgresql.org/pg/commitdiff/c98763bf51bf610b3ee7e209fc76c3f= f9a6b3163](https://git.postgresql.org/pg/commitdiff/c98763bf51bf610b3ee7e20= 9fc76c3ff9a6b3163) - Restore lock level to update statusFlags. Reverts 27838981be9d (some comm= ents are kept). Per discussion, it does not seem safe to relax the lock level= used for this; in order for it to be safe, there would have to be memory barri= ers between the point we set the flag and the point we set the trasaction Xid, which perhaps would not be so bad; but there would also have to be barrie= rs at the readers' side, which from a performance perspective might be bad. Now maybe this analysis is wrong and it *is* safe for some reason, but proof = of that is not trivial. Discussion: [https://postgr.es/m/20201118190928.vnztes7c2sldu43a@alap3.anarazel.de](h= ttps://postgr.es/m/20201118190928.vnztes7c2sldu43a@alap3.anarazel.de) [https://git.postgresql.org/pg/commitdiff/dcfff74fb16622898a9d1df33e530f4= 77caab095](https://git.postgresql.org/pg/commitdiff/dcfff74fb16622898a9d1df= 33e530f477caab095) David Rowley pushed: - Define pg_attribute_cold and pg_attribute_hot macros. For compilers suppo= rting __has_attribute and __has_attribute (hot/cold). __has_attribute is suppo= rted on gcc >=3D 5, clang >=3D 2.9 and icc >=3D 17. A followup commit will im= plement some usages of these macros. Author: David Rowley Reviewed-by: Andres Fr= eund, Peter Eisentraut Discussion: [https://postgr.es/m/CAApHDvrVpasrEzLL2er7p9iwZFZ%3DJj6WisePcFeunwfrV0js_= A%40mail.gmail.com](https://postgr.es/m/CAApHDvrVpasrEzLL2er7p9iwZFZ%3DJj6W= isePcFeunwfrV0js_A%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/697e1d02f53f985992a4f479b0b08fc= a5c272c6c](https://git.postgresql.org/pg/commitdiff/697e1d02f53f985992a4f47= 9b0b08fca5c272c6c) - Improve compiler code layout in elog/ereport ERROR calls. Here we use a b= it of preprocessor trickery to coax supporting compilers into laying out their generated code so that the code that's in the same branch as elog(ERROR)/ereport(ERROR) calls is moved away from the hot path. Effectively, this reduces the size of the hot code meaning that it can si= t on fewer cache lines. Performance improvements of between 10-15% have been = seen on highly CPU bound workloads using pgbench's TPC-b benchmark. What's achieved here is very similar to putting the error condition inside an unlikely() macro. For example; if (unlikely(x < 0)) elog(ERROR, "inv= alid x value"); now there's no need to make use of unlikely() here as the com= mon macro used by elog and ereport will now see that elevel is >=3D ERROR and= make use of a pg_attribute_cold marked version of errstart(). When elevel < E= RROR or if it cannot be determined to be constant, the original behavior is maintained. Author: David Rowley Reviewed-by: Andres Freund, Peter Eisen= traut Discussion: [https://postgr.es/m/CAApHDvrVpasrEzLL2er7p9iwZFZ%3DJj6WisePcFeunwfrV0js_= A%40mail.gmail.com](https://postgr.es/m/CAApHDvrVpasrEzLL2er7p9iwZFZ%3DJj6W= isePcFeunwfrV0js_A%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/913ec71d682e99852cc188a7edbdccd= 02d42b4b3](https://git.postgresql.org/pg/commitdiff/913ec71d682e99852cc188a= 7edbdccd02d42b4b3) - Fix unportable usage of __has_attribute. This should fix the breakages ca= used by 697e1d02f, which seems to break the build for GCC version < 5. It see= ms, according to the GCC manual that __has_attribute is a "special operator" = and must be tested without any other conditions in the preprocessor test. Per recommendation from the GCC manual via Greg Nancarrow Reported-by: Greg Nancarrow Discussion: [https://postgr.es/m/CAJcOf-euSu8fhC10v476o9dqnjqKysVs1_vRms-_fvajpZ3kFw@= mail.gmail.com](https://postgr.es/m/CAJcOf-euSu8fhC10v476o9dqnjqKysVs1_vRms= -_fvajpZ3kFw@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/1fa22a43a56e1fe44c7bb3a3d5ef31b= e5bcac41d](https://git.postgresql.org/pg/commitdiff/1fa22a43a56e1fe44c7bb3a= 3d5ef31be5bcac41d) - Tidy up definitions of pg_attribute_hot and pg_attribute_cold. 1fa22a43a = was a quick fix for portability problem I introduced in 697e1d02f. 1fa22a43a a= dds a few more cases to the preprocessor logic than I'd have liked. Andres Fre= und and Dagfinn Ilmari Manns=C3=A5ker suggested a better way to do this. In = passing, also adjust the only current usage of these macros so that the macro comes before the function's return type in the declaration of the function. Th= is now matches what the definition of the function does. Discussion: [https://postgr.es/m/20200625163553.lt6wocbjhklp5pl4@alap3.anarazel.de](h= ttps://postgr.es/m/20200625163553.lt6wocbjhklp5pl4@alap3.anarazel.de) Discussion: [https://postgr.es/m/87pn43bmok.fsf@wibble.ilmari.org](https:= //postgr.es/m/87pn43bmok.fsf@wibble.ilmari.org) [https://git.postgresql.org/pg/commitdiff/b0727ae99b7056ca88e9708c014a86f= 6e611d938](https://git.postgresql.org/pg/commitdiff/b0727ae99b7056ca88e9708= c014a86f6e611d938) - Stop gap fix for __attribute__((cold)) compiler bug in MinGW 8.1. The buildfarm animal walleye, running MinGW 8.1 has been having problems ever since 697e1d02f and 913ec71d6 went in. This appears to be a bug in assem= bler which was fixed in a later version. For now, in order to get that animal running green again, let's just define pg_attribute_cold and pg_attribute= _hot to be empty macros on that compiler. Hopefully, we can get the support o= f the owner of the animal to upgrade to a less buggy compiler and revert this a= t a later date. Discussion: [https://postgr.es/m/286560.1606233316@sss.pgh.p= a.us](https://postgr.es/m/286560.1606233316@sss.pgh.pa.us) [https://git.postgresql.org/pg/commitdiff/687f6163447514c23b44a9815409870= 13529a9ec](https://git.postgresql.org/pg/commitdiff/687f6163447514c23b44a98= 1540987013529a9ec) Micha=C3=ABl Paquier pushed: - Use macros instead of hardcoded offsets for LWLock initialization. This m= akes the code slightly easier to follow, as the initialization relies on an of= fset that overlapped with an equivalent set of macros defined, which are used = in other places already. Author: Japin Li Discussion: [https://postgr.es/m/MEYP282MB1669FB410006758402F2C3A2B6E00@MEYP282MB1669= .AUSP282.PROD.OUTLOOK.COM](https://postgr.es/m/MEYP282MB1669FB410006758402F= 2C3A2B6E00@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM) [https://git.postgresql.org/pg/commitdiff/d03d7549b29236e300aceac0c22173c= f19acc675](https://git.postgresql.org/pg/commitdiff/d03d7549b29236e300aceac= 0c22173cf19acc675) - Remove catalog function currtid(). currtid() and currtid2() are an undocumented set of functions whose sole known user is the Postgres ODBC driver, able to retrieve the latest TID version for a tuple given by the caller of those functions. As used by Postgres ODBC, currtid() is a shor= tcut able to retrieve the last TID loaded into a backend by passing an OID of 0 (magic value) after a tuple insertion. This is removed in this commit, a= s it became obsolete after the driver began using "RETURNING ctid" with insert= s, a clause supported since Postgres 8.2 (using RETURNING is better for perfor= mance anyway as it reduces the number of round-trips to the backend). currtid2= () is still used by the driver, so this remains around for now. Note that this function is kept in its original shape for backward compatibility reasons. Per discussion with many people, including Andres Freund, Peter Eisentrau= t, =C3=81lvaro Herrera, Hiroshi Inoue, Tom Lane and myself. Bump catalog ve= rsion. Discussion: [https://postgr.es/m/20200603021448.GB89559@paquier.xyz](http= s://postgr.es/m/20200603021448.GB89559@paquier.xyz) [https://git.postgresql.org/pg/commitdiff/7b94e999606e2e2e10d68d544d49fc5= a5d5785ac](https://git.postgresql.org/pg/commitdiff/7b94e999606e2e2e10d68d5= 44d49fc5a5d5785ac) Fujii Masao pushed: - doc: Get rid of unnecessary space character from some index items. Previo= usly some index items have " ," (i.e., space + comma) in the docs as follows. = Since the space character before the comma is unnecessary, this commit gets rid= of that for the sake of consistency with other index items. parallel_leader_participation configuration parameter , Other Planner Opt= ions Author: Fujii Masao Reviewed-by: Euler Taveira Discussion: [https://postgr.es/m/e87b4ddf-1498-2850-bf55-519df3928fd4@oss.nttdata.com= ](https://postgr.es/m/e87b4ddf-1498-2850-bf55-519df3928fd4@oss.nttdata.com) [https://git.postgresql.org/pg/commitdiff/e522024bd8dd28a0f13dcccfd391706= 98f45c939](https://git.postgresql.org/pg/commitdiff/e522024bd8dd28a0f13dccc= fd39170698f45c939) - doc: Add description about re-analysis and re-planning of a prepared statement. A prepared statement is re-analyzed and re-planned whenever database objects used in the statement have undergone definitional change= s or the planner statistics of them have been updated. The former has been documented from before, but the latter was not previously. This commit ad= ds the description about the latter case into the docs. Author: Atsushi Torikoshi Reviewed-by: Andy Fan, Fujii Masao Discussion: [https://postgr.es/m/3ac82f4817c9fe274a905c8a38d87bd9@oss.nttdata.com](ht= tps://postgr.es/m/3ac82f4817c9fe274a905c8a38d87bd9@oss.nttdata.com) [https://git.postgresql.org/pg/commitdiff/4a36eab79a193700b7b65baf6c09c79= 5c90c02c6](https://git.postgresql.org/pg/commitdiff/4a36eab79a193700b7b65ba= f6c09c795c90c02c6) - pg_stat_statements: Track number of times pgss entries were deallocated. = If more distinct statements than pg_stat_statements.max are observed, pg_stat_statements entries about the least-executed statements are deallocated. This commit enables us to track the total number of times th= ose entries were deallocated. That number can be viewed in the pg_stat_statements_info view that this commit adds. It's useful when tuni= ng pg_stat_statements.max parameter. If it's high, i.e., the entries are deallocated very frequently, which might cause the performance regression= and we can increase pg_stat_statements.max to avoid those frequent deallocati= ons. The pg_stat_statements_info view is intended to display the statistics of pg_stat_statements module itself. Currently it has only one column "deall= oc" indicating the number of times entries were deallocated. But an upcoming = patch will add other columns (for example, the time at which pg_stat_statements statistics were last reset) into the view. Author: Katsuragi Yuta, Yuki = Seino Reviewed-by: Fujii Masao Discussion: [https://postgr.es/m/0d9f1107772cf5c3f954e985464c7298@oss.nttdata.com](ht= tps://postgr.es/m/0d9f1107772cf5c3f954e985464c7298@oss.nttdata.com) [https://git.postgresql.org/pg/commitdiff/9fbc3f318d039c3e1e8614c38e40843= cf8fcffde](https://git.postgresql.org/pg/commitdiff/9fbc3f318d039c3e1e8614c= 38e40843cf8fcffde) - Use standard SIGHUP and SIGTERM signal handlers in worker_spi. Previously worker_spi used its custom signal handlers for SIGHUP and SIGTERM. This c= ommit makes worker_spi use the standard signal handlers, to simplify the code. = Note that die() is used as the standard SIGTERM signal handler in worker_spi instead of SignalHandlerForShutdownRequest() or bgworker_die(). Previousl= y the exit handling was only able to exit from within the main loop, and not fr= om within the backend code it calls. This is why die() needs to be used here= , so worker_spi can respond to SIGTERM signal while it's executing a query. M= aybe we can say that it's a bug that worker_spi could not respond to SIGTERM d= uring query execution. But since worker_spi is a just example of the background worker code, we don't do the back-patch. Thanks to Craig Ringer for the report and investigation of the issue. Author: Bharath Rupireddy Reviewe= d-by: Fujii Masao Discussion: [https://postgr.es/m/CALj2ACXDEZhAFOTDcqO9cFSRvrFLyYOnPKrcA1UG4uZn9hUAVg@= mail.gmail.com](https://postgr.es/m/CALj2ACXDEZhAFOTDcqO9cFSRvrFLyYOnPKrcA1= UG4uZn9hUAVg@mail.gmail.com) Discussion: [https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH7cg7HV0O1bwQ@= mail.gmail.com](https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH= 7cg7HV0O1bwQ@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/2a0847720ae6fa4180bfbe404e4e6bb= f2f737708](https://git.postgresql.org/pg/commitdiff/2a0847720ae6fa4180bfbe4= 04e4e6bbf2f737708) - Use standard SIGTERM signal handler die() in test_shm_mq worker. Previous= ly test_shm_mq worker used the stripped-down version of die() as the SIGTERM signal handler. This commit makes it use die(), instead, to simplify the = code. In terms of the code, the difference between die() and the stripped-down version previously used is whether the signal handler directly may call ProcessInterrupts() or not. But this difference doesn't exist in a backgr= ound worker because, in bgworker, DoingCommandRead flag will never be true and die() will never call ProcessInterrupts() directly. Therefore test_shm_mq worker can safely use die(), like other bgworker proceses (e.g., logical replication apply launcher or autoprewarm worker) currently do. Thanks to Craig Ringer for the report and investigation of the issue. Author: Bhar= ath Rupireddy Reviewed-by: Fujii Masao Discussion: [https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH7cg7HV0O1bwQ@= mail.gmail.com](https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH= 7cg7HV0O1bwQ@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/ef848f4ac5a4bd072c6586718626877= 5acfb4298](https://git.postgresql.org/pg/commitdiff/ef848f4ac5a4bd072c65867= 186268775acfb4298) - Fix CLUSTER progress reporting of number of blocks scanned. Previously pg_stat_progress_cluster view reported the current block number in heap s= can as the number of heap blocks scanned (i.e., heap_blks_scanned). This repo= rted number could be incorrect when synchronize_seqscans is enabled, because it allowed the heap scan to start at block in middle. This could result in wraparounds in the heap_blks_scanned column when the heap scan wrapped ar= ound. This commit fixes the bug by calculating the number of blocks from the bl= ock that the heap scan starts at to the current block in scan, and reporting = that number in the heap_blks_scanned column. Also, in pg_stat_progress_cluster view, previously heap_blks_scanned could not reach heap_blks_total at the= end of heap scan phase if the last pages scanned were empty. This commit fixe= s the bug by manually updating heap_blks_scanned to the same value as heap_blks_total when the heap scan phase finishes. Back-patch to v12 whe= re pg_stat_progress_cluster view was introduced. Reported-by: Matthias van = de Meent Author: Matthias van de Meent Reviewed-by: Fujii Masao Discussion: [https://postgr.es/m/CAEze2WjCBWSGkVfYag001Rc4+-nNLDpWM7QbyD6yPvuhKs-gYQ@= mail.gmail.com](https://postgr.es/m/CAEze2WjCBWSGkVfYag001Rc4+-nNLDpWM7QbyD= 6yPvuhKs-gYQ@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/3df51ca8b39f08ef19a77b9776f2547= c86b70c49](https://git.postgresql.org/pg/commitdiff/3df51ca8b39f08ef19a77b9= 776f2547c86b70c49) Andrew Gierth pushed: - Properly check index mark/restore in ExecSupportsMarkRestore. Previously = this code assumed that all IndexScan nodes supported mark/restore, which is not true since it depends on optional index AM support functions. This could = lead to errors about missing support functions in rare edge cases of mergejoins with no sort keys, where an unordered non-btree index scan was placed on = the inner path without a protecting Materialize node. (Normally, the fact that merge join requires ordered input would avoid this error.) Backpatch all= the way since this bug is ancient. Per report from Eugen Konkov on irc. Discussion: [https://postgr.es/m/87o8jn50be.fsf@news-spur.riddles.org.uk]= (https://postgr.es/m/87o8jn50be.fsf@news-spur.riddles.org.uk) [https://git.postgresql.org/pg/commitdiff/660b89928d18386de7755565c008439= ae75d1218](https://git.postgresql.org/pg/commitdiff/660b89928d18386de775556= 5c008439ae75d1218) Amit Kapila pushed: - Remove obsolete comment atop ri_PlanCheck. Commit 5b7ba75f7f removed the unused parameter but forgot to update the nearby comments. Author: Li Ja= pin Backpatch-through: 13, where it was introduced Discussion: [https://postgr.es/m/0E2F62A2-B2F1-4052-83AE-F0BEC8A75789@hotmail.com](ht= tps://postgr.es/m/0E2F62A2-B2F1-4052-83AE-F0BEC8A75789@hotmail.com) [https://git.postgresql.org/pg/commitdiff/805b816305b62cb3e2670418ced8f71= 84a2d29c7](https://git.postgresql.org/pg/commitdiff/805b816305b62cb3e267041= 8ced8f7184a2d29c7) - Use Enums for logical replication message types at more places. Commit 644f0d7cc9 added logical replication message type enums to use instead of character literals but some char substitutions were overlooked. Author: = Peter Smith Reviewed-by: Amit Kapila Discussion: [https://postgr.es/m/CAHut+PsTG=3DVrv8hgrvOnAvCNR21jhqMdPk2n0a1uJPoW0p+Uf= Q@mail.gmail.com](https://postgr.es/m/CAHut+PsTG=3DVrv8hgrvOnAvCNR21jhqMdPk= 2n0a1uJPoW0p+UfQ@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/f3a8f73ec274bf8cc6066ea315f1a5a= 022214b02](https://git.postgresql.org/pg/commitdiff/f3a8f73ec274bf8cc6066ea= 315f1a5a022214b02) - Fix replication of in-progress transactions in tablesync worker. Tablesync worker runs under a single transaction but in streaming mode, we were committing the transaction on stream_stop, stream_abort, and stream_commi= t. We need to avoid committing the transaction in a streaming mode in tablesync worker. In passing move the call to process_syncing_tables in apply_handle_stream_commit after clean up of stream files. This will allow clean up of files to happen before the exit of tablesync worker which wou= ld otherwise be handled by one of the proc exit routines. Author: Dilip Kum= ar Reviewed-by: Amit Kapila and Peter Smith Tested-by: Peter Smith Discussio= n: [https://postgr.es/m/CAHut+Pt4PyKQCwqzQ=3DEFF=3DbpKKJD7XKt_S23F6L20ayQNxg= 77A@mail.gmail.com](https://postgr.es/m/CAHut+Pt4PyKQCwqzQ=3DEFF=3DbpKKJD7X= Kt_S23F6L20ayQNxg77A@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/0926e96c493443644ba8e96b5d96d01= 3a9ffaf64](https://git.postgresql.org/pg/commitdiff/0926e96c493443644ba8e96= b5d96d013a9ffaf64) Thomas Munro pushed: - Fix WaitLatch(NULL) on Windows. Further to commit 733fa9aa, on Windows wh= en a latch is triggered but we aren't currently waiting for it, we need to loc= ate the latch's HANDLE rather than calling ResetEvent(NULL). Author: Kyotaro Horiguchi Reported-by: Ranier Vilela Discussion: [https://postgr.es/m/CAEudQArTPi1YBc%2Bn1fo0Asy3QBFhVjp_QgyKG-8yksVn%2ByR= Tiw%40mail.gmail.com](https://postgr.es/m/CAEudQArTPi1YBc%2Bn1fo0Asy3QBFhVj= p_QgyKG-8yksVn%2ByRTiw%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/a7e65dc88b6f088fc2fcf5a660d866d= e644b1300](https://git.postgresql.org/pg/commitdiff/a7e65dc88b6f088fc2fcf5a= 660d866de644b1300) Peter Eisentraut pushed: - Make error hint from bind() failure more accurate. The hint "Is another postmaster already running ..." should only be printed for errors that are really about something else already using the address. In other cases it= is misleading. So only show that hint if errno =3D=3D EADDRINUSE. Also, si= nce Unix-domain sockets in the file-system namespace never report EADDRINUSE = for an existing file (they would just overwrite it), the part of the hint say= ing "If not, remove socket file \"%s\" and retry." can never happen, so remov= e it. Unix-domain sockets in the abstract namespace can report EADDRINUSE, but = in that case there is no file to remove, so the hint doesn't work there eith= er. Reviewed-by: Michael Paquier Discussion: [https://www.postgresql.org/message-id/flat/6dee8574-b0ad-fc49-9c8c-2edc7= 96f0033@2ndquadrant.com](https://www.postgresql.org/message-id/flat/6dee857= 4-b0ad-fc49-9c8c-2edc796f0033@2ndquadrant.com) [https://git.postgresql.org/pg/commitdiff/d5d91acdccae6b322a5634be2c66d62= fc6b9a43d](https://git.postgresql.org/pg/commitdiff/d5d91acdccae6b322a5634b= e2c66d62fc6b9a43d) - Add support for abstract Unix-domain sockets. This is a variant of the no= rmal Unix-domain sockets that don't use the file system but a separate "abstra= ct" namespace. At the user interface, such sockets are represented by names starting with "@". Supported on Linux and Windows right now. Reviewed-by: Michael Paquier Discussion: [https://www.postgresql.org/message-id/flat/6dee8574-b0ad-fc49-9c8c-2edc7= 96f0033@2ndquadrant.com](https://www.postgresql.org/message-id/flat/6dee857= 4-b0ad-fc49-9c8c-2edc796f0033@2ndquadrant.com) [https://git.postgresql.org/pg/commitdiff/c9f0624bc2f544baacafa38e3797d53= 23401d039](https://git.postgresql.org/pg/commitdiff/c9f0624bc2f544baacafa38= e3797d5323401d039) - doc: Fix typos. Author: Justin Pryzby Discussion: [https://www.postgresql.org/message-id/20201121194105.GO24784@telsasoft.c= om](https://www.postgresql.org/message-id/20201121194105.GO24784@telsasoft.= com) [https://git.postgresql.org/pg/commitdiff/2fbd786c3446b1bc90f396d3fa5f461= 4b0a57d89](https://git.postgresql.org/pg/commitdiff/2fbd786c3446b1bc90f396d= 3fa5f4614b0a57d89) - tablefunc: Reject negative number of tuples passed to normal_rand(). The function converted the first argument i.e. the number of tuples to return= into an unsigned integer which turns out to be huge number when a negative val= ue is passed. This causes the function to take much longer time to execute. Instead, reject a negative value. (If someone really wants to generate m= any more result rows, they should consider adding a bigint or numeric variant= .) While at it, improve SQL test to test the number of tuples returned by th= is function. Author: Ashutosh Bapat Discus= sion: [https://www.postgresql.org/message-id/CAG-ACPW3PUUmSnM6cLa9Rw4BEC5cEMKjX= 8Gogc8gvQcT3cYA1A@mail.gmail.com](https://www.postgresql.org/message-id/CAG= -ACPW3PUUmSnM6cLa9Rw4BEC5cEMKjX8Gogc8gvQcT3cYA1A@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/f73999262ed6c40d9a7c3d7cccec714= 3d4d15287](https://git.postgresql.org/pg/commitdiff/f73999262ed6c40d9a7c3d7= cccec7143d4d15287) Noah Misch pushed: - Retry initial slurp_file("current_logfiles"), in test 004_logrotate.pl. Buildfarm member topminnow failed when the test script attempted this bef= ore the syslogger would have created the file. Back-patch to v12, which introduced the test. [https://git.postgresql.org/pg/commitdiff/0f89ca083bbf71641cf61b4b951d6b3= 0a2fd978b](https://git.postgresql.org/pg/commitdiff/0f89ca083bbf71641cf61b4= b951d6b30a2fd978b) # Pending Patches Amul Sul sent in another revision of a patch to implement ALTER SYSTEM READ {ONLY|WRITE}. Daniel V=C3=A9rit=C3=A9 sent in another revision of a patch to implement ba= tch/pipelining in libpq. Justin Pryzby and Tom=C3=A1=C5=A1 Vondra traded patches to implement extend= ed statistics on expressions. =C3=81lvaro Herrera sent in another revision of a patch to Avoid errors in = brin summarization, which can happen if an index is reindexed concurrently. =C3=81lvaro Herrera sent in a patch to fix a bug that manifested as a walse= nder getting stuck during shutdown and *not* shut down, thus preventing postmast= er from completing the shutdown cycle by checking whether XLogRecPtrIsInvalid(replicatedPtr) was true. Zeng Wenjing sent in three more revisions of a patch to implement global temporary tables. Bharath Rupireddy sent in two more revisions of a patch to implement postgres_fdw connection caching - cause remote sessions linger till the loc= al session exit. Bharath Rupireddy and Heikki Linnakangas traded patches to make it possible= to use parallel inserts in CREATE TABLE AS, where it's safe to do so. Tom=C3=A1=C5=A1 Vondra sent in another revision of a patch to use non-volat= ile storage as a WAL buffer. Takayuki Tsunakawa sent in two more revisions of a patch to add bulk insert= s for foreign tables. Justin Pryzby sent in another revision of a patch to allow INSERT SELECT to= use a BulkInsertState, make INSERT SELECT use multi_insert, and dynamically swi= tch to multi-insert mode. Micha=C3=ABl Paquier sent in another revision of a patch to rework the SHA2= and crypto hash APIs, switch cryptohash_openssl.c to use EVP, and make pgcrypto= use the in-core resowner facility for EVP. Justin Pryzby sent in another revision of a patch to allow CLUSTER, VACUUM = FULL and REINDEX to change tablespace on the fly. Keisuke Kuroda sent in a patch to fix a bug that manifested as huge memory consumption on partitioned table with FKs by reducing the size of the ri SPI plan hash. Konstantin Knizhnik sent in two more revisions of a patch to implement cust= om compression for libpq. Takamichi Osumi sent in another revision of a patch to make it possible to disable WAL logging to speed up bulk loads. Nathan Bossart sent in two revisions of a patch to add a FAST option to CHECKPOINT. Amit Kapila, Ajin Cherian, and Peter Smith traded patches to implement logi= cal decoding for two-phase transactions. David Rowley sent in a patch to define pg_attribute_cold and pg_attribute_h= ot to be empty macros on minGW 8.1 so as to avoid a bug in that toolchain. Li Japin sent in another revision of a patch to allow terminating the idle sessions via a new GUC, idle_session_timeout, and call setitimer() less oft= en. Euler Taveira de Oliveira sent in a patch to add logical decoding messages = to pgoutput, add xid to messages when streaming, explain why LOGICAL_REP_MSG_MESSAGE is ignored, simplify the parse_output_parameters function to take a whole PGOutputData instead of bits and pieces, adjust in_streaming for messages, and overhaul the tests to take account for all t= his. Peter Eisentraut sent in another revision of a patch to add a result_format_auto_binary_types setting. Micha=C3=ABl Paquier sent in another revision of a patch to fix a problem t= hat manifested as vac_update_datfrozenxid will raise "wrong tuple length" if pg_database tuple contains toast attribute. Kyotaro HORIGUCHI sent in another revision of a patch to fix handling of Na= N in the geometry types. Masahiko Sawada sent in another revision of a patch to enable two-phase com= mit for multiple foreign servers. Daniel Gustafsson sent in another revision of a patch to make it possible to enable and disable data checksums online. Alexander Korotkov sent in a patch to implement a built-in infrastructure f= or reproduction of concurrency issues in automated test suites. Central to this infrastructure are "stop events," which which are special places in the cod= e, where the execution could be stopped on some condition. Peter Eisentraut sent in another revision of a patch to implement SEARCH and CYCLE clauses in common table expressions per the SQL standard. Thomas Munro sent in another revision of a patch to get latches to send few= er signals, use SIGURG rather than SIGUSR1 for latches, use signalfd for epoll latches, and use EVFILT_SIGNAL for kqueue latches. Tom Lane sent in another revision of a patch to report GUC changes at query= end. Peter Smith sent in a patch to use enums for message types. David Zhang sent in three revisions of a patch to add table access method a= s an option to pgbench. Anastasia Lubennikova sent in a patch to handle negative number of tuples p= assed to normal_rand(). Peter Eisentraut sent in a patch to pageinspect to change the block number arguments to bigint. Bertrand Drouvot sent in four more revisions of a patch to make it possible= to log the standby recovery conflict waits via a new GUC, log_recovery_conflict_waits. Kasahara Tatsuhito sent in three more revisions of a patch to fix a bug that manifested as an autovacuum issue with large numbers of tables. Masahiko Sawada sent in another revision of a patch to add basic statistics= to the pg_stat_wal view. Takamichi Osumi sent in a patch to prevent a scenario that archive recovery= hits WALs which come from wal_level=3Dminimal and the server continues to work, = which condition could cause data not to be replicated. Euler Taveira de Oliveira sent in a patch to remove temporary files after a backend crash in order to avert ENOSPC conditions that could result from multiple crashes. Pavel Borisov sent in another revision of a patch to implement covering ind= exes using the SP-GiST index access method. Kirk Jamison sent in another revision of a patch to prevent invalidating bl= ocks in smgrextend() during recovery, add a bool parameter in smgrnblocks() for cached blocks, slim down DropRelFileNodeBuffers() during recovery by avoidi= ng scanning the whole buffer pool when the relation is small enough or the the total number of blocks to be invalidated is below the threshold of full scanning, and getting DropRelFileNodesAllBuffers() to skip the time-consumi= ng scan of the whole buffer pool during recovery when the relation is small en= ough, or when the number of blocks to be invalidated is below the full scan thres= hold. Krunal Bauskar and Alexander Korotkov traded patches to improve the spinlock implementation on ARM. Arne Roland sent in three revisions of a patch to ensure that renaming a tr= igger on a partitioned table also renames triggers on the partitions. Bharath Rupireddy sent in a patch to fix the error message for pg_workers shutting down so it talks about background workers instead of the non-exist= ent connections that apply to other cases. Stephen Frost sent in another revision of a patch to add GSS information to= the connection authorized log message, if needed. Michael Banck sent in a patch to clarify the fact that CREATEROLE roles can GRANT default roles. Ashutosh Bapat and Alexander Korotkov traded patches to make it easy to pri= nt LSNs. Andreas Karlsson sent in a PoC patch to fix the fact that the inet/cidr sup= port shipped broken by throwing away netmask information in the btree_gist suppl= ied extension. Pavel St=C4=9Bhule and Justin Pryzby traded patches to make it possible to = read the tables to be dumped by pg_dump from a file. Justin Pryzby sent in another revision of a patch to make CLUSTER ON a sepa= rate dump object in pg_dump, implement CLUSTER for partitioned tables, propagate changes to indisclustered to child/parents, invalidate parent indexes, invalidate parent index cluster on attach, and preserve indisclustered on children of clustered, partitioned indexes. Simon Riggs sent in another revision of a patch to add a FAST_FREEZE option= to VACUUM. Simon Riggs sent in a patch to implement one_freeze then max_freeze for lazy VACUUM. Justin Pryzby sent in another revision of a patch to make pg_ls_* show directories and shared filesets. Justin Pryzby sent in another revision of a patch to remove references to pg_dump's pre-8.1 switch behaviour. Justin Pryzby sent in another revision of a patch to allow CREATE INDEX CONCURRENTLY on partitioned tables, add a SKIPVALID flag for more integrati= on, and make ReindexPartitions() set indisvalid. Paul A Jungwirth sent in two more revisions of a patch to implement multira= nges. Dean Rasheed sent in another revision of a patch to improve estimation of OR clauses. James Coleman sent in a patch to error if gather merge paths aren't suffici= ently sorted. James Coleman sent in another revision of a patch to ensure that generate_useful_gather_paths doesn't skip unsorted subpaths, enforce parall= el safety of pathkeys in generate_useful_gather_paths, disallow SRFs in proact= ive sort, remove the volatile expr target search on the grounds that it's not n= eeded then, and document find_em_expr_usable_for_sorting_rel in prepare_sort_from_pathkeys. --===============2891852917865834123== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable PostgreSQL Weekly News - November 29, 2020
 

PostgreSQL Weekly News - November 29, 2020

PostgreSQL Weekly News - November 29, 2020

PostgreSQL Product News

Pgpool-II 4.2.0, a connection pooler and st= atement replication system for PostgreSQL, released. https://www.pgpool.net/docs= /42/en/html/release-4-2-0.html

pgBadger v11.4, a PostgreSQL log analyzer a= nd graph tool written in Perl, released. https://github.com/darold/pgbadger/releas= es

Database Lab 2.0, a tool for fast cloning o= f large PostgreSQL databases to build non-production environments, released: https://postgres.ai/blog/dle-2.0-release/

pgagroal 1.0.0, a high-performance protocol= -native connection pool for PostgreSQL, released. https://agroal.github.io/pgagroal/release/announcement/2020/11/24/pgagroal= -1.0.0.html

PostgreSQL Jobs for November

ht= tp://archives.postgresql.org/pgsql-jobs/2020-11/

PostgreSQL in the News

Planet PostgreSQL: http= ://planet.postgresql.org/

PostgreSQL Weekly News is brought to you th= is week by David Fetter

Submit news and announcements by Sunday at = 3:00pm PST8PDT to david@fetter.org.

Applied Patches

Tom Lane pushed:

  • Allow a multi-row INSERT to specify DEFAULT= s for a generated column. One can say "INSERT INTO tab(generated_col) VALUES (DEFAULT)" and not draw an err= or. But the equivalent case for a multi-row VALUES list always threw an error, even if one properly said DEFAULT in each row. Fix that. While here, imp= rove the test cases for nearby logic about OVERRIDING SYSTEM/USER values. Dean Rasheed Discussion: https://postgr.es/m= /9q0sgcr416t.fsf@gmx.us htt= ps://git.postgresql.org/pg/commitdiff/17958972fe3bb03454a4b53756b29d65dc285= efa

  • Improve wording of two error messages relat= ed to generated columns. Clarify that you can "insert" into a generated column as long as what you're inse= rting is a DEFAULT placeholder. Also, use ERRCODE_GENERATED_ALWAYS in place of ERRCODE_SYNTAX_ERROR; there doesn't seem to be any reason to use the less specific errcode. Discussion: https://p= ostgr.es/m/9q0sgcr416t.fsf@gmx.us htt= ps://git.postgresql.org/pg/commitdiff/d36228a9fcdccd57a7dc332572eb9837c7c30= 1e6

  • Rename the "point is strictly above/below p= oint" comparison operators. Historically these were called >^ and <^, but that is inconsistent = with the similar box, polygon, and circle operators, which are named |>> and= <<| respectively. Worse, the >^ and <^ names are used for not= strict above/below tests for the box type. Hence, invent new operators followin= g the more common naming. The old operators remain available for now, and are = still accepted by the relevant index opclasses too. But there's a deprecation notice, so maybe we can get rid of them someday. Emre Hasegeli, reviewed= by Pavel Borisov Discussion: https= ://postgr.es/m/24348.1587444160@sss.pgh.pa.us htt= ps://git.postgresql.org/pg/commitdiff/0cc99327888840f2bf572303b68438e4caf62= de9

  • Remove unnecessary #include. Justin Pryzby = Discussion: https://postgr.es/m/202011= 23205505.GJ24052@telsasoft.com htt= ps://git.postgresql.org/pg/commitdiff/3b9b01f75d6e2d7bf9e0bf8ec958ce420aa03= 7c2

  • Centralize logic for skipping useless erepo= rt/elog calls. While ereport() and elog() themselves are quite cheap when the error message level is too low= to be printed, some places need to do substantial work before they can call = those macros at all. To allow optimizing away such setup work when nothing is = to be printed, make elog.c export a new function message_level_is_interesting(elevel) that reports whether ereport/elog wi= ll do anything. Make use of that in various places that had ad-hoc direct test= s of log_min_messages etc. Also teach ProcSleep to use it to avoid some work. (There may well be other places that could usefully use this; I didn't se= arch hard.) Within elog.c, refactor a little bit to avoid having duplicate co= pies of the policy-setting logic. When that code was written, we weren't rely= ing on the availability of inline functions; so it had some duplications in t= he name of efficiency, which I got rid of. Alvaro Herrera and Tom Lane Discussion: https://postgr.es/m= /129515.1606166429@sss.pgh.pa.us htt= ps://git.postgresql.org/pg/commitdiff/789b938bf2b8e38d0894261eae6bc84bbbb47= 14e

  • Put "inline" marker on declarations of inli= ne functions. I'm having a hard time telling whether the letter of the C standard requires this, but we do have a couple of buildfarm members that throw warnings when this is not d= one. Oversight in c532d15dd. h= ttps://git.postgresql.org/pg/commitdiff/ec05bafdbbf474bf0a1416772da31f9f1f2= 7fa1e

  • Avoid spamming the client with multiple Par= ameterStatus messages. Up to now, we sent a ParameterStatus message to the client immediately upon any chan= ge in the active value of any GUC_REPORT variable. This was only barely okay w= hen the feature was designed; now that we have things like function SET claus= es, there are very plausible use-cases where a GUC_REPORT variable might chan= ge many times within a query --- and even end up back at its original value, perhaps. Fortunately most of our GUC_REPORT variables are unlikely to be changed often; but there are proposals in play to enlarge that set, or ev= en make it user-configurable. Hence, let's fix things to not generate more = than one ParameterStatus message per variable per query, and to not send any message at all unless the end-of-query value is different from what we la= st reported. Discussion: https://po= stgr.es/m/5708.1601145259@sss.pgh.pa.us htt= ps://git.postgresql.org/pg/commitdiff/2432b1a04087edc2fd9536c7c9aa4ca03fd1b= 363

  • Doc: minor improvements for section 11.2 "I= ndex Types". Break the per-index-type discussions into <sect2>'s so as to make them more v= isually separate and easier to find. Improve the markup, and make a couple of sm= all wording adjustments. This also fixes one stray reference to the now-deprecated point operators <^ and >^. Dagfinn Ilmari Manns=C3= =A5ker, reviewed by David Johnston and J=C3=BCrgen Purtz Discussion: https://postgr.es/m/877dukhvzg= .fsf@wibble.ilmari.org htt= ps://git.postgresql.org/pg/commitdiff/85b4ba73423b480902206ca04330c1cbea371= c3c

  • In psql's \d commands, don't truncate attri= bute default values. Historically, psql has truncated the text of a column's default expression at 128 characters. This is unlike any other behavior in describe.c, and it's be= come particularly confusing now that the limit is only applied to the expressi= on proper and not to the "generated always as (...) stored" text that may get wrapped around it. Excavation in our git history suggests that the origi= nal motivation for this limit was not really to limit the display width (as I= 'd long supposed), but to make it safe to use a fixed-width output buffer to store the result. That implementation restriction is long gone of course= , but the limit remained. Let's just get rid of it. While here, rearrange the logic about when to free the output string so that it's not so dependent = on unstated assumptions about the possible values of attidentity and attgenerated. Per bug #16743 from David Turon. Back-patch to v12 where GENERATED came in. (Arguably we could take it back further, but I'm hesi= tant to change the behavior of long-stable branches for this.) Discussion: https://postgr.es/m/16743= -7b1bacc4af76e7ad@postgresql.org htt= ps://git.postgresql.org/pg/commitdiff/314fb9baeacb3426a5d9a26132aae8d828cc0= ad7

  • Fix a recently-introduced race condition in= LISTEN/NOTIFY handling. Commit 566372b3d fixed some race conditions involving concurrent SimpleLruTrunca= te calls, but it introduced new ones in async.c. A newly-listening backend c= ould attempt to read Notify SLRU pages that were in process of being truncated, possibly causing an error. Also, the QUEUE_TAIL pointer could become set= to a value that's not equal to the queue position of any backend. While that's fairly harmless in v13 and up (thanks to commit 51004c717), in older bran= ches it resulted in near-permanent disabling of the queue truncation logic, so= that continued use of NOTIFY led to queue-fill warnings and eventual inability= to send any more notifies. (A server restart is enough to make that go away= , but it's still pretty unpleasant.) The core of the problem is confusion about whether QUEUE_TAIL represents the "logical" tail of the queue (i.e., the oldest still-interesting data) or the "physical" tail (the oldest data we= 've not yet truncated away). To fix, split that into two variables. QUEUE_TA= IL regains its definition as the logical tail, and we introduce a new variab= le to track the oldest un-truncated page. Per report from Mikael Gustavsson. = Like the previous patch, back-patch to all supported branches. Discussion: https://postgr.es/m/1b= 8561412e8a4f038d7a491c8b922788@smhi.se htt= ps://git.postgresql.org/pg/commitdiff/9c83b54a9ccdb111ce693ada2309475197c19= d70

  • Clean up after tests in src/test/locale/. O= versight in 257836a75, which added these tests. h= ttps://git.postgresql.org/pg/commitdiff/b90a7fe15f78b1e2513cbcb27a33f4adc47= bcd3d

  • Doc: clarify behavior of PQconnectdbParams(= ). The documentation omitted the critical tidbit that a keyword-array entry is simply ignored if its corresponding value-array entry is NULL or an empty string; it will n= ot override any previously-obtained value for the parameter. (See conninfo_array_parse().) I'd supposed that would force the setting back = to default, which is what led me into bug #16746; but it doesn't. While her= e, I couldn't resist the temptation to do some copy-editing, both in the description of PQconnectdbParams() and in the section about connection URI syntax. Discussion: https://po= stgr.es/m/931505.1606618746@sss.pgh.pa.us htt= ps://git.postgresql.org/pg/commitdiff/d5e2bdf7dda712a60234f08e036ec9de28085= a2d

Heikki Linnakangas pushed:

  • Split copy.c into four files. Copy.c has gr= own really large. Split it into more manageable parts: - copy.c now contains only a few functions that a= re common to COPY FROM and COPY TO. - copyto.c contains code for COPY TO.= - copyfrom.c contains code for initializing COPY FROM, and inserting the tuples to the correct table. - copyfromparse.c contains code for reading= from the client/file/program, and parsing the input text/CSV/binary format i= nto tuples. All of these parts are fairly complicated, and fairly independen= t of each other. There is a patch being discussed to implement parallel COPY F= ROM, which will add a lot of new code to the COPY FROM path, and another patch which would allow INSERTs to use the same multi-insert machinery as COPY = FROM, both of which will require refactoring that code. With those two patches, there's going to be a lot of code churn in copy.c anyway, so now seems li= ke a good time to do this refactoring. The CopyStateData struct is also split= . All the formatting options, like FORMAT, QUOTE, ESCAPE, are put in a new CopyFormatOption struct, which is used by both COPY FROM and TO. Other st= ate data are kept in separate CopyFromStateData and CopyToStateData structs. Reviewed-by: Soumyadeep Chakraborty, Erik Rijkers, Vignesh C, Andres Freu= nd Discussion: https://www.postgresql.org/message-id/8e15b560-f387-7acc-ac90-763986617bfb= %40iki.fi htt= ps://git.postgresql.org/pg/commitdiff/c532d15dddff14b01fe9ef1d465013cb8ef18= 6df

  • Fix a few comments that referred to copy.c.= Missed these in the previous commit. h= ttps://git.postgresql.org/pg/commitdiff/68b1a4877ef54f5ee6e05c64876655dd13d= 2c73b

  • Move per-agg and per-trans duplicate findin= g to the planner. This has the advantage that the cost estimates for aggregates can count the number of = calls to transition and final functions correctly. Bump catalog version, becau= se views can contain Aggrefs. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a48= %40iki.fi htt= ps://git.postgresql.org/pg/commitdiff/0a2bc5d61e713e3fe72438f020eea5fcc90b0= f0b

  • Fix expected output: the order of agg permi= ssion checks changed. Commit 0a2bc5d61e changed the order that permissions on the final and transition functions of an aggregate are checked in. That shows up as a difference i= n the order the LOG messages in this sepgsql regression test are printed. Adjus= t the expected output. Per buildfarm failure in rhinoceros. h= ttps://git.postgresql.org/pg/commitdiff/8818ad5b1557d42cd58e5196fac7084a238= 9bdad

=C3=81lvaro Herrera pushed:

David Rowley pushed:

Micha=C3=ABl Paquier pushed:

  • Use macros instead of hardcoded offsets for= LWLock initialization. This makes the code slightly easier to follow, as the initialization relies on an of= fset that overlapped with an equivalent set of macros defined, which are used = in other places already. Author: Japin Li Discussion: https://postgr.es/m/MEYP282MB1669FB410006758402F2C3A2B6E00@M= EYP282MB1669.AUSP282.PROD.OUTLOOK.COM htt= ps://git.postgresql.org/pg/commitdiff/d03d7549b29236e300aceac0c22173cf19acc= 675

  • Remove catalog function currtid(). currtid(= ) and currtid2() are an undocumented set of functions whose sole known user is the Postgres ODBC driver, able to retrieve the latest TID version for a tuple given by the caller of those functions. As used by Postgres ODBC, currtid() is a shor= tcut able to retrieve the last TID loaded into a backend by passing an OID of 0 (magic value) after a tuple insertion. This is removed in this commit, a= s it became obsolete after the driver began using "RETURNING ctid" with insert= s, a clause supported since Postgres 8.2 (using RETURNING is better for perfor= mance anyway as it reduces the number of round-trips to the backend). currtid2= () is still used by the driver, so this remains around for now. Note that this function is kept in its original shape for backward compatibility reasons. Per discussion with many people, including Andres Freund, Peter Eisentrau= t, =C3=81lvaro Herrera, Hiroshi Inoue, Tom Lane and myself. Bump catalog ve= rsion. Discussion: https://postgr.e= s/m/20200603021448.GB89559@paquier.xyz htt= ps://git.postgresql.org/pg/commitdiff/7b94e999606e2e2e10d68d544d49fc5a5d578= 5ac

Fujii Masao pushed:

  • doc: Get rid of unnecessary space character= from some index items. Previously some index items have " ," (i.e., space + comma) in the docs as follows. = Since the space character before the comma is unnecessary, this commit gets rid= of that for the sake of consistency with other index items. parallel_leader_participation configuration parameter , Other Planner Opt= ions Author: Fujii Masao Reviewed-by: Euler Taveira Discussion: https://po= stgr.es/m/e87b4ddf-1498-2850-bf55-519df3928fd4@oss.nttdata.com htt= ps://git.postgresql.org/pg/commitdiff/e522024bd8dd28a0f13dcccfd39170698f45c= 939

  • doc: Add description about re-analysis and = re-planning of a prepared statement. A prepared statement is re-analyzed and re-planned whenever database objects used in the statement have undergone definitional change= s or the planner statistics of them have been updated. The former has been documented from before, but the latter was not previously. This commit ad= ds the description about the latter case into the docs. Author: Atsushi Torikoshi Reviewed-by: Andy Fan, Fujii Masao Discussion: https://postgr= .es/m/3ac82f4817c9fe274a905c8a38d87bd9@oss.nttdata.com htt= ps://git.postgresql.org/pg/commitdiff/4a36eab79a193700b7b65baf6c09c795c90c0= 2c6

  • pg_stat_statements: Track number of times p= gss entries were deallocated. If more distinct statements than pg_stat_statements.max are observed, pg_stat_statements entries about the least-executed statements are deallocated. This commit enables us to track the total number of times th= ose entries were deallocated. That number can be viewed in the pg_stat_statements_info view that this commit adds. It's useful when tuni= ng pg_stat_statements.max parameter. If it's high, i.e., the entries are deallocated very frequently, which might cause the performance regression= and we can increase pg_stat_statements.max to avoid those frequent deallocati= ons. The pg_stat_statements_info view is intended to display the statistics of pg_stat_statements module itself. Currently it has only one column "deall= oc" indicating the number of times entries were deallocated. But an upcoming = patch will add other columns (for example, the time at which pg_stat_statements statistics were last reset) into the view. Author: Katsuragi Yuta, Yuki = Seino Reviewed-by: Fujii Masao Discussion: https://postgr= .es/m/0d9f1107772cf5c3f954e985464c7298@oss.nttdata.com htt= ps://git.postgresql.org/pg/commitdiff/9fbc3f318d039c3e1e8614c38e40843cf8fcf= fde

  • Use standard SIGHUP and SIGTERM signal hand= lers in worker_spi. Previously worker_spi used its custom signal handlers for SIGHUP and SIGTERM. This c= ommit makes worker_spi use the standard signal handlers, to simplify the code. = Note that die() is used as the standard SIGTERM signal handler in worker_spi instead of SignalHandlerForShutdownRequest() or bgworker_die(). Previousl= y the exit handling was only able to exit from within the main loop, and not fr= om within the backend code it calls. This is why die() needs to be used here= , so worker_spi can respond to SIGTERM signal while it's executing a query. M= aybe we can say that it's a bug that worker_spi could not respond to SIGTERM d= uring query execution. But since worker_spi is a just example of the background worker code, we don't do the back-patch. Thanks to Craig Ringer for the report and investigation of the issue. Author: Bharath Rupireddy Reviewe= d-by: Fujii Masao Discussion: https://postgr.es/m/CALj2ACXDEZhAFOTDcqO9cFSRvrFLyYOnPKrcA1UG4uZn9hUAVg= @mail.gmail.com Discussion: https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH7cg7HV0O1bwQ= @mail.gmail.com htt= ps://git.postgresql.org/pg/commitdiff/2a0847720ae6fa4180bfbe404e4e6bbf2f737= 708

  • Use standard SIGTERM signal handler die() i= n test_shm_mq worker. Previously test_shm_mq worker used the stripped-down version of die() as the SIGTERM signal handler. This commit makes it use die(), instead, to simplify the = code. In terms of the code, the difference between die() and the stripped-down version previously used is whether the signal handler directly may call ProcessInterrupts() or not. But this difference doesn't exist in a backgr= ound worker because, in bgworker, DoingCommandRead flag will never be true and die() will never call ProcessInterrupts() directly. Therefore test_shm_mq worker can safely use die(), like other bgworker proceses (e.g., logical replication apply launcher or autoprewarm worker) currently do. Thanks to Craig Ringer for the report and investigation of the issue. Author: Bhar= ath Rupireddy Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAGRY4nxsAe_1k_9g5b47orA0S011iBoHsXHFMH7cg7HV0O1bwQ= @mail.gmail.com htt= ps://git.postgresql.org/pg/commitdiff/ef848f4ac5a4bd072c65867186268775acfb4= 298

  • Fix CLUSTER progress reporting of number of= blocks scanned. Previously pg_stat_progress_cluster view reported the current block number in heap s= can as the number of heap blocks scanned (i.e., heap_blks_scanned). This repo= rted number could be incorrect when synchronize_seqscans is enabled, because it allowed the heap scan to start at block in middle. This could result in wraparounds in the heap_blks_scanned column when the heap scan wrapped ar= ound. This commit fixes the bug by calculating the number of blocks from the bl= ock that the heap scan starts at to the current block in scan, and reporting = that number in the heap_blks_scanned column. Also, in pg_stat_progress_cluster view, previously heap_blks_scanned could not reach heap_blks_total at the= end of heap scan phase if the last pages scanned were empty. This commit fixe= s the bug by manually updating heap_blks_scanned to the same value as heap_blks_total when the heap scan phase finishes. Back-patch to v12 whe= re pg_stat_progress_cluster view was introduced. Reported-by: Matthias van = de Meent Author: Matthias van de Meent Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAEze2WjCBWSGkVfYag001Rc4+-nNLDpWM7QbyD6yPvuhKs-gYQ= @mail.gmail.com htt= ps://git.postgresql.org/pg/commitdiff/3df51ca8b39f08ef19a77b9776f2547c86b70= c49

Andrew Gierth pushed:

  • Properly check = index mark/restore in ExecSupportsMarkRestore. Previously this code assumed that all IndexScan nodes supported mark/restore, which is not true since it depends on optional index AM support functions. This could = lead to errors about missing support functions in rare edge cases of mergejoins with no sort keys, where an unordered non-btree index scan was placed on = the inner path without a protecting Materialize node. (Normally, the fact that merge join requires ordered input would avoid this error.) Backpatch all= the way since this bug is ancient. Per report from Eugen Konkov on irc. Discussion: https://pos= tgr.es/m/87o8jn50be.fsf@news-spur.riddles.org.uk htt= ps://git.postgresql.org/pg/commitdiff/660b89928d18386de7755565c008439ae75d1= 218

Amit Kapila pushed:

Thomas Munro pushed:

Peter Eisentraut pushed:

Noah Misch pushed:

Pending Patches

Amul Sul sent in another revision of a patc= h to implement ALTER SYSTEM READ {ONLY|WRITE}.

Daniel V=C3=A9rit=C3=A9 sent in another rev= ision of a patch to implement batch/pipelining in libpq.

Justin Pryzby and Tom=C3=A1=C5=A1 Vondra tr= aded patches to implement extended statistics on expressions.

=C3=81lvaro Herrera sent in another revisio= n of a patch to Avoid errors in brin summarization, which can happen if an index is reindexed concurrently.

=C3=81lvaro Herrera sent in a patch to fix = a bug that manifested as a walsender getting stuck during shutdown and not shut down, thus preventing p= ostmaster from completing the shutdown cycle by checking whether XLogRecPtrIsInvalid(replicatedPtr) was true.

Zeng Wenjing sent in three more revisions o= f a patch to implement global temporary tables.

Bharath Rupireddy sent in two more revision= s of a patch to implement postgres_fdw connection caching - cause remote sessions linger till the loc= al session exit.

Bharath Rupireddy and Heikki Linnakangas tr= aded patches to make it possible to use parallel inserts in CREATE TABLE AS, where it's safe to do so.

Tom=C3=A1=C5=A1 Vondra sent in another revi= sion of a patch to use non-volatile storage as a WAL buffer.

Takayuki Tsunakawa sent in two more revisio= ns of a patch to add bulk inserts for foreign tables.

Justin Pryzby sent in another revision of a= patch to allow INSERT SELECT to use a BulkInsertState, make INSERT SELECT use multi_insert, and dynamically swi= tch to multi-insert mode.

Micha=C3=ABl Paquier sent in another revisi= on of a patch to rework the SHA2 and crypto hash APIs, switch cryptohash_openssl.c to use EVP, and make pgcrypto= use the in-core resowner facility for EVP.

Justin Pryzby sent in another revision of a= patch to allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly.

Keisuke Kuroda sent in a patch to fix a bug= that manifested as huge memory consumption on partitioned table with FKs by reducing the size of the ri SPI plan hash.

Konstantin Knizhnik sent in two more revisi= ons of a patch to implement custom compression for libpq.

Takamichi Osumi sent in another revision of= a patch to make it possible to disable WAL logging to speed up bulk loads.

Nathan Bossart sent in two revisions of a p= atch to add a FAST option to CHECKPOINT.

Amit Kapila, Ajin Cherian, and Peter Smith = traded patches to implement logical decoding for two-phase transactions.

David Rowley sent in a patch to define pg_a= ttribute_cold and pg_attribute_hot to be empty macros on minGW 8.1 so as to avoid a bug in that toolchain.

Li Japin sent in another revision of a patc= h to allow terminating the idle sessions via a new GUC, idle_session_timeout, and call setitimer() less oft= en.

Euler Taveira de Oliveira sent in a patch t= o add logical decoding messages to pgoutput, add xid to messages when streaming, explain why LOGICAL_REP_MSG_MESSAGE is ignored, simplify the parse_output_parameters function to take a whole PGOutputData instead of bits and pieces, adjust in_streaming for messages, and overhaul the tests to take account for all t= his.

Peter Eisentraut sent in another revision o= f a patch to add a result_format_auto_binary_types setting.

Micha=C3=ABl Paquier sent in another revisi= on of a patch to fix a problem that manifested as vac_update_datfrozenxid will raise "wrong tuple length" if pg_database tuple contains toast attribute.

Kyotaro HORIGUCHI sent in another revision = of a patch to fix handling of NaN in the geometry types.

Masahiko Sawada sent in another revision of= a patch to enable two-phase commit for multiple foreign servers.

Daniel Gustafsson sent in another revision = of a patch to make it possible to enable and disable data checksums online.

Alexander Korotkov sent in a patch to imple= ment a built-in infrastructure for reproduction of concurrency issues in automated test suites. Central to this infrastructure are "stop events," which which are special places in the cod= e, where the execution could be stopped on some condition.

Peter Eisentraut sent in another revision o= f a patch to implement SEARCH and CYCLE clauses in common table expressions per the SQL standard.

Thomas Munro sent in another revision of a = patch to get latches to send fewer signals, use SIGURG rather than SIGUSR1 for latches, use signalfd for epoll latches, and use EVFILT_SIGNAL for kqueue latches.

Tom Lane sent in another revision of a patc= h to report GUC changes at query end.

Peter Smith sent in a patch to use enums fo= r message types.

David Zhang sent in three revisions of a pa= tch to add table access method as an option to pgbench.

Anastasia Lubennikova sent in a patch to ha= ndle negative number of tuples passed to normal_rand().

Peter Eisentraut sent in a patch to pageins= pect to change the block number arguments to bigint.

Bertrand Drouvot sent in four more revision= s of a patch to make it possible to log the standby recovery conflict waits via a new GUC, log_recovery_conflict_waits.

Kasahara Tatsuhito sent in three more revis= ions of a patch to fix a bug that manifested as an autovacuum issue with large numbers of tables.

Masahiko Sawada sent in another revision of= a patch to add basic statistics to the pg_stat_wal view.

Takamichi Osumi sent in a patch to prevent = a scenario that archive recovery hits WALs which come from wal_level=3Dminimal and the server continues to work, = which condition could cause data not to be replicated.

Euler Taveira de Oliveira sent in a patch t= o remove temporary files after a backend crash in order to avert ENOSPC conditions that could result from multiple crashes.

Pavel Borisov sent in another revision of a= patch to implement covering indexes using the SP-GiST index access method.

Kirk Jamison sent in another revision of a = patch to prevent invalidating blocks in smgrextend() during recovery, add a bool parameter in smgrnblocks() for cached blocks, slim down DropRelFileNodeBuffers() during recovery by avoidi= ng scanning the whole buffer pool when the relation is small enough or the the total number of blocks to be invalidated is below the threshold of full scanning, and getting DropRelFileNodesAllBuffers() to skip the time-consumi= ng scan of the whole buffer pool during recovery when the relation is small en= ough, or when the number of blocks to be invalidated is below the full scan thres= hold.

Krunal Bauskar and Alexander Korotkov trade= d patches to improve the spinlock implementation on ARM.

Arne Roland sent in three revisions of a pa= tch to ensure that renaming a trigger on a partitioned table also renames triggers on the partitions.

Bharath Rupireddy sent in a patch to fix th= e error message for pg_workers shutting down so it talks about background workers instead of the non-exist= ent connections that apply to other cases.

Stephen Frost sent in another revision of a= patch to add GSS information to the connection authorized log message, if needed.

Michael Banck sent in a patch to clarify th= e fact that CREATEROLE roles can GRANT default roles.

Ashutosh Bapat and Alexander Korotkov trade= d patches to make it easy to print LSNs.

Andreas Karlsson sent in a PoC patch to fix= the fact that the inet/cidr support shipped broken by throwing away netmask information in the btree_gist suppl= ied extension.

Pavel St=C4=9Bhule and Justin Pryzby traded= patches to make it possible to read the tables to be dumped by pg_dump from a file.

Justin Pryzby sent in another revision of a= patch to make CLUSTER ON a separate dump object in pg_dump, implement CLUSTER for partitioned tables, propagate changes to indisclustered to child/parents, invalidate parent indexes, invalidate parent index cluster on attach, and preserve indisclustered on children of clustered, partitioned indexes.

Simon Riggs sent in another revision of a p= atch to add a FAST_FREEZE option to VACUUM.

Simon Riggs sent in a patch to implement on= e_freeze then max_freeze for lazy VACUUM.

Justin Pryzby sent in another revision of a= patch to make pg_ls_* show directories and shared filesets.

Justin Pryzby sent in another revision of a= patch to remove references to pg_dump's pre-8.1 switch behaviour.

Justin Pryzby sent in another revision of a= patch to allow CREATE INDEX CONCURRENTLY on partitioned tables, add a SKIPVALID flag for more integrati= on, and make ReindexPartitions() set indisvalid.

Paul A Jungwirth sent in two more revisions= of a patch to implement multiranges.

Dean Rasheed sent in another revision of a = patch to improve estimation of OR clauses.

James Coleman sent in a patch to error if g= ather merge paths aren't sufficiently sorted.

James Coleman sent in another revision of a= patch to ensure that generate_useful_gather_paths doesn't skip unsorted subpaths, enforce parall= el safety of pathkeys in generate_useful_gather_paths, disallow SRFs in proact= ive sort, remove the volatile expr target search on the grounds that it's not n= eeded then, and document find_em_expr_usable_for_sorting_rel in prepare_sort_from_pathkeys.

This email was sent to you from PWN. It was delivered on their behalf by the PostgreSQL project. Any questions about the content of the message shou= ld be sent to PWN.

You were sent this email as a subscriber of the pgsql-announce mai= linglist, for the content tag PWN. To unsubscribe from further emails, or change which emails you want to receive, please click th= e personal unsubscribe link that you can find in the headers of this email, or visit https://lists.postgresql.org/unsubscribe/.
 
--===============2891852917865834123==-- --===============8125541594290523673==--