Disable WAL-skipping optimization for COPY on views
Michael Paquier <michael@paquier.xyz>
Disable WAL-skipping optimization for COPY on views 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 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. A test is added to cover this case, which needs to have wal_level set to minimal to allow the problem to show up, and that is not the default configuration. Reported-by: Etsuro Fujita Author: 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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/copy.c | modified | +5 −0 |
| src/test/regress/expected/copy2.out | modified | +18 −0 |
| src/test/regress/sql/copy2.sql | modified | +16 −0 |
Discussion
- BUG #15552: Unexpected error in COPY to a foreign table in a transaction 37 messages · 2018-12-14 → 2018-12-25