Re: [PATCH] Add error hints for invalid COPY options - Mailing list pgsql-hackers

From Kirill Reshke
Subject Re: [PATCH] Add error hints for invalid COPY options
Date
Msg-id CALdSSPhJy2HOMzVV9XT68thgn7hMFhk3JLC2cVvv3OmE_a_2fA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add error hints for invalid COPY options  (Sugamoto Shinya <shinya34892@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Second RewriteQuery complains about first RewriteQuery in edge case
Next
From: Kirill Reshke
Date:
Subject: Re: [PATCH] Add error hints for invalid COPY options