Fix validation of COPY FORCE_NOT_NULL/FORCE_NULL for the all-column cases
commit089aac631b5ba53be0ecf8ea2e8d81388d69629c
authorMichael Paquier <michael@paquier.xyz>
Wed, 16 Oct 2024 23:44:50 +0000 (17 08:44 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 16 Oct 2024 23:44:50 +0000 (17 08:44 +0900)
tree72d82c83cdb28fe356793ed5ea32cceba6ea8a23
parent03bf0d9a4ba0fb7a908b5a79eb80e0c983b51e87
Fix validation of COPY FORCE_NOT_NULL/FORCE_NULL for the all-column cases

This commit adds missing checks for COPY FORCE_NOT_NULL and FORCE_NULL
when applied to all columns via "*".  These options now correctly
require CSV mode and are disallowed in COPY TO, making their behavior
consistent with FORCE_QUOTE.

Some regression tests are added to verify the correct behavior for the
all-columns case, including FORCE_QUOTE, which was not tested.

Backpatch down to 17, where support for the all-column grammar with
FORCE_NOT_NULL and FORCE_NULL has been added.

Author: Joel Jacobson
Reviewed-by: Zhang Mingli
Discussion: https://postgr.es/m/65030d1d-5f90-4fa4-92eb-f5f50389858e@app.fastmail.com
Backpatch-through: 17
src/backend/commands/copy.c
src/test/regress/expected/copy2.out
src/test/regress/sql/copy2.sql