Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Michael Paquier" <michael(at)paquier(dot)xyz>, "jian he" <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG FIX] Fix validation of COPY options FORCE_NOT_NULL/FORCE_NULL
Date: 2024-10-19 06:52:52
Message-ID: 903f50e4-175c-4467-a169-7c6b89e8fe97@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 19, 2024, at 03:32, Michael Paquier wrote:
> If this area of the code is refactored so as a different error is
> triggered for these two specific queries, we'd still be alerted that
> something is wrong the same way for HEAD or what you are suggesting.
> I can see your argument, but it does not really matter because the
> errors triggered by these option combinations don't link specifically
> to COPY TO or COPY FROM. At the end, I'm OK with leaving things the
> way they are on HEAD, and let that be.

OK, I understand your point of view, and agree there is no problem from a
safety perspective, as the tests would still alert us, just with a suboptimal
error message.

I can see how such a small change might not be worth doing in a single commit.

However, since my last email, I've found some other problems in this area,
and think we should do a more ambitious improvement, by rearranging the
incorrect options tests into three categories:

1. incorrect COPY {FROM|TO} options
2. incorrect COPY FROM options
3. incorrect COPY TO options

Also, I've found two new problems:

1. Incorrect options tests are missing for the QUOTE and ESCPAE options.
This was discovered by Jian He in a different thread.

2. One of the ON_ERROR incorrect options tests also depend on the order
of checks in ProcessCopyOptions.

To explain my current focus on the COPY tests, it's because we're currently
working on the new raw format for COPY, and it would be nice to cleanup these
tests as a preparatory step first.

New patch attached.

/Joel

Attachment Content-Type Size
0001-Improve-incorrect-COPY-options-tests.patch application/octet-stream 7.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-10-19 07:55:15 Re: New "raw" COPY format
Previous Message Pavel Stehule 2024-10-19 05:05:10 Re: [PATCH] Add some documentation on how to call internal functions