Re: Add support for DEFAULT specification in COPY FROM

From: Israel Barth Rubio <barthisrael(at)gmail(dot)com>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add support for DEFAULT specification in COPY FROM
Date: 2022-08-18 14:39:45
Message-ID: CAO_rXXDL1am=+W7KFhYGFgTqVCzbhjf5E_iq3Ja-0O9mDqcK4Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Ilmari,

Thanks for checking it, too. I can study to implement these changes
to include a way of overriding the behavior for the given columns.

Regards,
Israel.

Em qui., 18 de ago. de 2022 às 06:56, Dagfinn Ilmari Mannsåker <
ilmari(at)ilmari(dot)org> escreveu:

> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
> > On 2022-08-16 Tu 14:12, Israel Barth Rubio wrote:
> >> Hello all,
> >>
> >> With the current implementation of COPY FROM in PostgreSQL we are
> >> able to load the DEFAULT value/expression of a column if the column
> >> is absent in the list of specified columns. We are not able to
> >> explicitly ask that PostgreSQL uses the DEFAULT value/expression in a
> >> column that is being fetched from the input file, though.
> >>
> >> This patch adds support for handling DEFAULT values in COPY FROM. It
> >> works similarly to NULL in COPY FROM: whenever the marker that was
> >> set for DEFAULT value/expression is read from the input stream, it
> >> will evaluate the DEFAULT value/expression of the corresponding
> >> column.
> […]
> > Interesting, and probably useful. I've only had a brief look, but it's
> > important that the default marker not be quoted in CSV mode (c.f. NULL)
> > -f it is it should be taken as a literal rather than a special value.
>
> For the NULL marker that can be overridden for individual columns with
> the FORCE(_NOT)_NULL option. This feature should have a similar
> FORCE(_NOT)_DEFAULT option to allow the DEFAULT marker to be ignored, or
> recognised even when quoted, respectively.
>
> - ilmari
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-08-18 14:40:22 Re: TAP output format in pg_regress
Previous Message Mark Wong 2022-08-18 14:38:32 Re: s390x builds on buildfarm