Re: Make COPY format extendable: Extract COPY TO format implementations

From: Sutou Kouhei <kou(at)clear-code(dot)com>
To: sawada(dot)mshk(at)gmail(dot)com
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, zhjwpku(at)gmail(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Make COPY format extendable: Extract COPY TO format implementations
Date: 2025-03-05 00:06:08
Message-ID: 20250305.090608.575196107267477043.kou@clear-code.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In <CAD21AoAwOP7p6LgmkPGqPuJ5KbJPPQsSZsFzwCDguwzr9F677Q(at)mail(dot)gmail(dot)com>
"Re: Make COPY format extendable: Extract COPY TO format implementations" on Mon, 3 Mar 2025 11:06:39 -0800,
Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:

> I agree with the fix and the patch looks good to me. I've updated the
> commit message and am going to push, barring any objections.

Thanks!

I've rebased the patch set. Here is a summary again:

> 0001-0003 are for COPY TO and 0004-0007 are for COPY FROM.
>
> For COPY TO:
>
> 0001: Add support for adding custom COPY TO format. This
> uses tablesample like handler approach. We've discussed
> other approaches such as USING+CREATE XXX approach but it
> seems that other approaches are overkill for this case.
>
> See also: https://www.postgresql.org/message-id/flat/d838025aceeb19c9ff1db702fa55cabf%40postgrespro.ru#caca2799effc859f82f40ee8bec531d8
>
> 0002: Export CopyToStateData to implement custom COPY TO
> format as extension.
>
> 0003: Export a function and add a private space to
> CopyToStateData to implement custom COPY TO format as
> extension.
>
> We may want to squash 0002 and 0003 but splitting them will
> be easy to review. Because 0002 just moves existing codes
> (with some rename) and 0003 just adds some codes. If we
> squash 0002 and 0003, moving and adding are mixed.
>
> For COPY FROM:
>
> 0004: This is COPY FROM version of 0001.
>
> 0005: 0002 has COPY_ prefix -> COPY_DEST_ prefix change for
> enum CopyDest. This is similar change for enum CopySource.
>
> 0006: This is COPY FROM version of 0003.
>
> 0007: This is for easy to implement "ON_ERROR stop" and
> "LOG_VERBOSITY verbose" in extension.
>
> We may want to squash 0005-0007 like for 0002-0003.

Thanks,
--
kou

Attachment Content-Type Size
v36-0001-Add-support-for-adding-custom-COPY-TO-format.patch text/x-patch 19.0 KB
v36-0002-Export-CopyToStateData-as-private-data.patch text/x-patch 9.7 KB
v36-0003-Add-support-for-implementing-custom-COPY-TO-form.patch text/x-patch 2.4 KB
v36-0004-Add-support-for-adding-custom-COPY-FROM-format.patch text/x-patch 8.7 KB
v36-0005-Use-COPY_SOURCE_-prefix-for-CopySource-enum-valu.patch text/x-patch 3.5 KB
v36-0006-Add-support-for-implementing-custom-COPY-FROM-fo.patch text/x-patch 2.4 KB
v36-0007-Add-CopyFromSkipErrorRow-for-custom-COPY-format-.patch text/x-patch 11.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-03-05 00:10:36 Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible
Previous Message Daniel Gustafsson 2025-03-05 00:04:57 Re: ecdh support causes unnecessary roundtrips