Skip to content

Commit 05f5c08

Browse files
committed
Update Postgres 14 to 14.20
See https://www.postgresql.org/docs/release/14.20/ for release notes.
2 parents d30f649 + 9ad034b commit 05f5c08

File tree

170 files changed

+12367
-8963
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+12367
-8963
lines changed

.abi-compliance-history

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Reference point for ABI compliance checks
2+
#
3+
# This file lists commits on the current branch that break ABI compatibility in
4+
# ways that have been deemed acceptable (e.g., removing an extern function with
5+
# no third-party uses). The primary intent of this file is to control the ABI
6+
# compliance checks on the buildfarm, but it also serves as a central location
7+
# to document the justification for each.
8+
#
9+
# In general, entries should be added reactively after an abi-compliance-check
10+
# buildfarm failure. It is important to verify the details of the breakage
11+
# match expectations, as the first entry listed will become the updated ABI
12+
# baseline point.
13+
#
14+
# Add new entries by adding the output of the following to the top of the file:
15+
#
16+
# $ git log --pretty=format:"%H%n#%n# %s%n# %cd%n#%n# <ADD JUSTIFICATION HERE>" $ABIBREAKGITHASH -1 --date=iso
17+
#
18+
# Be sure to replace "<ADD JUSTIFICATION HERE>" with details of your change and
19+
# why it is deemed acceptable.
20+
21+
983b3636259b1502121cbae99d8a2f0d0515d87d
22+
#
23+
# Fix re-distributing previously distributed invalidation messages during logical decoding.
24+
# 2025-06-16 17:35:50 -0700
25+
#
26+
# This is the original ABI baseline point for REL_14_STABLE. The first entry
27+
# would ordinarily point to something just before the .0 release, but this file
28+
# was first added in October 2025, and we're unlikely to act upon ABI breaks in
29+
# released minor versions, so we've chosen to truncate the ABI history to start
30+
# with the most recent ABI break documented in the git commit history.

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#
1515
# $ git log --pretty=format:"%H # %cd%n# %s" $PGINDENTGITHASH -1 --date=iso
1616

17+
e95010a9c0bad33cca21d762dd1151167993fd37 # 2025-10-21 09:56:26 -0500
18+
# Re-pgindent brin.c.
19+
1720
e1c1c30f635390b6a3ae4993e8cac213a33e6e3f # 2021-06-28 11:05:54 -0400
1821
# Pre branch pgindent / pgperltidy run
1922

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for PostgreSQL 14.19.
3+
# Generated by GNU Autoconf 2.69 for PostgreSQL 14.20.
44
#
55
# Report bugs to <pgsql-bugs@lists.postgresql.org>.
66
#
@@ -582,8 +582,8 @@ MAKEFLAGS=
582582
# Identity of this package.
583583
PACKAGE_NAME='PostgreSQL'
584584
PACKAGE_TARNAME='postgresql'
585-
PACKAGE_VERSION='14.19'
586-
PACKAGE_STRING='PostgreSQL 14.19'
585+
PACKAGE_VERSION='14.20'
586+
PACKAGE_STRING='PostgreSQL 14.20'
587587
PACKAGE_BUGREPORT='pgsql-bugs@lists.postgresql.org'
588588
PACKAGE_URL='https://www.postgresql.org/'
589589

@@ -1445,7 +1445,7 @@ if test "$ac_init_help" = "long"; then
14451445
# Omit some internal or obsolete options to make the list less imposing.
14461446
# This message is too long to be a string in the A/UX 3.1 sh.
14471447
cat <<_ACEOF
1448-
\`configure' configures PostgreSQL 14.19 to adapt to many kinds of systems.
1448+
\`configure' configures PostgreSQL 14.20 to adapt to many kinds of systems.
14491449

14501450
Usage: $0 [OPTION]... [VAR=VALUE]...
14511451

@@ -1510,7 +1510,7 @@ fi
15101510

15111511
if test -n "$ac_init_help"; then
15121512
case $ac_init_help in
1513-
short | recursive ) echo "Configuration of PostgreSQL 14.19:";;
1513+
short | recursive ) echo "Configuration of PostgreSQL 14.20:";;
15141514
esac
15151515
cat <<\_ACEOF
15161516

@@ -1682,7 +1682,7 @@ fi
16821682
test -n "$ac_init_help" && exit $ac_status
16831683
if $ac_init_version; then
16841684
cat <<\_ACEOF
1685-
PostgreSQL configure 14.19
1685+
PostgreSQL configure 14.20
16861686
generated by GNU Autoconf 2.69
16871687

16881688
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2435,7 +2435,7 @@ cat >config.log <<_ACEOF
24352435
This file contains any messages produced by compilers while
24362436
running configure, to aid debugging if configure makes a mistake.
24372437

2438-
It was created by PostgreSQL $as_me 14.19, which was
2438+
It was created by PostgreSQL $as_me 14.20, which was
24392439
generated by GNU Autoconf 2.69. Invocation command line was
24402440

24412441
$ $0 $@
@@ -20763,7 +20763,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2076320763
# report actual input values of CONFIG_FILES etc. instead of their
2076420764
# values after options handling.
2076520765
ac_log="
20766-
This file was extended by PostgreSQL $as_me 14.19, which was
20766+
This file was extended by PostgreSQL $as_me 14.20, which was
2076720767
generated by GNU Autoconf 2.69. Invocation command line was
2076820768

2076920769
CONFIG_FILES = $CONFIG_FILES
@@ -20834,7 +20834,7 @@ _ACEOF
2083420834
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2083520835
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
2083620836
ac_cs_version="\\
20837-
PostgreSQL config.status 14.19
20837+
PostgreSQL config.status 14.20
2083820838
configured by $0, generated by GNU Autoconf 2.69,
2083920839
with options \\"\$ac_cs_config\\"
2084020840

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dnl Read the Autoconf manual for details.
1717
dnl
1818
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
1919

20-
AC_INIT([PostgreSQL], [14.19], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
20+
AC_INIT([PostgreSQL], [14.20], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
2121

2222
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
2323
Untested combinations of 'autoconf' and PostgreSQL versions are not

contrib/pg_buffercache/pg_buffercache_pages.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "access/htup_details.h"
1212
#include "catalog/pg_type.h"
1313
#include "funcapi.h"
14+
#include "miscadmin.h"
1415
#include "storage/buf_internals.h"
1516
#include "storage/bufmgr.h"
1617

@@ -148,6 +149,8 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
148149
BufferDesc *bufHdr;
149150
uint32 buf_state;
150151

152+
CHECK_FOR_INTERRUPTS();
153+
151154
bufHdr = GetBufferDescriptor(i);
152155
/* Lock each buffer header before inspecting. */
153156
buf_state = LockBufHdr(bufHdr);

contrib/pg_prewarm/pg_prewarm.c

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
#include <unistd.h>
1717

1818
#include "access/relation.h"
19+
#include "catalog/index.h"
1920
#include "fmgr.h"
2021
#include "miscadmin.h"
2122
#include "optimizer/cost.h"
2223
#include "storage/bufmgr.h"
24+
#include "storage/lmgr.h"
2325
#include "storage/smgr.h"
2426
#include "utils/acl.h"
2527
#include "utils/builtins.h"
@@ -69,6 +71,8 @@ pg_prewarm(PG_FUNCTION_ARGS)
6971
char *ttype;
7072
PrewarmType ptype;
7173
AclResult aclresult;
74+
char relkind;
75+
Oid privOid;
7276

7377
/* Basic sanity checking. */
7478
if (PG_ARGISNULL(0))
@@ -104,9 +108,43 @@ pg_prewarm(PG_FUNCTION_ARGS)
104108
forkString = text_to_cstring(forkName);
105109
forkNumber = forkname_to_number(forkString);
106110

107-
/* Open relation and check privileges. */
111+
/*
112+
* Open relation and check privileges. If the relation is an index, we
113+
* must check the privileges on its parent table instead.
114+
*/
115+
relkind = get_rel_relkind(relOid);
116+
if (relkind == RELKIND_INDEX ||
117+
relkind == RELKIND_PARTITIONED_INDEX)
118+
{
119+
privOid = IndexGetRelation(relOid, true);
120+
121+
/* Lock table before index to avoid deadlock. */
122+
if (OidIsValid(privOid))
123+
LockRelationOid(privOid, AccessShareLock);
124+
}
125+
else
126+
privOid = relOid;
127+
108128
rel = relation_open(relOid, AccessShareLock);
109-
aclresult = pg_class_aclcheck(relOid, GetUserId(), ACL_SELECT);
129+
130+
/*
131+
* It's possible that the relation with OID "privOid" was dropped and the
132+
* OID was reused before we locked it. If that happens, we could be left
133+
* with the wrong parent table OID, in which case we must ERROR. It's
134+
* possible that such a race would change the outcome of
135+
* get_rel_relkind(), too, but the worst case scenario there is that we'll
136+
* check privileges on the index instead of its parent table, which isn't
137+
* too terrible.
138+
*/
139+
if (!OidIsValid(privOid) ||
140+
(privOid != relOid &&
141+
privOid != IndexGetRelation(relOid, true)))
142+
ereport(ERROR,
143+
(errcode(ERRCODE_UNDEFINED_TABLE),
144+
errmsg("could not find parent table of index \"%s\"",
145+
RelationGetRelationName(rel))));
146+
147+
aclresult = pg_class_aclcheck(privOid, GetUserId(), ACL_SELECT);
110148
if (aclresult != ACLCHECK_OK)
111149
aclcheck_error(aclresult, get_relkind_objtype(rel->rd_rel->relkind), get_rel_name(relOid));
112150

@@ -211,8 +249,11 @@ pg_prewarm(PG_FUNCTION_ARGS)
211249
}
212250
}
213251

214-
/* Close relation, release lock. */
252+
/* Close relation, release locks. */
215253
relation_close(rel, AccessShareLock);
216254

255+
if (privOid != relOid)
256+
UnlockRelationOid(privOid, AccessShareLock);
257+
217258
PG_RETURN_INT64(blocks_done);
218259
}

contrib/pg_trgm/expected/pg_trgm.out

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4693,6 +4693,23 @@ select count(*) from test_trgm where t like '%99%' and t like '%qw%';
46934693
19
46944694
(1 row)
46954695

4696+
explain (costs off)
4697+
select count(*) from test_trgm where t %> '' and t %> '%qwerty%';
4698+
QUERY PLAN
4699+
-------------------------------------------------------------------------
4700+
Aggregate
4701+
-> Bitmap Heap Scan on test_trgm
4702+
Recheck Cond: ((t %> ''::text) AND (t %> '%qwerty%'::text))
4703+
-> Bitmap Index Scan on trgm_idx
4704+
Index Cond: ((t %> ''::text) AND (t %> '%qwerty%'::text))
4705+
(5 rows)
4706+
4707+
select count(*) from test_trgm where t %> '' and t %> '%qwerty%';
4708+
count
4709+
-------
4710+
0
4711+
(1 row)
4712+
46964713
-- ensure that pending-list items are handled correctly, too
46974714
create temp table t_test_trgm(t text COLLATE "C");
46984715
create index t_trgm_idx on t_test_trgm using gin (t gin_trgm_ops);
@@ -4731,6 +4748,23 @@ select count(*) from t_test_trgm where t like '%99%' and t like '%qw%';
47314748
1
47324749
(1 row)
47334750

4751+
explain (costs off)
4752+
select count(*) from t_test_trgm where t %> '' and t %> '%qwerty%';
4753+
QUERY PLAN
4754+
-------------------------------------------------------------------------
4755+
Aggregate
4756+
-> Bitmap Heap Scan on t_test_trgm
4757+
Recheck Cond: ((t %> ''::text) AND (t %> '%qwerty%'::text))
4758+
-> Bitmap Index Scan on t_trgm_idx
4759+
Index Cond: ((t %> ''::text) AND (t %> '%qwerty%'::text))
4760+
(5 rows)
4761+
4762+
select count(*) from t_test_trgm where t %> '' and t %> '%qwerty%';
4763+
count
4764+
-------
4765+
0
4766+
(1 row)
4767+
47344768
-- run the same queries with sequential scan to check the results
47354769
set enable_bitmapscan=off;
47364770
set enable_seqscan=on;
@@ -4746,6 +4780,12 @@ select count(*) from test_trgm where t like '%99%' and t like '%qw%';
47464780
19
47474781
(1 row)
47484782

4783+
select count(*) from test_trgm where t %> '' and t %> '%qwerty%';
4784+
count
4785+
-------
4786+
0
4787+
(1 row)
4788+
47494789
select count(*) from t_test_trgm where t like '%99%' and t like '%qwerty%';
47504790
count
47514791
-------
@@ -4758,6 +4798,12 @@ select count(*) from t_test_trgm where t like '%99%' and t like '%qw%';
47584798
1
47594799
(1 row)
47604800

4801+
select count(*) from t_test_trgm where t %> '' and t %> '%qwerty%';
4802+
count
4803+
-------
4804+
0
4805+
(1 row)
4806+
47614807
reset enable_bitmapscan;
47624808
create table test2(t text COLLATE "C");
47634809
insert into test2 values ('abcdef');

contrib/pg_trgm/sql/pg_trgm.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ select count(*) from test_trgm where t like '%99%' and t like '%qwerty%';
8080
explain (costs off)
8181
select count(*) from test_trgm where t like '%99%' and t like '%qw%';
8282
select count(*) from test_trgm where t like '%99%' and t like '%qw%';
83+
explain (costs off)
84+
select count(*) from test_trgm where t %> '' and t %> '%qwerty%';
85+
select count(*) from test_trgm where t %> '' and t %> '%qwerty%';
8386
-- ensure that pending-list items are handled correctly, too
8487
create temp table t_test_trgm(t text COLLATE "C");
8588
create index t_trgm_idx on t_test_trgm using gin (t gin_trgm_ops);
@@ -90,14 +93,19 @@ select count(*) from t_test_trgm where t like '%99%' and t like '%qwerty%';
9093
explain (costs off)
9194
select count(*) from t_test_trgm where t like '%99%' and t like '%qw%';
9295
select count(*) from t_test_trgm where t like '%99%' and t like '%qw%';
96+
explain (costs off)
97+
select count(*) from t_test_trgm where t %> '' and t %> '%qwerty%';
98+
select count(*) from t_test_trgm where t %> '' and t %> '%qwerty%';
9399

94100
-- run the same queries with sequential scan to check the results
95101
set enable_bitmapscan=off;
96102
set enable_seqscan=on;
97103
select count(*) from test_trgm where t like '%99%' and t like '%qwerty%';
98104
select count(*) from test_trgm where t like '%99%' and t like '%qw%';
105+
select count(*) from test_trgm where t %> '' and t %> '%qwerty%';
99106
select count(*) from t_test_trgm where t like '%99%' and t like '%qwerty%';
100107
select count(*) from t_test_trgm where t like '%99%' and t like '%qw%';
108+
select count(*) from t_test_trgm where t %> '' and t %> '%qwerty%';
101109
reset enable_bitmapscan;
102110

103111
create table test2(t text COLLATE "C");

contrib/pgstattuple/pgstattuple.c

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ pgstat_btree_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno,
434434
/* fully empty page */
435435
stat->free_space += BLCKSZ;
436436
}
437-
else
437+
else if (PageGetSpecialSize(page) == MAXALIGN(sizeof(BTPageOpaqueData)))
438438
{
439439
BTPageOpaque opaque;
440440

@@ -468,10 +468,16 @@ pgstat_hash_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno,
468468
Buffer buf;
469469
Page page;
470470

471-
buf = _hash_getbuf_with_strategy(rel, blkno, HASH_READ, 0, bstrategy);
471+
buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy);
472+
LockBuffer(buf, HASH_READ);
472473
page = BufferGetPage(buf);
473474

474-
if (PageGetSpecialSize(page) == MAXALIGN(sizeof(HashPageOpaqueData)))
475+
if (PageIsNew(page))
476+
{
477+
/* fully empty page */
478+
stat->free_space += BLCKSZ;
479+
}
480+
else if (PageGetSpecialSize(page) == MAXALIGN(sizeof(HashPageOpaqueData)))
475481
{
476482
HashPageOpaque opaque;
477483

@@ -512,17 +518,23 @@ pgstat_gist_page(pgstattuple_type *stat, Relation rel, BlockNumber blkno,
512518

513519
buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy);
514520
LockBuffer(buf, GIST_SHARE);
515-
gistcheckpage(rel, buf);
516521
page = BufferGetPage(buf);
517-
518-
if (GistPageIsLeaf(page))
522+
if (PageIsNew(page))
519523
{
520-
pgstat_index_page(stat, page, FirstOffsetNumber,
521-
PageGetMaxOffsetNumber(page));
524+
/* fully empty page */
525+
stat->free_space += BLCKSZ;
522526
}
523-
else
527+
else if (PageGetSpecialSize(page) == MAXALIGN(sizeof(GISTPageOpaqueData)))
524528
{
525-
/* root or node */
529+
if (GistPageIsLeaf(page))
530+
{
531+
pgstat_index_page(stat, page, FirstOffsetNumber,
532+
PageGetMaxOffsetNumber(page));
533+
}
534+
else
535+
{
536+
/* root or node */
537+
}
526538
}
527539

528540
UnlockReleaseBuffer(buf);

contrib/postgres_fdw/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Generated subdirectories
22
/log/
33
/results/
4+
/output_iso/
45
/tmp_check/
6+
/tmp_check_iso/

0 commit comments

Comments
 (0)