pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add a DEFAULT option to COPY  FROM
Date: Mon, 13 Mar 2023 14:12:32 +0000
Message-ID: <E1pbiue-003L6x-0T@gemulon.postgresql.org> (raw)

Add a DEFAULT option to COPY  FROM

This allows for a string which if an input field matches causes the
column's default value to be inserted. The advantage of this is that
the default can be inserted in some rows and not others, for which
non-default data is available.

The file_fdw extension is also modified to take allow use of this
option.

Israel Barth Rubio

Discussion: https://postgr.es/m/CAO_rXXAcqesk6DsvioOZ5zmeEmpUN5ktZf-9=9yu+DTr0Xr8Uw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9f8377f7a27910bf0f35bf5169a8046731948a79

Modified Files
--------------
contrib/file_fdw/data/copy_default.csv   |   3 +
contrib/file_fdw/expected/file_fdw.out   |  17 ++++++
contrib/file_fdw/file_fdw.c              |  20 +++++-
contrib/file_fdw/sql/file_fdw.sql        |  11 ++++
doc/src/sgml/ref/copy.sgml               |  14 +++++
src/backend/commands/copy.c              |  51 ++++++++++++++++
src/backend/commands/copyfrom.c          |  20 +++---
src/backend/commands/copyfromparse.c     |  85 +++++++++++++++++++++++---
src/bin/psql/t/001_basic.pl              |  25 ++++++++
src/bin/psql/t/010_tab_completion.pl     |   8 +++
src/bin/psql/tab-complete.c              |   2 +-
src/include/commands/copy.h              |   2 +
src/include/commands/copyfrom_internal.h |  14 +++--
src/test/regress/expected/copy2.out      |  98 ++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql           | 101 +++++++++++++++++++++++++++++++
15 files changed, 447 insertions(+), 24 deletions(-)



Message-ID: <E1pbiue-003L6x-0T@gemulon.postgresql.org>
Permalink:  ../E1pbiue-003L6x-0T@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pbiue-003L6x-0T@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net
  Subject: Re: pgsql: Add a DEFAULT option to COPY  FROM
  In-Reply-To: <E1pbiue-003L6x-0T@gemulon.postgresql.org>
  References: <E1pbiue-003L6x-0T@gemulon.postgresql.org>

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

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