postgresql/src/test/modules
Michael Paquier bd5ddbe866 Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema
As coded, the code would use as a base comparison the namespace OID from
the first object scanned in pg_depend when switching its namespace
dependency entry to the new one, and use it as a base of comparison for
any follow-up checks.  It would also be used as the old namespace OID to
switch *from* for the extension's pg_depend entry.  Hence, if the first
object scanned has a namespace different than the one stored in the
extension, we would finish by:
- Not checking that the extension objects map with the extension's
schema.
- Not switching the extension -> namespace dependency entry to the new
namespace provided by the user, making ALTER EXTENSION ineffective.

This issue exists since this command has been introduced in d9572c4 for
relocatable extension, so backpatch all the way down to 11.  The test
case has been provided by Heikki, that I have tweaked a bit to show the
effects on pg_depend for the extension.

Reported-by: Heikki Linnakangas
Author: Michael Paquier, Heikki Linnakangas
Discussion: https://postgr.es/m/20eea594-a05b-4c31-491b-007b6fceef28@iki.fi
Backpatch-through: 11
2023-07-10 09:40:07 +09:00
..
brin Show empty BRIN ranges in brin_page_items 2023-05-19 02:00:21 +02:00
commit_ts Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
delay_execution meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
dummy_index_am Ignore BRIN indexes when checking for HOT updates 2023-03-20 11:02:42 +01:00
dummy_seclabel Improve several permission-related error messages. 2023-03-17 10:33:09 +01:00
ldap_password_func Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
libpq_pipeline libpq: Add support for Close on portals and statements 2023-07-04 14:48:10 +09:00
plsample meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
snapshot_too_old Update copyright for 2023 2023-01-02 15:00:37 -05:00
spgist_name_ops meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
ssl_passphrase_callback Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
test_bloomfilter meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_copy_callbacks meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_custom_rmgrs Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
test_ddl_deparse Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
test_extensions Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema 2023-07-10 09:40:07 +09:00
test_ginpostinglist meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_integerset meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_lfind meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_misc Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
test_oat_hooks Revert "Fix search_path to a safe value during maintenance operations." 2023-06-10 08:11:41 -07:00
test_parser meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_pg_dump Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
test_predtest meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_rbtree meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_regex Redesign interrupt/cancel API for regex engine. 2023-04-08 22:10:39 +12:00
test_rls_hooks meson: Prevent installation of test files during main install 2023-03-03 07:45:52 +01:00
test_shm_mq Refactor some code related to wait events "BufferPin" and "Extension" 2023-07-03 11:01:02 +09:00
test_slru Remove unused global variable 2023-04-21 11:41:58 +12:00
unsafe_tests Fix some typos and some incorrectly duplicated words 2023-04-18 14:03:49 +12:00
worker_spi Refactor some code related to wait events "BufferPin" and "Extension" 2023-07-03 11:01:02 +09:00
Makefile Revert "Add USER SET parameter values for pg_db_role_setting" 2023-05-17 20:28:57 +03:00
meson.build Revert "Add USER SET parameter values for pg_db_role_setting" 2023-05-17 20:28:57 +03:00
README Add an enforcement mechanism for global object names in regression tests. 2019-06-29 11:34:00 -04:00

Test extensions and libraries
=============================

src/test/modules contains PostgreSQL extensions that are primarily or entirely
intended for testing PostgreSQL and/or to serve as example code. The extensions
here aren't intended to be installed in a production server and aren't suitable
for "real work".

Furthermore, while you can do "make install" and "make installcheck" in
this directory or its children, it is NOT ADVISABLE to do so with a server
containing valuable data.  Some of these tests may have undesirable
side-effects on roles or other global objects within the tested server.
"make installcheck-world" at the top level does not recurse into this
directory.

Most extensions have their own pg_regress tests or isolationtester specs. Some
are also used by tests elsewhere in the tree.

If you're adding new hooks or other functionality exposed as C-level API this
is where to add the tests for it.