summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2022-06-23 10:49:20 +0900
committerMichael Paquier <michael@paquier.xyz>2022-06-23 10:49:20 +0900
commitca7a0d1d368216e89359c63531a4df0b99a437e4 (patch)
treef662791ab4a78f5dff1969e7b532f48442c7faf7 /doc
parenteba331ae2aad781d498f8a424a12185146c7f1f7 (diff)
downloadpostgresql-ca7a0d1d368216e89359c63531a4df0b99a437e4.tar.gz
Fix two issues with HEADER MATCH in COPY
072132f0 used the attnum offset to access the raw_fields array when checking that the attribute names of the header and of the relation match, leading to incorrect results or even crashes if the attribute numbers of a relation are changed, like on a dropped attribute. This fixes the logic to use the correct attribute names for the header matching requirements. Also, this commit disallows HEADER MATCH in COPY TO as there is no validation that can be done in this case. The tests are expanded for HEADER MATCH with COPY FROM and dropped columns, with cases where a relation has a dropped and re-added column, as well as a reduced set of columns. Author: Julien Rouhaud Reviewed-by: Peter Eisentraut, Michael Paquier Discussion: https://postgr.es/m/20220607154744.vvmitnqhyxrne5ms@jrouhaud
Diffstat (limited to 'doc')
-rw-r--r--doc/src/sgml/ref/copy.sgml2
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 40af423ccf..8aae711b3b 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -282,6 +282,8 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
of the columns in the header line must match the actual column names of
the table, otherwise an error is raised.
This option is not allowed when using <literal>binary</literal> format.
+ The <literal>MATCH</literal> option is only valid for <command>COPY
+ FROM</command> commands.
</para>
</listitem>
</varlistentry>