pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow COPY FROM to filter data using WHERE conditions
Date: Sat, 19 Jan 2019 23:22:26 +0000
Message-ID: <E1gkzwY-0006NV-EH@gemulon.postgresql.org> (raw)

Allow COPY FROM to filter data using WHERE conditions

Extends the COPY FROM command with a WHERE condition, which allows doing
various types of filtering while importing the data (random sampling,
condition on a data column, etc.).  Until now such filtering required
either preprocessing of the input data, or importing all data and then
filtering in the database. COPY FROM ... WHERE is an easy-to-use and
low-overhead alternative for most simple cases.

Author: Surafel Temesgen
Reviewed-by: Tomas Vondra, Masahiko Sawada, Lim Myungkyu
Discussion: https://www.postgresql.org/message-id/flat/CALAY4q_DdpWDuB5-Zyi-oTtO2uSk8pmy+dupiRe3AvAc++1imA@mail....

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/31f3817402da736b29014ace470cf70aeb126ac5

Modified Files
--------------
doc/src/sgml/ref/copy.sgml              | 27 ++++++++++++++++++
src/backend/commands/copy.c             | 49 +++++++++++++++++++++++++++++++++
src/backend/nodes/copyfuncs.c           |  1 +
src/backend/nodes/equalfuncs.c          |  1 +
src/backend/parser/gram.y               | 10 ++++++-
src/backend/parser/parse_agg.c          | 11 ++++++++
src/backend/parser/parse_expr.c         |  5 ++++
src/backend/parser/parse_func.c         |  3 ++
src/include/nodes/parsenodes.h          |  1 +
src/include/parser/parse_node.h         |  3 +-
src/interfaces/ecpg/preproc/ecpg.addons |  2 +-
src/test/regress/expected/copy2.out     | 40 ++++++++++++++++++++++++++-
src/test/regress/sql/copy2.sql          | 26 +++++++++++++++++
13 files changed, 175 insertions(+), 4 deletions(-)



Message-ID: <E1gkzwY-0006NV-EH@gemulon.postgresql.org>
Permalink:  ../E1gkzwY-0006NV-EH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gkzwY-0006NV-EH@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: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Allow COPY FROM to filter data using WHERE conditions
  In-Reply-To: <E1gkzwY-0006NV-EH@gemulon.postgresql.org>
  References: <E1gkzwY-0006NV-EH@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