mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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
This commit is contained in:
@ -1849,6 +1849,9 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
|
||||
case EXPR_KIND_CALL_ARGUMENT:
|
||||
err = _("cannot use subquery in CALL argument");
|
||||
break;
|
||||
case EXPR_KIND_COPY_WHERE:
|
||||
err = _("cannot use subquery in COPY FROM WHERE condition");
|
||||
break;
|
||||
|
||||
/*
|
||||
* There is intentionally no default: case here, so that the
|
||||
@ -3475,6 +3478,8 @@ ParseExprKindName(ParseExprKind exprKind)
|
||||
return "PARTITION BY";
|
||||
case EXPR_KIND_CALL_ARGUMENT:
|
||||
return "CALL";
|
||||
case EXPR_KIND_COPY_WHERE:
|
||||
return "WHERE";
|
||||
|
||||
/*
|
||||
* There is intentionally no default: case here, so that the
|
||||
|
Reference in New Issue
Block a user