diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-01-19 23:48:16 +0100 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2019-01-20 00:22:14 +0100 |
commit | 31f3817402da736b29014ace470cf70aeb126ac5 (patch) | |
tree | ab02bcacacdb944f47996f10435a94c9f0258543 /src/include | |
parent | d6ef7fe75c1fb7ccc4ad8e3dd38d4e84d6fe9b9f (diff) | |
download | postgresql-31f3817402da736b29014ace470cf70aeb126ac5.tar.gz postgresql-31f3817402da736b29014ace470cf70aeb126ac5.zip |
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
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/nodes/parsenodes.h | 1 | ||||
-rw-r--r-- | src/include/parser/parse_node.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 27782fed6cb..addc2c2ec7a 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -1969,6 +1969,7 @@ typedef struct CopyStmt bool is_program; /* is 'filename' a program to popen? */ char *filename; /* filename, or NULL for STDIN/STDOUT */ List *options; /* List of DefElem nodes */ + Node *whereClause; /* WHERE condition (or NULL) */ } CopyStmt; /* ---------------------- diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index f4e1cdd85b9..d28210af324 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -69,7 +69,8 @@ typedef enum ParseExprKind EXPR_KIND_TRIGGER_WHEN, /* WHEN condition in CREATE TRIGGER */ EXPR_KIND_POLICY, /* USING or WITH CHECK expr in policy */ EXPR_KIND_PARTITION_EXPRESSION, /* PARTITION BY expression */ - EXPR_KIND_CALL_ARGUMENT /* procedure argument in CALL */ + EXPR_KIND_CALL_ARGUMENT, /* procedure argument in CALL */ + EXPR_KIND_COPY_WHERE /* WHERE condition in COPY FROM */ } ParseExprKind; |