Re: New "raw" COPY format - Mailing list pgsql-hackers

From jian he
Subject Re: New "raw" COPY format
Date
Msg-id CACJufxG8b=GytZOMnBxtxaVj6GBoeFahX5Ej7EQGcrNg5vRrZQ@mail.gmail.com
Whole thread Raw
In response to Re: New "raw" COPY format  (Tatsuo Ishii <ishii@postgresql.org>)
List pgsql-hackers
On Tue, Oct 15, 2024 at 8:50 PM Joel Jacobson <joel@compiler.org> wrote:
>

Hi.
I only checked 0001, 0002, 0003.
the raw format patch is v9-0016.
003-0016 is a lot of small patches, maybe you can consolidate it to
make the review more easier.

-COPY x to stdin (format TEXT, force_quote(a));
+COPY x to stdout (format TEXT, force_quote(a));
0001 make sense to me, i think generally we do "to stdout", "from stdin"

v9-0002-Fix-validation-of-FORCE_NOT_NULL-FORCE_NULL-for-all-.patch
looks good.


typedef enum CopyLogVerbosityChoice
{
    COPY_LOG_VERBOSITY_SILENT = -1, /* logs none */
    COPY_LOG_VERBOSITY_DEFAULT = 0, /* logs no additional messages. As this is
                                     * the default, assign 0 */
    COPY_LOG_VERBOSITY_VERBOSE, /* logs additional messages */
} CopyLogVerbosityChoice;
/*
 * Represents the format of the COPY operation.
 */
typedef enum CopyFormat
{
    COPY_FORMAT_TEXT,
    COPY_FORMAT_BINARY,
    COPY_FORMAT_CSV,
} CopyFormat;

BeginCopyTo
cstate = (CopyToStateData *) palloc0(sizeof(CopyToStateData));
ProcessCopyOptions(pstate, &cstate->opts, false /* is_from */ , options);

palloc0(sizeof(CopyToStateData)); makes the default format to COPY_FORMAT_TEXT.

I think you may need COPY_FORMAT_TEXT = 0, even though based on [1],
it seems not required.

[1] https://stackoverflow.com/questions/6434105/are-default-enum-values-in-c-the-same-for-all-compilers



pgsql-hackers by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: ECPG cleanup and fix for clang compile-time problem
Next
From: Amit Kapila
Date:
Subject: Re: Using per-transaction memory contexts for storing decoded tuples