pgsql: Relax INSERT privilege requirement for CTAS and matviews WITH NO
От | Michael Paquier |
---|---|
Тема | pgsql: Relax INSERT privilege requirement for CTAS and matviews WITH NO |
Дата | |
Msg-id | E1keUl0-0008OJ-83@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Relax INSERT privilege requirement for CTAS and matviews WITH NO DATA When specified, WITH NO DATA does not insert any data into the relation created, so skip checking for the insert permissions. With WITH DATA or WITH NO DATA, it is always required for the user to have CREATE privileges on the schema targeted for the relation. Note that plain CREATE TABLE AS or CREATE MATERIALIZED VIEW queries have begun to work accidentally without INSERT privilege checks as of 874fe3ae, while using EXECUTE or EXPLAIN ANALYZE would fail with the ACL check, so this makes the behavior for all the command flavors consistent with each other. This is arguably a bug fix, but there have been no complaints about the current behavior either so stable branches are not changed. While on it, document properly the privileges requirements for each commands with more tests for all the scenarios possible, and avoid a useless bulk-insert allocation when using WITH NO DATA. Author: Bharath Rupireddy Reviewed-by: Anastasia Lubennikova, Michael Paquier Discussion: https://postgr.es/m/CALj2ACWc3N8j0_9nMPz9wcAUnVcdKHzFdDZJ3hVFNEbqtcyG9w@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/846005e4f3829c3eafe1f8441b80ff90657d0a29 Modified Files -------------- doc/src/sgml/ref/create_materialized_view.sgml | 7 +++ doc/src/sgml/ref/create_table_as.sgml | 7 +++ src/backend/commands/createas.c | 84 ++++++++++++++++---------- src/test/regress/expected/matview.out | 35 +++++++++++ src/test/regress/expected/select_into.out | 62 ++++++++++++++++--- src/test/regress/sql/matview.sql | 28 +++++++++ src/test/regress/sql/select_into.sql | 37 ++++++++++-- 7 files changed, 212 insertions(+), 48 deletions(-)
В списке pgsql-committers по дате отправления: