git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 0aa8a01) | patch
Sanitize IF NOT EXISTS in EXPLAIN for CTAS and matviews
2020年12月30日 12:23:24 +0000 (21:23 +0900)
2020年12月30日 12:23:24 +0000 (21:23 +0900)
commit e665769e6d1e84b6650f53ed297058fc11152f7f
Sanitize IF NOT EXISTS in EXPLAIN for CTAS and matviews

IF NOT EXISTS was ignored when specified in an EXPLAIN query for CREATE
MATERIALIZED VIEW or CREATE TABLE AS. Hence, if this clause was
specified, the caller would get a failure if the relation already
exists instead of a success with a NOTICE message.

This commit makes the behavior of IF NOT EXISTS in EXPLAIN consistent
with the non-EXPLAIN'd DDL queries, preventing a failure with IF NOT
EXISTS if the relation to-be-created already exists. The skip is done
before the SELECT query used for the relation is planned or executed,
and a "dummy" plan is generated instead depending on the format used by
EXPLAIN.

Author: Bharath Rupireddy
Reviewed-by: Zhijie Hou, Michael Paquier
Discussion: https://postgr.es/m/CALj2ACVa3oJ9O_wcGd+FtHWZds04dEKcakxphGz5POVgD4wC7Q@mail.gmail.com
src/backend/commands/createas.c diff | blob | blame | history
src/backend/commands/explain.c diff | blob | blame | history
src/include/commands/createas.h diff | blob | blame | history
src/test/regress/expected/matview.out diff | blob | blame | history
src/test/regress/expected/select_into.out diff | blob | blame | history
src/test/regress/sql/matview.sql diff | blob | blame | history
src/test/regress/sql/select_into.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /