pgsql: Free temporary memory when reading TOC

2022-02-09 Thread Daniel Gustafsson
Free temporary memory when reading TOC

ReadStr returns allocated memory which the caller is responsible for
freeing when done with the string. This commit ensures that memory is
freed in one case which used ReadStr in a conditional. While the leak
might not be too concerning, this makes the code consistent across all
ReadStr callsites in ReadToc. Due to the lack of complaints of issues
in production from this, no backpatch is performed at this point.

Author: Bharath Rupireddy, Georgios Kokolatos
Reviewed-by: Kyotaro Horiguchi
Discussion: 
https://postgr.es/m/oZwKiUxFsVaetG2xOJp7Hwao8F1AKIdfFDQLNJrnwoaxmjyB-45r_aYmhgXHKLcMI3GT24m9L6HafSi2ns7WFxXe0mw2_tIJpD-Z3vb_eyI=@pm.me

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/1a29217a00a34162ca0ffac336d83f28132330a6

Modified Files
--
src/bin/pg_dump/pg_backup_archiver.c | 16 +++-
1 file changed, 15 insertions(+), 1 deletion(-)



pgsql: Fix typo in archive modules docs

2022-02-09 Thread Daniel Gustafsson
Fix typo in archive modules docs

Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f48385c1327f1eaef134ad41b382041a79c5200a

Modified Files
--
doc/src/sgml/archive-modules.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Tag refs/tags/REL_12_10 was created

2022-02-09 Thread noreply
Tag refs/tags/REL_12_10 was created.


pgsql: Tag refs/tags/REL_13_6 was created

2022-02-09 Thread noreply
Tag refs/tags/REL_13_6 was created.


pgsql: Tag refs/tags/REL_14_2 was created

2022-02-09 Thread noreply
Tag refs/tags/REL_14_2 was created.


pgsql: Tag refs/tags/REL_11_15 was created

2022-02-09 Thread noreply
Tag refs/tags/REL_11_15 was created.


pgsql: Tag refs/tags/REL_10_20 was created

2022-02-09 Thread noreply
Tag refs/tags/REL_10_20 was created.


pgsql: Test honestly for .

2022-02-09 Thread Tom Lane
Test honestly for .

Commit 6a2a70a02 supposed that any platform having 
would also have .  It turns out there are still a
few people using platforms where that's not so, so we'd better make
a separate configure probe for it.  But since it took this long to
notice, I'm content with the decision to not have a separate code
path for epoll-only machines; we'll just fall back to using poll()
for these stragglers.

Per gripe from Gabriela Serventi.  Back-patch to v14 where this
code came in.

Discussion: 
https://postgr.es/m/CAHOHWE-JjJDfcYuLAAEO7Jk07atFAU47z8TzHzg71gbC0aMy=g...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c5f5b4dd4b5ccecd193550530ff483f16f95746b

Modified Files
--
configure   | 2 +-
configure.ac| 1 +
src/backend/storage/ipc/latch.c | 9 -
src/include/pg_config.h.in  | 3 +++
src/tools/msvc/Solution.pm  | 1 +
5 files changed, 10 insertions(+), 6 deletions(-)



pgsql: Test honestly for .

2022-02-09 Thread Tom Lane
Test honestly for .

Commit 6a2a70a02 supposed that any platform having 
would also have .  It turns out there are still a
few people using platforms where that's not so, so we'd better make
a separate configure probe for it.  But since it took this long to
notice, I'm content with the decision to not have a separate code
path for epoll-only machines; we'll just fall back to using poll()
for these stragglers.

Per gripe from Gabriela Serventi.  Back-patch to v14 where this
code came in.

Discussion: 
https://postgr.es/m/CAHOHWE-JjJDfcYuLAAEO7Jk07atFAU47z8TzHzg71gbC0aMy=g...@mail.gmail.com

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/c23461a22a1ead0a34dc209c2918ec4ccaf61475

Modified Files
--
configure   | 2 +-
configure.ac| 1 +
src/backend/storage/ipc/latch.c | 9 -
src/include/pg_config.h.in  | 3 +++
src/tools/msvc/Solution.pm  | 1 +
5 files changed, 10 insertions(+), 6 deletions(-)



pgsql: Further tweaks for psql's new tab-completion logic.

2022-02-09 Thread Tom Lane
Further tweaks for psql's new tab-completion logic.

The behavior I proposed, of matching case only when only keywords
are available to complete, turns out to be too cute.  It adds about
as many problems as it removes.  Simplify down to ilmari's original
proposal of just always matching case when completing a keyword.

Also, I noticed while testing this that we've pessimized the behavior
for qualified GUC names: the code is insisting that they be
double-quoted, which was not the case before.  Fix that by treating
GUC names as verbatim matches instead of possibly-schema-qualified
names.  (While it's tempting to try to split qualified GUC names
so that we *could* treat them with the schema-qualified-name code
path, that really isn't going to work in light of guc.c's willingness
to allow more than two name components.)

Dagfinn Ilmari Mannsåker and Tom Lane

Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f0cd9097cfac435ec18ab2595c81f13a14736758

Modified Files
--
src/bin/psql/t/010_tab_completion.pl | 24 ++
src/bin/psql/tab-complete.c  | 63 ++--
2 files changed, 56 insertions(+), 31 deletions(-)



pgsql: Reduce more the number of calls to GetMaxBackends()

2022-02-09 Thread Michael Paquier
Reduce more the number of calls to GetMaxBackends()

Some of the code paths changed by aa64f23 can reduce the number of times
GetMaxBackends() is called.  The performance gain is marginal, but most
of the code changed by this commit already did that.  Hence, let's be
clean and apply the same rule everywhere, for consistency.

Some of the code paths, like in deadlock.c, involve only assertions.
These are left unchanged.

Reviewed-by: Nathan Bossart, Robert Haas
Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/4567596316d186c6e61c72df013797266fcac2f7

Modified Files
--
src/backend/commands/async.c  | 5 +++--
src/backend/storage/lmgr/lock.c   | 7 ---
src/backend/utils/adt/lockfuncs.c | 5 +++--
3 files changed, 10 insertions(+), 7 deletions(-)



pgsql: Fix typo in multixact.c

2022-02-09 Thread Michael Paquier
Fix typo in multixact.c

Introduced in aa64f23.

Author: Nathan Bossart
Discussion: https://postgr.es/m/20220209175338.GB1627503@nathanxps13

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0147fc7c8c92ee22910f40b1740425f43382bc95

Modified Files
--
src/backend/access/transam/multixact.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Use Test::Builder::todo_start(), replacing $::TODO.

2022-02-09 Thread Noah Misch
Use Test::Builder::todo_start(), replacing $::TODO.

Some pre-2017 Test::More versions need perfect $Test::Builder::Level
maintenance to find the variable.  Buildfarm member snapper reported an
overall failure that the file intended to hide via the TODO construct.
That trouble was reachable in v11 and v10.  For later branches, this
serves as defense in depth.  Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6da62ff14c57ec9ab68bc7fa590eca7b3d1bd671

Modified Files
--
src/bin/pgbench/t/023_cic_2pc.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Use Test::Builder::todo_start(), replacing $::TODO.

2022-02-09 Thread Noah Misch
Use Test::Builder::todo_start(), replacing $::TODO.

Some pre-2017 Test::More versions need perfect $Test::Builder::Level
maintenance to find the variable.  Buildfarm member snapper reported an
overall failure that the file intended to hide via the TODO construct.
That trouble was reachable in v11 and v10.  For later branches, this
serves as defense in depth.  Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/b3558cc96cd9714d879774d13c5bab12ef027864

Modified Files
--
contrib/amcheck/t/003_cic_2pc.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Fix back-patch of "Avoid race in RelationBuildDesc() ..."

2022-02-09 Thread Noah Misch
Fix back-patch of "Avoid race in RelationBuildDesc() ..."

The back-patch of commit fdd965d074d46765c295223b119ca437dbcac973 broke
CLOBBER_CACHE_ALWAYS for v9.6 through v13.  It updated the
InvalidateSystemCaches() call for CLOBBER_CACHE_RECURSIVELY, neglecting
the one for CLOBBER_CACHE_ALWAYS.  Back-patch to v13, v12, v11, and v10.

Reviewed by Tomas Vondra.  Reported by Tomas Vondra.

Discussion: 
https://postgr.es/m/[email protected]

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3cc89d9c3834c33f4ad3cf5d3083fd192f05c72c

Modified Files
--
src/backend/utils/cache/inval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix back-patch of "Avoid race in RelationBuildDesc() ..."

2022-02-09 Thread Noah Misch
Fix back-patch of "Avoid race in RelationBuildDesc() ..."

The back-patch of commit fdd965d074d46765c295223b119ca437dbcac973 broke
CLOBBER_CACHE_ALWAYS for v9.6 through v13.  It updated the
InvalidateSystemCaches() call for CLOBBER_CACHE_RECURSIVELY, neglecting
the one for CLOBBER_CACHE_ALWAYS.  Back-patch to v13, v12, v11, and v10.

Reviewed by Tomas Vondra.  Reported by Tomas Vondra.

Discussion: 
https://postgr.es/m/[email protected]

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/eac3c4007044f0bb6ee380d056931944611d22c2

Modified Files
--
src/backend/utils/cache/inval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Use Test::Builder::todo_start(), replacing $::TODO.

2022-02-09 Thread Noah Misch
Use Test::Builder::todo_start(), replacing $::TODO.

Some pre-2017 Test::More versions need perfect $Test::Builder::Level
maintenance to find the variable.  Buildfarm member snapper reported an
overall failure that the file intended to hide via the TODO construct.
That trouble was reachable in v11 and v10.  For later branches, this
serves as defense in depth.  Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3a32e53e1f383090f27b23d4356eb1d19172ef1b

Modified Files
--
contrib/amcheck/t/003_cic_2pc.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Fix back-patch of "Avoid race in RelationBuildDesc() ..."

2022-02-09 Thread Noah Misch
Fix back-patch of "Avoid race in RelationBuildDesc() ..."

The back-patch of commit fdd965d074d46765c295223b119ca437dbcac973 broke
CLOBBER_CACHE_ALWAYS for v9.6 through v13.  It updated the
InvalidateSystemCaches() call for CLOBBER_CACHE_RECURSIVELY, neglecting
the one for CLOBBER_CACHE_ALWAYS.  Back-patch to v13, v12, v11, and v10.

Reviewed by Tomas Vondra.  Reported by Tomas Vondra.

Discussion: 
https://postgr.es/m/[email protected]

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2d96a66c2eef76f44cc9f9eca1a611330e215dc0

Modified Files
--
src/backend/utils/cache/inval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix back-patch of "Avoid race in RelationBuildDesc() ..."

2022-02-09 Thread Noah Misch
Fix back-patch of "Avoid race in RelationBuildDesc() ..."

The back-patch of commit fdd965d074d46765c295223b119ca437dbcac973 broke
CLOBBER_CACHE_ALWAYS for v9.6 through v13.  It updated the
InvalidateSystemCaches() call for CLOBBER_CACHE_RECURSIVELY, neglecting
the one for CLOBBER_CACHE_ALWAYS.  Back-patch to v13, v12, v11, and v10.

Reviewed by Tomas Vondra.  Reported by Tomas Vondra.

Discussion: 
https://postgr.es/m/[email protected]

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1b8462bf1d097dfff2014b61d5d1ff6ca99d785d

Modified Files
--
src/backend/utils/cache/inval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Use Test::Builder::todo_start(), replacing $::TODO.

2022-02-09 Thread Noah Misch
Use Test::Builder::todo_start(), replacing $::TODO.

Some pre-2017 Test::More versions need perfect $Test::Builder::Level
maintenance to find the variable.  Buildfarm member snapper reported an
overall failure that the file intended to hide via the TODO construct.
That trouble was reachable in v11 and v10.  For later branches, this
serves as defense in depth.  Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1a83297d222487070386b55b032657345d7ec64a

Modified Files
--
contrib/amcheck/t/003_cic_2pc.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Use Test::Builder::todo_start(), replacing $::TODO.

2022-02-09 Thread Noah Misch
Use Test::Builder::todo_start(), replacing $::TODO.

Some pre-2017 Test::More versions need perfect $Test::Builder::Level
maintenance to find the variable.  Buildfarm member snapper reported an
overall failure that the file intended to hide via the TODO construct.
That trouble was reachable in v11 and v10.  For later branches, this
serves as defense in depth.  Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2373429975ac28307583f49416f8943e7c04c8ff

Modified Files
--
src/bin/pgbench/t/023_cic_2pc.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Use Test::Builder::todo_start(), replacing $::TODO.

2022-02-09 Thread Noah Misch
Use Test::Builder::todo_start(), replacing $::TODO.

Some pre-2017 Test::More versions need perfect $Test::Builder::Level
maintenance to find the variable.  Buildfarm member snapper reported an
overall failure that the file intended to hide via the TODO construct.
That trouble was reachable in v11 and v10.  For later branches, this
serves as defense in depth.  Back-patch to v10 (all supported versions).

Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/adbd00f7a59bcfbcd6907858499c94a27c6680ed

Modified Files
--
contrib/amcheck/t/003_cic_2pc.pl  | 3 ++-
src/test/recovery/t/027_stream_regress.pl | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)



Re: pgsql: TAP tests: check for postmaster.pid anyway when "pg_ctl start" f

2022-02-09 Thread Noah Misch
On Thu, Jan 20, 2022 at 05:30:44PM -0500, Tom Lane wrote:
> I wrote:
> > What I'm thinking of doing is inventing a "soft_stop" variant of
> > Cluster::stop that won't complain if pg_ctl stop fails, and then
> > having 017_shm's poll_start() call that before retrying the start
> > call.
> 
> I did that, modeling the details on Cluster::start's fail_ok option.

On AIX, this pair of commits added 5-10h of runtime to 017_shm.pl.

Before 6c4a890 or 4fdbf9a:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=hoverfly&dt=2022-01-19%2020%3A41%3A47
[21:14:17] t/017_shm.pl . ok 7360 ms ( 0.01 usr  
0.00 sys +  1.62 cusr  0.71 csys =  2.34 CPU)

After both:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=hoverfly&dt=2022-01-21%2021%3A03%3A28
[07:52:31] t/017_shm.pl . ok 36908794 ms ( 0.00 usr  
0.00 sys +  5.16 cusr 16.04 csys = 21.20 CPU)




Re: pgsql: TAP tests: check for postmaster.pid anyway when "pg_ctl start" f

2022-02-09 Thread Tom Lane
Noah Misch  writes:
> On AIX, this pair of commits added 5-10h of runtime to 017_shm.pl.

Ouch!  Do you have any idea why?

regards, tom lane




Re: pgsql: TAP tests: check for postmaster.pid anyway when "pg_ctl start" f

2022-02-09 Thread Noah Misch
On Wed, Feb 09, 2022 at 09:41:09PM -0500, Tom Lane wrote:
> Noah Misch  writes:
> > On AIX, this pair of commits added 5-10h of runtime to 017_shm.pl.
> 
> Ouch!  Do you have any idea why?

I do not.




Re: pgsql: TAP tests: check for postmaster.pid anyway when "pg_ctl start" f

2022-02-09 Thread Tom Lane
Noah Misch  writes:
> On Wed, Feb 09, 2022 at 09:41:09PM -0500, Tom Lane wrote:
>> Ouch!  Do you have any idea why?

> I do not.

OK, I'll look into it tomorrow.

regards, tom lane




pgsql: Add min() and max() aggregates for xid8.

2022-02-09 Thread Fujii Masao
Add min() and max() aggregates for xid8.

Bump catalog version.

Author: Ken Kato
Reviewed-by: Kyotaro Horiguchi, Fujii Masao
Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/400fc6b6487ddf16aa82c9d76e5cfbe64d94f660

Modified Files
--
doc/src/sgml/func.sgml   |  4 ++--
src/backend/utils/adt/xid.c  | 24 
src/include/catalog/catversion.h |  2 +-
src/include/catalog/pg_aggregate.dat |  6 ++
src/include/catalog/pg_proc.dat  | 12 
src/test/regress/expected/xid.out| 10 +-
src/test/regress/sql/xid.sql |  6 +-
7 files changed, 59 insertions(+), 5 deletions(-)