]> granicus.if.org Git - postgresql/commit
Disable WAL-skipping optimization for COPY on views and foreign tables
authorMichael Paquier <michael@paquier.xyz>
Sun, 23 Dec 2018 07:43:47 +0000 (16:43 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sun, 23 Dec 2018 07:43:47 +0000 (16:43 +0900)
commitff9c222669063d7a17b179bc19617caf9c1f67ea
treefd4dbb8f8c81811b21dc0297372e9eb02bb06955
parent018923ccc1a68eeac852edeac2ba3bc91dcbd494
Disable WAL-skipping optimization for COPY on views and foreign tables

COPY can skip writing WAL when loading data on a table which has been
created in the same transaction as the one loading the data, however
this cannot work on views or foreign table as this would result in
trying to flush relation files which do not exist.  So disable the
optimization so as commands are able to work the same way with any
configuration of wal_level.

Tests are added to cover the different cases, which need to have
wal_level set to minimal to allow the problem to show up, and that is
not the default configuration.

Reported-by: Luis M. Carril, Etsuro Fujita
Author: Amit Langote, Michael Paquier
Reviewed-by: Etsuro Fujita
Discussion: https://postgr.es/m/15552-c64aa14c5c22f63c@postgresql.org
Backpatch-through: 10, where support for COPY on views has been added,
while v11 has added support for COPY on foreign tables.
contrib/postgres_fdw/expected/postgres_fdw.out
contrib/postgres_fdw/sql/postgres_fdw.sql
src/backend/commands/copy.c
src/test/regress/expected/copy2.out
src/test/regress/sql/copy2.sql