On Sun, Nov 10, 2024 at 3:29 AM Joel Jacobson <j...@compiler.org> wrote: > > Cool. I've drafted a new patch on this approach. > The list of newline-free built-in types is not exhaustive, yet.
do we care that COPY back and forth always work? doc not mentioned, but seems it's an implicit idea. copy the_table to '/tmp/3.txt' with (format whatever_format); truncate the_table; copy the_table from '/tmp/3.txt' with (format whatever_format); but v20, will not work for an non-text column with SQL NULL data in it. example: drop table if exists x1; create table x1(a int); insert into x1 select null; copy x1 to '/tmp/3.txt' with (format list); copy x1 from '/tmp/3.txt' with (format list); ERROR: invalid input syntax for type integer: "" CONTEXT: COPY x1, line 1, column a: "" <para> The <literal>list</literal> format does not distinguish a <literal>NULL</literal> value from an empty string. Empty lines are imported as empty strings, not as <literal>NULL</literal> values. </para> we only mentioned import, not export (COPY TO) dealing with NULL value. + if (c == '\n' || c == '\r') + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("list format doesn't support newlines in field values"), + errhint("Consider using csv or text format for data containing newlines."))); "list format doesn't support newlines in field values" word list need single or double quote? ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Unsupported COPY format"))); should be "unsupported" per https://www.postgresql.org/docs/current/error-style-guide.html#ERROR-STYLE-GUIDE-CASE