RE: COPY FROM WHEN condition

myungkyu.lim <myungkyu.lim@samsung.com>

From: "myungkyu.lim" <myungkyu.lim@samsung.com>
To: "'Tomas Vondra'" <tomas.vondra@2ndquadrant.com>, "'Adam Berlin'" <berlin.ab@gmail.com>, <pgsql-hackers@lists.postgresql.org>
Cc: "'Surafel Temesgen'" <surafel3000@gmail.com>
Date: 2018-11-12T07:44:49Z
Lists: pgsql-hackers
>> COPY table_name WHERE (some_condition)
>> 
>> Users should already be familiar with the idea that WHERE performs a filter.
>> 

> So, what about using FILTER here? We already use it for aggregates when
> filtering rows to process.

> That being said, I have no strong feelings either way. I'd be OK with
> both WHEN and WHERE.

I don't think it's an important point,

In gram.y,
	where_clause:
			WHERE a_expr							{ $$ = $2; }
			| /*EMPTY*/							{ $$ = NULL; }
		;
This is similar to the 'opt_when_clause' in this patch.

So, I think 'WHERE' is a better form.

BTW, 3rd patch worked very well in my tests.
However, some wrong code style still exists.

	Node    *whenClause= NULL;
	cstate->whenClause=whenClause;

Best regards,
Myungkyu, Lim



Commits

  1. Remove unused struct member, enforce multi_insert callback presence.

  2. Separate per-batch and per-tuple memory contexts in COPY

  3. Fix handling of volatile expressions in COPY FROM ... WHERE

  4. Allow COPY FROM to filter data using WHERE conditions

  5. Remove obsolete netbsd dynloader code