pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan
@ 2016-06-27 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2016-06-27 19:58 UTC (permalink / raw)
  To: pgsql-committers

Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query.

Previously, these commands always planned the given query and went through
executor startup before deciding not to actually run the query if WITH NO
DATA is specified.  This behavior is problematic for pg_dump because it
may cause errors to be raised that we would rather not see before a
REFRESH MATERIALIZED VIEW command is issued.  See for example bug #13907
from Marian Krucina.  This change is not sufficient to fix that particular
bug, because we also need to tweak pg_dump to issue the REFRESH later,
but it's a necessary step on the way.

A user-visible side effect of doing things this way is that the returned
command tag for WITH NO DATA cases will now be "CREATE MATERIALIZED VIEW"
or "CREATE TABLE AS", not "SELECT 0".  We could preserve the old behavior
but it would take more code, and arguably that was just an implementation
artifact not intended behavior anyhow.

In 9.5 and HEAD, also get rid of the static variable CreateAsReladdr, which
was trouble waiting to happen; there is not any prohibition on nested
CREATE commands.

Back-patch to 9.3 where CREATE MATERIALIZED VIEW was introduced.

Michael Paquier and Tom Lane

Report: <20160202161407.2778.24659@wrigleys.postgresql.org>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/874fe3aea121b4ceb186d59ba6956e2f7d5aa0bb

Modified Files
--------------
src/backend/commands/createas.c           | 378 +++++++++++++++++++-----------
src/backend/commands/view.c               |  22 +-
src/backend/nodes/makefuncs.c             |  30 +++
src/include/nodes/makefuncs.h             |   3 +
src/test/regress/expected/matview.out     |  43 +++-
src/test/regress/expected/select_into.out |  38 +++
src/test/regress/sql/matview.sql          |  19 +-
src/test/regress/sql/select_into.sql      |  19 ++
8 files changed, 391 insertions(+), 161 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan
@ 2016-06-27 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2016-06-27 19:58 UTC (permalink / raw)
  To: pgsql-committers

Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query.

Previously, these commands always planned the given query and went through
executor startup before deciding not to actually run the query if WITH NO
DATA is specified.  This behavior is problematic for pg_dump because it
may cause errors to be raised that we would rather not see before a
REFRESH MATERIALIZED VIEW command is issued.  See for example bug #13907
from Marian Krucina.  This change is not sufficient to fix that particular
bug, because we also need to tweak pg_dump to issue the REFRESH later,
but it's a necessary step on the way.

A user-visible side effect of doing things this way is that the returned
command tag for WITH NO DATA cases will now be "CREATE MATERIALIZED VIEW"
or "CREATE TABLE AS", not "SELECT 0".  We could preserve the old behavior
but it would take more code, and arguably that was just an implementation
artifact not intended behavior anyhow.

In 9.5 and HEAD, also get rid of the static variable CreateAsReladdr, which
was trouble waiting to happen; there is not any prohibition on nested
CREATE commands.

Back-patch to 9.3 where CREATE MATERIALIZED VIEW was introduced.

Michael Paquier and Tom Lane

Report: <20160202161407.2778.24659@wrigleys.postgresql.org>

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1651b9aa2d97c67ce731173bf78899b1053ecc4a

Modified Files
--------------
src/backend/commands/createas.c           | 377 +++++++++++++++++++-----------
src/backend/commands/view.c               |  22 +-
src/backend/nodes/makefuncs.c             |  30 +++
src/include/nodes/makefuncs.h             |   3 +
src/test/regress/expected/matview.out     |  63 ++++-
src/test/regress/expected/select_into.out |  38 +++
src/test/regress/sql/matview.sql          |  39 +++-
src/test/regress/sql/select_into.sql      |  19 ++
8 files changed, 410 insertions(+), 181 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan
@ 2016-06-27 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2016-06-27 19:58 UTC (permalink / raw)
  To: pgsql-committers

Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query.

Previously, these commands always planned the given query and went through
executor startup before deciding not to actually run the query if WITH NO
DATA is specified.  This behavior is problematic for pg_dump because it
may cause errors to be raised that we would rather not see before a
REFRESH MATERIALIZED VIEW command is issued.  See for example bug #13907
from Marian Krucina.  This change is not sufficient to fix that particular
bug, because we also need to tweak pg_dump to issue the REFRESH later,
but it's a necessary step on the way.

A user-visible side effect of doing things this way is that the returned
command tag for WITH NO DATA cases will now be "CREATE MATERIALIZED VIEW"
or "CREATE TABLE AS", not "SELECT 0".  We could preserve the old behavior
but it would take more code, and arguably that was just an implementation
artifact not intended behavior anyhow.

In 9.5 and HEAD, also get rid of the static variable CreateAsReladdr, which
was trouble waiting to happen; there is not any prohibition on nested
CREATE commands.

Back-patch to 9.3 where CREATE MATERIALIZED VIEW was introduced.

Michael Paquier and Tom Lane

Report: <20160202161407.2778.24659@wrigleys.postgresql.org>

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/dc9e03bf474a42c46cab1ec02456bcd43be45c58

Modified Files
--------------
src/backend/commands/createas.c           | 362 +++++++++++++++++++-----------
src/backend/commands/view.c               |  22 +-
src/backend/nodes/makefuncs.c             |  30 +++
src/include/nodes/makefuncs.h             |   3 +
src/test/regress/expected/matview.out     |  63 +++++-
src/test/regress/expected/select_into.out |  38 ++++
src/test/regress/sql/matview.sql          |  39 +++-
src/test/regress/sql/select_into.sql      |  19 ++
8 files changed, 404 insertions(+), 172 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan
@ 2016-06-27 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2016-06-27 19:58 UTC (permalink / raw)
  To: pgsql-committers

Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan the query.

Previously, these commands always planned the given query and went through
executor startup before deciding not to actually run the query if WITH NO
DATA is specified.  This behavior is problematic for pg_dump because it
may cause errors to be raised that we would rather not see before a
REFRESH MATERIALIZED VIEW command is issued.  See for example bug #13907
from Marian Krucina.  This change is not sufficient to fix that particular
bug, because we also need to tweak pg_dump to issue the REFRESH later,
but it's a necessary step on the way.

A user-visible side effect of doing things this way is that the returned
command tag for WITH NO DATA cases will now be "CREATE MATERIALIZED VIEW"
or "CREATE TABLE AS", not "SELECT 0".  We could preserve the old behavior
but it would take more code, and arguably that was just an implementation
artifact not intended behavior anyhow.

In 9.5 and HEAD, also get rid of the static variable CreateAsReladdr, which
was trouble waiting to happen; there is not any prohibition on nested
CREATE commands.

Back-patch to 9.3 where CREATE MATERIALIZED VIEW was introduced.

Michael Paquier and Tom Lane

Report: <20160202161407.2778.24659@wrigleys.postgresql.org>

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/17bfef80ee24f2204e66eb28277fddecdad64318

Modified Files
--------------
src/backend/commands/createas.c           | 361 +++++++++++++++++++-----------
src/backend/commands/view.c               |  21 +-
src/backend/nodes/makefuncs.c             |  29 +++
src/include/nodes/makefuncs.h             |   3 +
src/test/regress/expected/matview.out     |  59 ++++-
src/test/regress/expected/select_into.out |  38 ++++
src/test/regress/sql/matview.sql          |  35 ++-
src/test/regress/sql/select_into.sql      |  19 ++
8 files changed, 399 insertions(+), 166 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2016-06-27 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 19:58 pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan Tom Lane <tgl@sss.pgh.pa.us>
2016-06-27 19:58 pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan Tom Lane <tgl@sss.pgh.pa.us>
2016-06-27 19:58 pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan Tom Lane <tgl@sss.pgh.pa.us>
2016-06-27 19:58 pgsql: Fix CREATE MATVIEW/CREATE TABLE AS ... WITH NO DATA to not plan Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox