Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/BABEL_4_X_DEV__PG_16_X' into j…
Browse files Browse the repository at this point in the history
…ira-babel-5155
  • Loading branch information
ahmed-shameem committed Jan 9, 2025
2 parents c3a09ca + 961f30f commit 9d4d56e
Show file tree
Hide file tree
Showing 350 changed files with 26,170 additions and 26,228 deletions.
29 changes: 28 additions & 1 deletion BabelfishDump.spec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

Name: BabelfishDump
Summary: Postgresql dump utilities modified for Babelfish
Version: 16.4
Version: 16.7
Release: 1%{?dist}%{?_trivial}%{?_buildid}
License: PostgreSQL
Url: https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish
Expand Down Expand Up @@ -151,6 +151,33 @@ LD_LIBRARY_PATH=%{_builddir}/%{name}/src/interfaces/libpq $RPM_BUILD_ROOT/usr/bi
%{_bindir}/bbf_dumpall

%changelog
* Wed Dec 11 2024 Sharu Goel <[email protected]> - 16.7-1
- Add support to dump linked roles associated with members of db_owner role

* Wed Dec 11 2024 ANJU BHARTI <[email protected]> - 16.7-1
- Handle dump logic for babelfish db_ddladmin fixed database role

* Wed Dec 11 2024 Harsh Lunagariya <[email protected]> - 16.7-1
- Handle dump logic for babelfish db_securityadmin fixed database role

* Wed Dec 11 2024 ANJU BHARTI <[email protected]> - 16.7-1
- Handle dump logic for babelfish db_creator fixed server role

* Wed Dec 11 2024 Shalini Lohia <[email protected]> - 16.7-1
- Handle dump logic for babelfish db_datareader/db_datawriter fixed database roles

* Wed Dec 11 2024 Tanzeel Khan <[email protected]> - 16.7-1
- Handle dump logic for babelfish db_accessadmin fixed database role

* Wed Dec 11 2024 ANJU BHARTI <[email protected]> - 16.7-1
- Handle dump logic for babelfish securityadmin fixed server role

* Tue Nov 19 2024 Rishabh Tanwar <[email protected]> - 16.7-1
- Enable babelfishpg_tsql.dump_restore GUC while restoring roles

* Thu Oct 3 2024 Tanzeel Khan <[email protected]> - 16.7-1
- Dump physical database aclprivs for fixed database roles

* Mon Aug 5 2024 Masahiko Sawada <[email protected]> - 16.4-1
- [CVE-2024-7348] Restrict accesses to non-system views and foreign tables during pg_dump.

Expand Down
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 16.4.
# Generated by GNU Autoconf 2.69 for PostgreSQL 16.6.
#
# Report bugs to <[email protected]>.
#
Expand Down Expand Up @@ -582,8 +582,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='PostgreSQL'
PACKAGE_TARNAME='postgresql'
PACKAGE_VERSION='16.4'
PACKAGE_STRING='PostgreSQL 16.4'
PACKAGE_VERSION='16.6'
PACKAGE_STRING='PostgreSQL 16.6'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_URL='https://www.postgresql.org/'

Expand Down Expand Up @@ -1448,7 +1448,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 16.4 to adapt to many kinds of systems.
\`configure' configures PostgreSQL 16.6 to adapt to many kinds of systems.

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

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

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

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

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2441,7 +2441,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 16.4, which was
It was created by PostgreSQL $as_me 16.6, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -19969,7 +19969,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 16.4, which was
This file was extended by PostgreSQL $as_me 16.6, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -20040,7 +20040,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 16.4
PostgreSQL config.status 16.6
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], [16.4], [[email protected]], [], [https://www.postgresql.org/])
AC_INIT([PostgreSQL], [16.6], [[email protected]], [], [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;
2 changes: 1 addition & 1 deletion contrib/pg_stat_statements/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LDFLAGS_SL += $(filter -lm, $(LIBS))

REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_statements/pg_stat_statements.conf
REGRESS = select dml cursors utility level_tracking planning \
user_activity wal cleanup oldextversions
user_activity wal extended cleanup oldextversions
# Disabled because these tests require "shared_preload_libraries=pg_stat_statements",
# which typical installcheck users do not have (e.g. buildfarm clients).
NO_INSTALLCHECK = 1
Expand Down
10 changes: 10 additions & 0 deletions contrib/pg_stat_statements/expected/extended.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Tests with extended query protocol
SET pg_stat_statements.track_utility = FALSE;
-- This test checks that an execute message sets a query ID.
SELECT query_id IS NOT NULL AS query_id_set
FROM pg_stat_activity WHERE pid = pg_backend_pid() \bind \g
query_id_set
--------------
t
(1 row)

1 change: 1 addition & 0 deletions contrib/pg_stat_statements/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ tests += {
'planning',
'user_activity',
'wal',
'extended',
'cleanup',
'oldextversions',
],
Expand Down
7 changes: 7 additions & 0 deletions contrib/pg_stat_statements/sql/extended.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Tests with extended query protocol

SET pg_stat_statements.track_utility = FALSE;

-- This test checks that an execute message sets a query ID.
SELECT query_id IS NOT NULL AS query_id_set
FROM pg_stat_activity WHERE pid = pg_backend_pid() \bind \g
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 @@ -522,7 +522,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
Loading

0 comments on commit 9d4d56e

Please sign in to comment.