Re: [PATCH] Add error hints for invalid COPY options

Kirill Reshke <reshkekirill@gmail.com>

From: Kirill Reshke <reshkekirill@gmail.com>
To: Sugamoto Shinya <shinya34892@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-27T17:55:45Z
Lists: pgsql-hackers
Hi
On Thu, 27 Nov 2025 at 20:38, Sugamoto Shinya <shinya34892@gmail.com> wrote:
>
>
>
> Regarding the option `convert_selectively`, what do you think about this?
> Still it seems to me that this option is accessible from SQL interfaces. But for now
> I just removed the comment changes from my v2 patch and would like to discuss
> this with you here or in another thread.
>
> Regards,
>

It is worse than that - user can  lose his data by using
convert_selectively from SQL:

```
db1=# COPY conv_test FROM STDIN (
    FORMAT csv,
    convert_selectively (a)
);
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> 2,2,dsd
>> \.
COPY 1
db1=# table conv_test
db1-# ;
 a | b | c
---+---+---
 2 |   |
(1 row)

```


So, this option should be rejected when manually specified. Looks like
we can do ereport() directly in parser, when reading option name

-- 
Best regards,
Kirill Reshke