Обсуждение: pgsql: Allow COPY FROM to filter data using WHERE conditions

Поиск
Список
Период
Сортировка

pgsql: Allow COPY FROM to filter data using WHERE conditions

От
Tomas Vondra
Дата:
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.gmail.com

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(-)