Skip to content

Commit

Permalink
merge: Merge REL_15_10 into POLARDB_15_STABLE (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck authored Dec 1, 2024
2 parents e614d51 + e8c78ed commit 35199b3
Show file tree
Hide file tree
Showing 297 changed files with 23,833 additions and 24,076 deletions.
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for PostgreSQL 15.8.
# Generated by GNU Autoconf 2.69 for PostgreSQL 15.10.
#
# Report bugs to <pgsql-bugs@lists.postgresql.org>.
#
Expand Down Expand Up @@ -582,8 +582,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='PostgreSQL'
PACKAGE_TARNAME='postgresql'
PACKAGE_VERSION='15.8'
PACKAGE_STRING='PostgreSQL 15.8'
PACKAGE_VERSION='15.10'
PACKAGE_STRING='PostgreSQL 15.10'
PACKAGE_BUGREPORT='pgsql-bugs@lists.postgresql.org'
PACKAGE_URL='https://www.postgresql.org/'

Expand Down Expand Up @@ -1462,7 +1462,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures PostgreSQL 15.8 to adapt to many kinds of systems.
\`configure' configures PostgreSQL 15.10 to adapt to many kinds of systems.

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

Expand Down Expand Up @@ -1527,7 +1527,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of PostgreSQL 15.8:";;
short | recursive ) echo "Configuration of PostgreSQL 15.10:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1706,7 +1706,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
PostgreSQL configure 15.8
PostgreSQL configure 15.10
generated by GNU Autoconf 2.69

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

It was created by PostgreSQL $as_me 15.8, which was
It was created by PostgreSQL $as_me 15.10, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -21106,7 +21106,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by PostgreSQL $as_me 15.8, which was
This file was extended by PostgreSQL $as_me 15.10, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -21177,7 +21177,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
PostgreSQL config.status 15.8
PostgreSQL config.status 15.10
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dnl Read the Autoconf manual for details.
dnl
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros

AC_INIT([PostgreSQL], [15.8], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
AC_INIT([PostgreSQL], [15.10], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])

m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
Untested combinations of 'autoconf' and PostgreSQL versions are not
Expand Down
1 change: 1 addition & 0 deletions contrib/bloom/blscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ blgetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
*/
bas = GetAccessStrategy(BAS_BULKREAD);
npages = RelationGetNumberOfBlocks(scan->indexRelation);
pgstat_count_index_scan(scan->indexRelation);

for (blkno = BLOOM_HEAD_BLKNO; blkno < npages; blkno++)
{
Expand Down
10 changes: 10 additions & 0 deletions contrib/pageinspect/expected/page.out
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,13 @@ SELECT page_checksum(decode(repeat('00', :block_size), 'hex'), 1);

(1 row)

-- tests for sequences
create sequence test_sequence start 72057594037927937;
select tuple_data_split('test_sequence'::regclass, t_data, t_infomask, t_infomask2, t_bits)
from heap_page_items(get_raw_page('test_sequence', 0));
tuple_data_split
-------------------------------------------------------
{"\\x0100000000000001","\\x0000000000000000","\\x00"}
(1 row)

drop sequence test_sequence;
6 changes: 5 additions & 1 deletion contrib/pageinspect/heapfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ tuple_data_split_internal(Oid relid, char *tupdata,
raw_attrs = initArrayResult(BYTEAOID, CurrentMemoryContext, false);
nattrs = tupdesc->natts;

if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
/*
* Sequences always use heap AM, but they don't show that in the catalogs.
*/
if (rel->rd_rel->relkind != RELKIND_SEQUENCE &&
rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));

Expand Down
6 changes: 6 additions & 0 deletions contrib/pageinspect/sql/page.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ SHOW block_size \gset
SELECT fsm_page_contents(decode(repeat('00', :block_size), 'hex'));
SELECT page_header(decode(repeat('00', :block_size), 'hex'));
SELECT page_checksum(decode(repeat('00', :block_size), 'hex'), 1);

-- tests for sequences
create sequence test_sequence start 72057594037927937;
select tuple_data_split('test_sequence'::regclass, t_data, t_infomask, t_infomask2, t_bits)
from heap_page_items(get_raw_page('test_sequence', 0));
drop sequence test_sequence;
3 changes: 3 additions & 0 deletions contrib/pg_trgm/expected/pg_trgm.out
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,9 @@ ERROR: value 2025 out of bounds for option "siglen"
DETAIL: Valid values are between "1" and "2024".
create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2024));
set enable_seqscan=off;
-- check index compatibility handling when opclass option is specified
alter table test_trgm alter column t type varchar(768);
alter table test_trgm alter column t type text;
select t,similarity(t,'qwertyu0988') as sml from test_trgm where t % 'qwertyu0988' order by sml desc, t;
t | sml
-------------+----------
Expand Down
4 changes: 4 additions & 0 deletions contrib/pg_trgm/sql/pg_trgm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2025));
create index trgm_idx on test_trgm using gist (t gist_trgm_ops(siglen=2024));
set enable_seqscan=off;

-- check index compatibility handling when opclass option is specified
alter table test_trgm alter column t type varchar(768);
alter table test_trgm alter column t type text;

select t,similarity(t,'qwertyu0988') as sml from test_trgm where t % 'qwertyu0988' order by sml desc, t;
select t,similarity(t,'gwertyu0988') as sml from test_trgm where t % 'gwertyu0988' order by sml desc, t;
select t,similarity(t,'gwertyu1988') as sml from test_trgm where t % 'gwertyu1988' order by sml desc, t;
Expand Down
25 changes: 25 additions & 0 deletions contrib/pgstattuple/expected/pgstattuple.out
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,31 @@ select pgstathashindex('test_partition_hash_idx');
(4,8,0,1,0,0,0,100)
(1 row)

-- these should work for sequences
create sequence test_sequence;
select count(*) from pgstattuple('test_sequence');
count
-------
1
(1 row)

select pg_relpages('test_sequence');
pg_relpages
-------------
1
(1 row)

-- these should fail for sequences
select pgstatindex('test_sequence');
ERROR: relation "test_sequence" is not a btree index
select pgstatginindex('test_sequence');
ERROR: relation "test_sequence" is not a GIN index
select pgstathashindex('test_sequence');
ERROR: relation "test_sequence" is not a hash index
select pgstattuple_approx('test_sequence');
ERROR: relation "test_sequence" is of wrong relation kind
DETAIL: This operation is not supported for sequences.
drop sequence test_sequence;
drop table test_partitioned;
drop view test_view;
drop foreign table test_foreign_table;
Expand Down
6 changes: 5 additions & 1 deletion contrib/pgstattuple/pgstattuple.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
pgstattuple_type stat = {0};
SnapshotData SnapshotDirty;

if (rel->rd_rel->relam != HEAP_TABLE_AM_OID)
/*
* Sequences always use heap AM, but they don't show that in the catalogs.
*/
if (rel->rd_rel->relkind != RELKIND_SEQUENCE &&
rel->rd_rel->relam != HEAP_TABLE_AM_OID)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("only heap AM is supported")));
Expand Down
12 changes: 12 additions & 0 deletions contrib/pgstattuple/sql/pgstattuple.sql
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ create index test_partition_hash_idx on test_partition using hash (a);
select pgstatindex('test_partition_idx');
select pgstathashindex('test_partition_hash_idx');

-- these should work for sequences
create sequence test_sequence;
select count(*) from pgstattuple('test_sequence');
select pg_relpages('test_sequence');

-- these should fail for sequences
select pgstatindex('test_sequence');
select pgstatginindex('test_sequence');
select pgstathashindex('test_sequence');
select pgstattuple_approx('test_sequence');

drop sequence test_sequence;
drop table test_partitioned;
drop view test_view;
drop foreign table test_foreign_table;
Expand Down
2 changes: 1 addition & 1 deletion contrib/postgres_fdw/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ process_pgfdw_appname(const char *appname)
appendStringInfoString(&buf, application_name);
break;
case 'c':
appendStringInfo(&buf, "%lx.%x", (long) (MyStartTime), MyProcPid);
appendStringInfo(&buf, "%" INT64_MODIFIER "x.%x", MyStartTime, MyProcPid);
break;
case 'C':
appendStringInfoString(&buf, cluster_name);
Expand Down
23 changes: 23 additions & 0 deletions contrib/test_decoding/expected/twophase.out
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,33 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc
COMMIT
(3 rows)

-- Test that accessing a TOAST table is permitted during the decoding of a
-- prepared transaction.
-- Create a table with a column that uses a TOASTed default value.
-- (temporarily hide query, to avoid the long CREATE TABLE stmt)
\set ECHO none
BEGIN;
INSERT INTO test_tab VALUES('test');
PREPARE TRANSACTION 'test_toast_table_access';
SELECT count(*) FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');
count
-------
3
(1 row)

COMMIT PREPARED 'test_toast_table_access';
-- consume commit prepared
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');
data
-------------------------------------------
COMMIT PREPARED 'test_toast_table_access'
(1 row)

-- Test 8:
-- cleanup and make sure results are also empty
DROP TABLE test_prepared1;
DROP TABLE test_prepared2;
DROP TABLE test_tab;
-- show results. There should be nothing to show
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
data
Expand Down
22 changes: 22 additions & 0 deletions contrib/test_decoding/sql/twophase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,32 @@ COMMIT PREPARED 'test_prepared_nodecode';
-- should be decoded now
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');

-- Test that accessing a TOAST table is permitted during the decoding of a
-- prepared transaction.

-- Create a table with a column that uses a TOASTed default value.
-- (temporarily hide query, to avoid the long CREATE TABLE stmt)
\set ECHO none
SELECT 'CREATE TABLE test_tab (a text DEFAULT ''' || string_agg('toast value', '') || ''');' FROM generate_series(1, 4000)
\gexec
\set ECHO all

BEGIN;
INSERT INTO test_tab VALUES('test');
PREPARE TRANSACTION 'test_toast_table_access';

SELECT count(*) FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');

COMMIT PREPARED 'test_toast_table_access';

-- consume commit prepared
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');

-- Test 8:
-- cleanup and make sure results are also empty
DROP TABLE test_prepared1;
DROP TABLE test_prepared2;
DROP TABLE test_tab;
-- show results. There should be nothing to show
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');

Expand Down
4 changes: 2 additions & 2 deletions contrib/xml2/xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ pgxml_xpath(text *document, xmlChar *xpath, xpath_workspace *workspace)
workspace->ctxt->node = xmlDocGetRootElement(workspace->doctree);

/* compile the path */
comppath = xmlXPathCompile(xpath);
comppath = xmlXPathCtxtCompile(workspace->ctxt, xpath);
if (comppath == NULL)
xml_ereport(xmlerrcxt, ERROR, ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,
"XPath Syntax Error");
Expand Down Expand Up @@ -650,7 +650,7 @@ xpath_table(PG_FUNCTION_ARGS)
ctxt->node = xmlDocGetRootElement(doctree);

/* compile the path */
comppath = xmlXPathCompile(xpaths[j]);
comppath = xmlXPathCtxtCompile(ctxt, xpaths[j]);
if (comppath == NULL)
xml_ereport(xmlerrcxt, ERROR,
ERRCODE_EXTERNAL_ROUTINE_EXCEPTION,
Expand Down
15 changes: 9 additions & 6 deletions doc/src/sgml/config.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -5114,8 +5114,9 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
</term>
<listitem>
<para>
Enables or disables the query planner's use of index-scan plan
types. The default is <literal>on</literal>.
Enables or disables the query planner's use of index-scan and
index-only-scan plan types. The default is <literal>on</literal>.
Also see <xref linkend="guc-enable-indexonlyscan"/>.
</para>
</listitem>
</varlistentry>
Expand All @@ -5130,7 +5131,9 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
<para>
Enables or disables the query planner's use of index-only-scan plan
types (see <xref linkend="indexes-index-only-scans"/>).
The default is <literal>on</literal>.
The default is <literal>on</literal>. The
<xref linkend="guc-enable-indexscan"/> setting must also be
enabled to have the query planner consider index-only-scans.
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -9430,9 +9433,9 @@ SET XML OPTION { DOCUMENT | CONTENT };
</term>
<listitem>
<para>
This variable specifies relation kind to which access is restricted.
It contains a comma-separated list of relation kind. Currently, the
supported relation kinds are <literal>view</literal> and
Set relation kinds for which access to non-system relations is prohibited.
The value takes the form of a comma-separated list of relation kinds.
Currently, the supported relation kinds are <literal>view</literal> and
<literal>foreign-table</literal>.
</para>
</listitem>
Expand Down
5 changes: 5 additions & 0 deletions doc/src/sgml/event-trigger.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
control statements are available to rewrite a table,
like <literal>CLUSTER</literal> and <literal>VACUUM</literal>,
the <literal>table_rewrite</literal> event is not triggered by them.
To find the OID of the table that was rewritten, use the function
<literal>pg_event_trigger_table_rewrite_oid()</literal> (see
<xref linkend="functions-event-triggers"/>). To discover the reason(s)
for the rewrite, use the function
<literal>pg_event_trigger_table_rewrite_reason()</literal>.
</para>

<para>
Expand Down
12 changes: 10 additions & 2 deletions doc/src/sgml/func.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -23030,6 +23030,10 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
the role (that is, the right to do <command>SET ROLE</command>), while
<literal>USAGE</literal> denotes whether the privileges of the role
are immediately available without doing <command>SET ROLE</command>.
<literal>WITH ADMIN OPTION</literal> or <literal>WITH GRANT
OPTION</literal> can be added to either of these privilege types to
test whether the <literal>ADMIN</literal> privilege is held (all
four spellings test the same thing).
This function does not allow the special case of
setting <parameter>user</parameter> to <literal>public</literal>,
because the PUBLIC pseudo-role can never be a member of real roles.
Expand Down Expand Up @@ -28353,8 +28357,12 @@ CREATE EVENT TRIGGER test_event_trigger_for_drops
<returnvalue>integer</returnvalue>
</para>
<para>
Returns a code explaining the reason(s) for rewriting. The exact
meaning of the codes is release dependent.
Returns a code explaining the reason(s) for rewriting. The value is
a bitmap built from the following values: <literal>1</literal>
(the table has changed its persistence), <literal>2</literal>
(default value of a column has changed), <literal>4</literal>
(a column has a new data type) and <literal>8</literal>
(the table access method has changed).
</para></entry>
</row>
</tbody>
Expand Down
Loading

0 comments on commit 35199b3

Please sign in to comment.