postgresql/src
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
..
backend Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema 2023-07-10 09:40:07 +09:00
bin Rename port/thread.c to port/user.c. 2023-07-09 18:17:09 +12:00
common Generate automatically code and documentation related to wait events 2023-07-05 10:53:11 +09:00
fe_utils Handle \v as a whitespace character in parsers 2023-07-06 08:16:24 +09:00
include Rename port/thread.c to port/user.c. 2023-07-09 18:17:09 +12:00
interfaces Rename port/thread.c to port/user.c. 2023-07-09 18:17:09 +12:00
makefiles Use --strip-unneeded when stripping static libraries with GNU strip. 2023-04-20 18:12:32 -04:00
pl Translation updates 2023-06-26 12:02:02 +02:00
port Rename port/thread.c to port/user.c. 2023-07-09 18:17:09 +12:00
template
test Fix ALTER EXTENSION SET SCHEMA with objects outside an extension's schema 2023-07-10 09:40:07 +09:00
timezone Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
tools All supported systems have locale_t. 2023-07-09 11:55:18 +12:00
tutorial Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Fix prove_installcheck when used with PGXS 2023-05-05 07:09:52 +02:00
Makefile.shlib
meson.build
nls-global.mk