1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

Require the schema qualification in pg_temp.type_name(arg).

Commit aa27977fe2 introduced this
restriction for pg_temp.function_name(arg); do likewise for types
created in temporary schemas.  Programs that this breaks should add
"pg_temp." schema qualification or switch to arg::type_name syntax.
Back-patch to 9.4 (all supported versions).

Reviewed by Tom Lane.  Reported by Tom Lane.

Security: CVE-2019-10208
This commit is contained in:
Noah Misch
2019-08-05 07:48:41 -07:00
parent 106c6635b5
commit 9993fa9dd2
9 changed files with 83 additions and 5 deletions

View File

@ -199,6 +199,21 @@ select pg_temp.whoami();
(1 row)
drop table public.whereami;
-- types in temp schema
set search_path = pg_temp, public;
create domain pg_temp.nonempty as text check (value <> '');
-- function-syntax invocation of types matches rules for functions
select nonempty('');
ERROR: function nonempty(unknown) does not exist
LINE 1: select nonempty('');
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
select pg_temp.nonempty('');
ERROR: value for domain nonempty violates check constraint "nonempty_check"
-- other syntax matches rules for tables
select ''::nonempty;
ERROR: value for domain nonempty violates check constraint "nonempty_check"
reset search_path;
-- For partitioned temp tables, ON COMMIT actions ignore storage-less
-- partitioned tables.
begin;

View File

@ -152,6 +152,17 @@ select pg_temp.whoami();
drop table public.whereami;
-- types in temp schema
set search_path = pg_temp, public;
create domain pg_temp.nonempty as text check (value <> '');
-- function-syntax invocation of types matches rules for functions
select nonempty('');
select pg_temp.nonempty('');
-- other syntax matches rules for tables
select ''::nonempty;
reset search_path;
-- For partitioned temp tables, ON COMMIT actions ignore storage-less
-- partitioned tables.
begin;