public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Bruce Momjian <[email protected]>
Cc: Kyotaro Horiguchi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: COPY TO (FREEZE)?
Date: Sat, 28 Oct 2023 21:39:53 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<20220802061746.4jjwudlkszpaqhbg@jrouhaud>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Bruce Momjian <[email protected]> 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.

+	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 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")));

			regards, tom lane






view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: COPY TO (FREEZE)?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox