Re: COPY TO (FREEZE)?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, rjuju123(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY TO (FREEZE)?
Date: 2023-10-29 01:47:03
Message-ID: ZT25lzyz3T8YA7mM@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 28, 2023 at 09:39:53PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > My apologies, wrong patch attached, right one attached now.
>
> I think this one is fine as-is:
>
> /* Only single-byte delimiter strings are supported. */
> if (strlen(opts_out->delim) != 1)
> ereport(ERROR,
> - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> + (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> errmsg("COPY delimiter must be a single one-byte character")));
>
> While we have good implementation reasons for this restriction,
> there's nothing illogical about wanting the delimiter to be more
> general. It's particularly silly, from an end-user's standpoint,
> that for example 'é' is an allowed delimiter in LATIN1 encoding
> but not when the server is using UTF8. So I don't see how the
> distinction you presented justifies this change.

Agreed, my mistake.

> + if (opts_out->freeze && !is_from)
> + ereport(ERROR,
> + (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> + errmsg("COPY freeze only available using COPY FROM")));
>
> Not thrilled by the wording here. I don't like the fact that the
> keyword FREEZE isn't capitalized, and I think you omitted too many
> words for intelligibility to be preserved. Notably, all the adjacent
> examples use "must" or "must not", and this decides that that can be
> omitted.

I think it is modeled after:

errmsg("COPY force null only available using COPY FROM")));

> I realize that you probably modeled the non-capitalization on nearby
> messages like "COPY delimiter", but there's a difference IMO:
> "delimiter" can be read as an English noun, but it's hard to read
> "freeze" as a noun.
>
> How about, say,
>
> errmsg("COPY FREEZE must not be used in COPY TO")));
>
> or perhaps that's redundant and we could write
>
> errmsg("FREEZE option must not be used in COPY TO")));

I now have:

errmsg("COPY FREEZE mode only available using COPY FROM")));

Updated patch attached.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

Attachment Content-Type Size
freeze.diff text/x-diff 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-10-29 01:54:05 Re: COPY TO (FREEZE)?
Previous Message Tom Lane 2023-10-29 01:39:53 Re: COPY TO (FREEZE)?