> On Jan 9, 2026, at 16:14, Shinya Kato <shinya11.kato@gmail.com> wrote:
>
> Hi hackers,
> (CC: Fujii-san, committer of bc2f348e8)
>
> Commit bc2f348e8[0] introduced multi-line HEADER support for COPY.
> However, file_fdw does not yet support it, so I have implemented it in
> the attached patch.
>
> Since foreign table options in CREATE/ALTER FOREIGN TABLE are
> specified as single-quoted strings, I updated defGetCopyHeaderOption()
> to handle string values as well.
>
> Thoughts?
>
> [0] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=bc2f348e87c02de63647dbe290d64ff088880dbe
>
> --
> Best regards,
> Shinya Kato
> NTT OSS Center
> <v1-0001-file_fdw-Support-multi-line-HEADER-option.patch>
Hi Shinya,
Thanks for the patch. Here are a few review comments:
1
```
- * Allow 0, 1, "true", "false", "on", "off", a non-negative integer, or
- * "match".
+ * Allow 0, 1, "true", "false", "on", "off", a non-negative integer (also
+ * as a string, to support file_fdw options), or "match".
*/
```
From this comment, I cannot get how “0” and “1” will behave, and I cannot find a test case to show me that.
With this patch, “2” acts the same as 2, so “1” acts the same as 1. Will “1” be a line count or a boolean true?
2
```
+ /* Check if the header is a valid integer */
+ ival = pg_strtoint32_safe(header, (Node *)&escontext);
+ if (escontext.error_occurred)
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("%s requires a Boolean value, a non-negative integer, "
+ "or the string \"match\"",
+ def->defname)));
```
I am thinking if INVALID_PARAMETER_VALUE would be better fit here for the error code.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/