Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4335990
Make EXEC_BACKEND more convenient on Linux and FreeBSD.
michaelpq Feb 8, 2023
976fdea
Stop recommending auto-download of DTD files, and indeed disable it.
tglsfdc Feb 8, 2023
32c8bec
Disable WindowAgg inverse transitions when subplans are present
david-rowley Feb 13, 2023
6b126f2
Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certific…
michaelpq Feb 15, 2023
1cdbdfc
Print the correct aliases for DML target tables in ruleutils.
tglsfdc Feb 17, 2023
1bf5956
Fix handling of multi-column BRIN indexes
tvondra Feb 18, 2023
19c4d0a
pgbench: Prepare commands in pipelines in advance
alvherre Feb 21, 2023
8f70694
Add missing support for the latest SPI status codes.
deanrasheed Feb 22, 2023
52fd7ad
Fix snapshot handling in logicalmsg_decode
tvondra Feb 22, 2023
9d08e8d
Don't repeatedly register cache callbacks in pgoutput plugin.
tglsfdc Feb 23, 2023
dfec68f
Fix mishandling of OLD/NEW references in subqueries in rule actions.
deanrasheed Feb 25, 2023
fcb2564
Don't force SQL_ASCII/no-locale for installcheck in vcregress.pl
adunstan Feb 26, 2023
fc9ab81
Harden postgres_fdw tests against unexpected cache flushes.
tglsfdc Feb 27, 2023
aa797f5
Avoid fetching one past the end of translate()'s "to" parameter.
tglsfdc Mar 1, 2023
4a37abb
pageinspect: Fix crash with gist_page_items()
michaelpq Mar 2, 2023
c31e116
Fix assert failures in parallel SERIALIZABLE READ ONLY.
macdice Mar 6, 2023
617de97
Fix more bugs caused by adding columns to the end of a view.
tglsfdc Mar 7, 2023
a523db9
Fix corruption due to vacuum_defer_cleanup_age underflowing 64bit xids
anarazel Mar 8, 2023
6541600
Fix race in SERIALIZABLE READ ONLY.
macdice Mar 9, 2023
bf4e922
Ensure COPY TO on an RLS-enabled table copies no more than it should.
tglsfdc Mar 10, 2023
00014ae
Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex.
tglsfdc Mar 11, 2023
4401ac6
amcheck: Fix ordering bug in update_cached_xid_range()
anarazel Mar 11, 2023
3f34791
amcheck: Fix FullTransactionIdFromXidAndCtx() for xids before epoch 0
anarazel Mar 11, 2023
5bd92f7
Mark unsafe_tests module as not runnable with installcheck
adunstan Mar 12, 2023
6fa9670
Fix inconsistent error handling for GSS encryption in PQconnectPoll()
michaelpq Mar 13, 2023
07c8755
Fix JSON error reporting for many cases of erroneous string values.
tglsfdc Mar 13, 2023
bf04ec5
Remove unnecessary code in dependency_is_compatible_expression().
tglsfdc Mar 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -15802,6 +15802,18 @@ if test "x$ac_cv_func_CRYPTO_lock" = xyes; then :
#define HAVE_CRYPTO_LOCK 1
_ACEOF

fi
done

# Function introduced in OpenSSL 1.1.1.
for ac_func in X509_get_signature_info
do :
ac_fn_c_check_func "$LINENO" "X509_get_signature_info" "ac_cv_func_X509_get_signature_info"
if test "x$ac_cv_func_X509_get_signature_info" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_X509_GET_SIGNATURE_INFO 1
_ACEOF

fi
done

Expand Down Expand Up @@ -16895,7 +16907,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
fi


for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/tas.h sys/uio.h sys/un.h termios.h ucred.h wctype.h
for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/tas.h sys/uio.h sys/un.h termios.h ucred.h wctype.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,8 @@ if test "$with_ssl" = openssl ; then
# thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
# function was removed.
AC_CHECK_FUNCS([CRYPTO_lock])
# Function introduced in OpenSSL 1.1.1.
AC_CHECK_FUNCS([X509_get_signature_info])
AC_DEFINE([USE_OPENSSL], 1, [Define to 1 to build with OpenSSL support. (--with-ssl=openssl)])
elif test "$with_ssl" != no ; then
AC_MSG_ERROR([--with-ssl must specify openssl])
Expand Down Expand Up @@ -1904,6 +1906,7 @@ AC_CHECK_HEADERS(m4_normalize([
sys/epoll.h
sys/event.h
sys/ipc.h
sys/personality.h
sys/prctl.h
sys/procctl.h
sys/pstat.h
Expand Down
38 changes: 32 additions & 6 deletions contrib/amcheck/verify_heapam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,14 +1577,40 @@ check_tuple(HeapCheckContext *ctx)
static FullTransactionId
FullTransactionIdFromXidAndCtx(TransactionId xid, const HeapCheckContext *ctx)
{
uint32 epoch;
uint64 nextfxid_i;
int32 diff;
FullTransactionId fxid;

Assert(TransactionIdIsNormal(ctx->next_xid));
Assert(FullTransactionIdIsNormal(ctx->next_fxid));
Assert(XidFromFullTransactionId(ctx->next_fxid) == ctx->next_xid);

if (!TransactionIdIsNormal(xid))
return FullTransactionIdFromEpochAndXid(0, xid);
epoch = EpochFromFullTransactionId(ctx->next_fxid);
if (xid > ctx->next_xid)
epoch--;
return FullTransactionIdFromEpochAndXid(epoch, xid);

nextfxid_i = U64FromFullTransactionId(ctx->next_fxid);

/* compute the 32bit modulo difference */
diff = (int32) (ctx->next_xid - xid);

/*
* In cases of corruption we might see a 32bit xid that is before epoch
* 0. We can't represent that as a 64bit xid, due to 64bit xids being
* unsigned integers, without the modulo arithmetic of 32bit xid. There's
* no really nice way to deal with that, but it works ok enough to use
* FirstNormalFullTransactionId in that case, as a freshly initdb'd
* cluster already has a newer horizon.
*/
if (diff > 0 && (nextfxid_i - FirstNormalTransactionId) < (int64) diff)
{
Assert(EpochFromFullTransactionId(ctx->next_fxid) == 0);
fxid = FirstNormalFullTransactionId;
}
else
fxid = FullTransactionIdFromU64(nextfxid_i - diff);

Assert(FullTransactionIdIsNormal(fxid));
return fxid;
}

/*
Expand All @@ -1600,8 +1626,8 @@ update_cached_xid_range(HeapCheckContext *ctx)
LWLockRelease(XidGenLock);

/* And compute alternate versions of the same */
ctx->oldest_fxid = FullTransactionIdFromXidAndCtx(ctx->oldest_xid, ctx);
ctx->next_xid = XidFromFullTransactionId(ctx->next_fxid);
ctx->oldest_fxid = FullTransactionIdFromXidAndCtx(ctx->oldest_xid, ctx);
}

/*
Expand Down
8 changes: 5 additions & 3 deletions contrib/pageinspect/expected/brin.out
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ SELECT * FROM brin_page_items(get_raw_page('test1_a_idx', 2), 'test1_a_idx')
1 | 0 | 1 | f | f | f | {1 .. 1}
(1 row)

-- Failure for non-BRIN index.
-- Mask DETAIL messages as these are not portable across architectures.
\set VERBOSITY terse
-- Failures for non-BRIN index.
CREATE INDEX test1_a_btree ON test1 (a);
SELECT brin_page_items(get_raw_page('test1_a_btree', 0), 'test1_a_btree');
ERROR: "test1_a_btree" is not a BRIN index
-- Mask DETAIL messages as these are not portable across architectures.
\set VERBOSITY terse
SELECT brin_page_items(get_raw_page('test1_a_btree', 0), 'test1_a_idx');
ERROR: input page is not a valid BRIN page
-- Invalid special area size
SELECT brin_page_type(get_raw_page('test1', 0));
ERROR: input page is not a valid BRIN page
Expand Down
10 changes: 6 additions & 4 deletions contrib/pageinspect/expected/gist.out
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ SELECT itemoffset, ctid, itemlen FROM gist_page_items_bytea(get_raw_page('test_g
2 | (2,65535) | 40
(2 rows)

-- Failure with non-GiST index.
-- Suppress the DETAIL message, to allow the tests to work across various
-- page sizes and architectures.
\set VERBOSITY terse
-- Failures with non-GiST index.
CREATE INDEX test_gist_btree on test_gist(t);
SELECT gist_page_items(get_raw_page('test_gist_btree', 0), 'test_gist_btree');
ERROR: "test_gist_btree" is not a GiST index
SELECT gist_page_items(get_raw_page('test_gist_btree', 0), 'test_gist_idx');
ERROR: input page is not a valid GiST page
-- Failure with various modes.
-- Suppress the DETAIL message, to allow the tests to work across various
-- page sizes and architectures.
\set VERBOSITY terse
-- invalid page size
SELECT gist_page_items_bytea('aaa'::bytea);
ERROR: invalid page size
Expand Down
82 changes: 40 additions & 42 deletions contrib/pageinspect/gistfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,20 @@ PG_FUNCTION_INFO_V1(gist_page_items_bytea);
#define ItemPointerGetDatum(X) PointerGetDatum(X)


Datum
gist_page_opaque_info(PG_FUNCTION_ARGS)
static Page verify_gist_page(bytea *raw_page);

/*
* Verify that the given bytea contains a GIST page or die in the attempt.
* A pointer to the page is returned.
*/
static Page
verify_gist_page(bytea *raw_page)
{
bytea *raw_page = PG_GETARG_BYTEA_P(0);
TupleDesc tupdesc;
Page page;
Page page = get_page_from_raw(raw_page);
GISTPageOpaque opaq;
HeapTuple resultTuple;
Datum values[4];
bool nulls[4];
Datum flags[16];
int nflags = 0;
uint16 flagbits;

if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to use raw page functions")));

page = get_page_from_raw(raw_page);

if (PageIsNew(page))
PG_RETURN_NULL();
return page;

/* verify the special space has the expected size */
if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GISTPageOpaqueData)))
Expand All @@ -76,12 +67,38 @@ gist_page_opaque_info(PG_FUNCTION_ARGS)
GIST_PAGE_ID,
opaq->gist_page_id)));

return page;
}

Datum
gist_page_opaque_info(PG_FUNCTION_ARGS)
{
bytea *raw_page = PG_GETARG_BYTEA_P(0);
TupleDesc tupdesc;
Page page;
HeapTuple resultTuple;
Datum values[4];
bool nulls[4];
Datum flags[16];
int nflags = 0;
uint16 flagbits;

if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to use raw page functions")));

page = verify_gist_page(raw_page);

if (PageIsNew(page))
PG_RETURN_NULL();

/* Build a tuple descriptor for our result type */
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");

/* Convert the flags bitmask to an array of human-readable names */
flagbits = opaq->flags;
flagbits = GistPageGetOpaque(page)->flags;
if (flagbits & F_LEAF)
flags[nflags++] = CStringGetTextDatum("leaf");
if (flagbits & F_DELETED)
Expand All @@ -103,7 +120,7 @@ gist_page_opaque_info(PG_FUNCTION_ARGS)

values[0] = LSNGetDatum(PageGetLSN(page));
values[1] = LSNGetDatum(GistPageGetNSN(page));
values[2] = Int64GetDatum(opaq->rightlink);
values[2] = Int64GetDatum(GistPageGetOpaque(page)->rightlink);
values[3] = PointerGetDatum(construct_array(flags, nflags,
TEXTOID,
-1, false, TYPALIGN_INT));
Expand All @@ -124,7 +141,6 @@ gist_page_items_bytea(PG_FUNCTION_ARGS)
Tuplestorestate *tupstore;
MemoryContext oldcontext;
Page page;
GISTPageOpaque opaq;
OffsetNumber offset;
OffsetNumber maxoff = InvalidOffsetNumber;

Expand Down Expand Up @@ -157,29 +173,11 @@ gist_page_items_bytea(PG_FUNCTION_ARGS)

MemoryContextSwitchTo(oldcontext);

page = get_page_from_raw(raw_page);
page = verify_gist_page(raw_page);

if (PageIsNew(page))
PG_RETURN_NULL();

/* verify the special space has the expected size */
if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GISTPageOpaqueData)))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("input page is not a valid %s page", "GiST"),
errdetail("Expected special size %d, got %d.",
(int) MAXALIGN(sizeof(GISTPageOpaqueData)),
(int) PageGetSpecialSize(page))));

opaq = (GISTPageOpaque) PageGetSpecialPointer(page);
if (opaq->gist_page_id != GIST_PAGE_ID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("input page is not a valid %s page", "GiST"),
errdetail("Expected %08x, got %08x.",
GIST_PAGE_ID,
opaq->gist_page_id)));

/* Avoid bogus PageGetMaxOffsetNumber() call with deleted pages */
if (GistPageIsDeleted(page))
elog(NOTICE, "page is deleted");
Expand Down Expand Up @@ -276,7 +274,7 @@ gist_page_items(PG_FUNCTION_ARGS)
errmsg("\"%s\" is not a %s index",
RelationGetRelationName(indexRel), "GiST")));

page = get_page_from_raw(raw_page);
page = verify_gist_page(raw_page);

if (PageIsNew(page))
{
Expand Down
8 changes: 5 additions & 3 deletions contrib/pageinspect/sql/brin.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ SELECT * FROM brin_revmap_data(get_raw_page('test1_a_idx', 1)) LIMIT 5;
SELECT * FROM brin_page_items(get_raw_page('test1_a_idx', 2), 'test1_a_idx')
ORDER BY blknum, attnum LIMIT 5;

-- Failure for non-BRIN index.
-- Mask DETAIL messages as these are not portable across architectures.
\set VERBOSITY terse

-- Failures for non-BRIN index.
CREATE INDEX test1_a_btree ON test1 (a);
SELECT brin_page_items(get_raw_page('test1_a_btree', 0), 'test1_a_btree');
SELECT brin_page_items(get_raw_page('test1_a_btree', 0), 'test1_a_idx');

-- Mask DETAIL messages as these are not portable across architectures.
\set VERBOSITY terse
-- Invalid special area size
SELECT brin_page_type(get_raw_page('test1', 0));
SELECT * FROM brin_metapage_info(get_raw_page('test1', 0));
Expand Down
10 changes: 6 additions & 4 deletions contrib/pageinspect/sql/gist.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 1), 'test_gist_idx')
-- platform-dependent (endianess), so omit the actual key data from the output.
SELECT itemoffset, ctid, itemlen FROM gist_page_items_bytea(get_raw_page('test_gist_idx', 0));

-- Failure with non-GiST index.
-- Suppress the DETAIL message, to allow the tests to work across various
-- page sizes and architectures.
\set VERBOSITY terse

-- Failures with non-GiST index.
CREATE INDEX test_gist_btree on test_gist(t);
SELECT gist_page_items(get_raw_page('test_gist_btree', 0), 'test_gist_btree');
SELECT gist_page_items(get_raw_page('test_gist_btree', 0), 'test_gist_idx');

-- Failure with various modes.
-- Suppress the DETAIL message, to allow the tests to work across various
-- page sizes and architectures.
\set VERBOSITY terse
-- invalid page size
SELECT gist_page_items_bytea('aaa'::bytea);
SELECT gist_page_items('aaa'::bytea, 'test_gist_idx'::regclass);
Expand Down
14 changes: 7 additions & 7 deletions contrib/pax_storage/src/test/regress/expected/alter_table.out
Original file line number Diff line number Diff line change
Expand Up @@ -2628,20 +2628,20 @@ View definition:
FROM at_view_1 v1;

explain (verbose, costs off) select * from at_view_2;
QUERY PLAN
----------------------------------------------------------------------
QUERY PLAN
-------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
Output: bt.id, bt.stuff, (to_json(ROW(bt.id, bt.stuff, NULL)))
Output: bt.id, bt.stuff, (to_json(ROW(bt.id, bt.stuff, 4)))
-> Seq Scan on public.at_base_table bt
Output: bt.id, bt.stuff, to_json(ROW(bt.id, bt.stuff, NULL))
Output: bt.id, bt.stuff, to_json(ROW(bt.id, bt.stuff, 4))
Optimizer: Postgres query optimizer
Settings: constraint_exclusion=partition
(6 rows)

select * from at_view_2;
id | stuff | j
----+--------+----------------------------------------
23 | skidoo | {"id":23,"stuff":"skidoo","more":null}
id | stuff | j
----+--------+-------------------------------------
23 | skidoo | {"id":23,"stuff":"skidoo","more":4}
(1 row)

drop view at_view_2;
Expand Down
6 changes: 6 additions & 0 deletions contrib/pg_trgm/expected/pg_word_trgm.out
Original file line number Diff line number Diff line change
Expand Up @@ -1048,3 +1048,9 @@ select t,word_similarity('Kabankala',t) as sml from test_trgm2 where t %> 'Kaban
Waikala | 0.3
(89 rows)

-- test unsatisfiable pattern
select * from test_trgm2 where t ~ '.*$x';
t
---
(0 rows)

3 changes: 3 additions & 0 deletions contrib/pg_trgm/sql/pg_word_trgm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ select t,word_similarity('Baykal',t) as sml from test_trgm2 where 'Baykal' <% t
select t,word_similarity('Kabankala',t) as sml from test_trgm2 where 'Kabankala' <% t order by sml desc, t;
select t,word_similarity('Baykal',t) as sml from test_trgm2 where t %> 'Baykal' order by sml desc, t;
select t,word_similarity('Kabankala',t) as sml from test_trgm2 where t %> 'Kabankala' order by sml desc, t;

-- test unsatisfiable pattern
select * from test_trgm2 where t ~ '.*$x';
Loading
Loading