On Fri, Oct 11, 2024, at 22:29, Joel Jacobson wrote:
> Hi hackers,
>
> This thread is about implementing a new "raw" COPY format.
...
> The attached patch implements the above ideas.
>
> I think with these changes, it would be easier to hack on new and existing
> copy options and formats.
>
> /Joel
>
> Attachments:
> * v1-0001-Replace-binary-flags-binary-and-csv_mode-with-format.patch
> * v1-0002-Reorganize-ProcessCopyOptions-for-clarity-and-consis.patch

Ops, I see I failed to use the correct way to check if
opts_out->force_notnull or opts_out->force_null
have been set, that is using != NIL.

However, thanks to not just blindly copy/pasting this code,
I see I actually fixed a bug in HEAD, by also checking
opts_out->force_notnull_all or opts_out->force_null_all,
which HEAD currently fails to do:

joel=# copy t to '/tmp/t.csv' (format text, FORCE_NOT_NULL (c1));
ERROR:  COPY FORCE_NOT_NULL requires CSV mode
joel=# copy t to '/tmp/t.csv' (format text, FORCE_NOT_NULL *);
COPY 0
joel=# copy t to '/tmp/t.csv' (format text, FORCE_NULL (c1));
ERROR:  COPY FORCE_NULL requires CSV mode
joel=# copy t to '/tmp/t.csv' (format text, FORCE_NULL *);
COPY 0

Fixed in new version:

joel=# copy t to '/tmp/t.csv' (format text, FORCE_NOT_NULL *);
ERROR:  COPY FORCE_NOT_NULL requires CSV mode
joel=# copy t to '/tmp/t.csv' (format text, FORCE_NULL *);
ERROR:  COPY FORCE_NULL requires CSV mode

/Joel

Attachment: v2-0001-Replace-binary-flags-binary-and-csv_mode-with-format.patch
Description: Binary data

Attachment: v2-0002-Reorganize-ProcessCopyOptions-for-clarity-and-consis.patch
Description: Binary data

Reply via email to