postgresql/src/include
Tom Lane cc7e0feba5 In extensions, don't replace objects not belonging to the extension.
Previously, if an extension script did CREATE OR REPLACE and there was
an existing object not belonging to the extension, it would overwrite
the object and adopt it into the extension.  This is problematic, first
because the overwrite is probably unintentional, and second because we
didn't change the object's ownership.  Thus a hostile user could create
an object in advance of an expected CREATE EXTENSION command, and would
then have ownership rights on an extension object, which could be
modified for trojan-horse-type attacks.

Hence, forbid CREATE OR REPLACE of an existing object unless it already
belongs to the extension.  (Note that we've always forbidden replacing
an object that belongs to some other extension; only the behavior for
previously-free-standing objects changes here.)

For the same reason, also fail CREATE IF NOT EXISTS when there is
an existing object that doesn't belong to the extension.

Our thanks to Sven Klemm for reporting this problem.

Security: CVE-2022-2625
2022-08-08 11:12:31 -04:00
..
access Force immediate commit after CREATE DATABASE etc in extended protocol. 2022-07-26 13:07:03 -04:00
bootstrap Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
catalog In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
commands Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:15 +02:00
common Remove PGDLLIMPORT marker from __pg_log_level 2022-05-13 09:39:13 +09:00
datatype Fix overflow hazards in interval input and output conversions. 2022-04-02 16:12:29 -04:00
executor Remove size increase in ExprEvalStep caused by hashed saops 2022-07-06 19:41:09 +12:00
fe_utils Allow db.schema.table patterns, but complain about random garbage. 2022-04-20 11:37:29 -04:00
foreign Update copyright for 2022 2022-01-07 19:04:57 -05:00
jit Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
lib Improve frontend error logging style. 2022-04-08 14:55:14 -04:00
libpq Add some missing PGDLLIMPORT markings 2022-05-12 15:08:45 +09:00
mb Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
nodes Fix ENABLE/DISABLE TRIGGER to handle recursion correctly 2022-08-05 09:47:15 +02:00
optimizer Fix incorrect tests for SRFs in relation_can_be_sorted_early(). 2022-08-03 17:33:42 -04:00
parser Make STRING an unreserved_keyword. 2022-05-30 14:05:20 -04:00
partitioning Refactor and cleanup runtime partition prune code a little 2022-04-05 11:46:48 +02:00
port windows: msvc: Define STDIN/OUT/ERR_FILENO. 2022-07-18 17:22:35 -07:00
portability Update copyright for 2022 2022-01-07 19:04:57 -05:00
postmaster Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
regex Update copyright for 2022 2022-01-07 19:04:57 -05:00
replication Fix data inconsistency between publisher and subscriber. 2022-06-16 08:45:07 +05:30
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Add stxdinherit flag to pg_statistic_ext_data 2022-01-16 13:38:01 +01:00
storage Fix lock assertions in dshash.c. 2022-07-11 16:01:22 +12:00
tcop Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
tsearch Add missing 'extern' to function prototypes. 2022-05-12 12:39:33 -07:00
utils Fix missed corner cases for grantable permissions on GUCs. 2022-07-19 17:22:31 -04:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
fmgr.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
funcapi.h Create routine able to set single-call SRFs for Materialize mode 2022-03-07 10:26:29 +09:00
getaddrinfo.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
getopt_long.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
miscadmin.h Process session_preload_libraries within InitPostgres's transaction. 2022-07-25 10:27:43 -04:00
pg_config.h.in Simplify configure test 2022-05-04 14:20:36 +02:00
pg_config_ext.h.in
pg_config_manual.h Fix old-fd issues using global barriers everywhere. 2022-05-07 16:47:29 +12:00
pg_getopt.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pg_trace.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgstat.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pgtar.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
pgtime.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
port.h Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
postgres.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
rusagestub.h Update copyright for 2022 2022-01-07 19:04:57 -05:00
windowapi.h Update copyright for 2022 2022-01-07 19:04:57 -05:00