From 534874fac0b34535c9a5ab9257d6574f78423578 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Fri, 4 Apr 2025 19:32:00 +0900 Subject: Allow "COPY table TO" command to copy rows from materialized views. Previously, "COPY table TO" command worked only with plain tables and did not support materialized views, even when they were populated and had physical storage. To copy rows from materialized views, "COPY (query) TO" command had to be used, instead. This commit extends "COPY table TO" to support populated materialized views directly, improving usability and performance, as "COPY table TO" is generally faster than "COPY (query) TO". Note that copying from unpopulated materialized views will still result in an error. Author: jian he Reviewed-by: Kirill Reshke Reviewed-by: David G. Johnston Reviewed-by: Vignesh C Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CACJufxHVxnyRYy67hiPePNCPwVBMzhTQ6FaL9_Te5On9udG=yg@mail.gmail.com --- doc/src/sgml/ref/copy.sgml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index df093da97c5..d6859276bed 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -520,16 +520,16 @@ COPY count Notes - COPY TO can be used only with plain - tables, not views, and does not copy rows from child tables - or child partitions. For example, COPY table TO copies - the same rows as SELECT * FROM ONLY table. - The syntax COPY (SELECT * FROM table) TO ... can be used to - dump all of the rows in an inheritance hierarchy, partitioned table, - or view. + COPY TO can be used with plain + tables and populated materialized views. + For example, + COPY table + TO copies the same rows as + SELECT * FROM ONLY table. + However it doesn't directly support other relation types, + such as partitioned tables, inheritance child tables, or views. + To copy all rows from such relations, use COPY (SELECT * FROM + table) TO. -- cgit v1.2.3