From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Adam Berlin <berlin.ab@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Surafel Temesgen <surafel3000@gmail.com>
Subject: Re: COPY FROM WHEN condition
Date: Sun, 11 Nov 2018 21:59:13 +0100
Message-ID: <7f9880a1-416e-649d-3a5a-e36bff538814@2ndquadrant.com> (raw)
In-Reply-To: <154177868369.24563.8425283889569429535.pgcf@coridan.postgresql.org>
References: <CALAY4q_DdpWDuB5-Zyi-oTtO2uSk8pmy+dupiRe3AvAc++1imA@mail.gmail.com>
<c8cee82b-ae71-4153-a29f-fd6f15ff631f@manitou-mail.org>
<154177868369.24563.8425283889569429535.pgcf@coridan.postgresql.org>
On 11/9/18 4:51 PM, Adam Berlin wrote:
> As a newcomer to this patch, when I read this example:
>
> COPY table_name WHEN (some_condition)
>
> .. I expect COPY to only be run when the condition is true, and I do
not expect the WHEN clause to filter rows. I'm curious what you think about:
>
Hmmm. Currently we have WHEN clause in three places:
1) triggers, where it specifies arbitrary expression on rows,
determining whether the trigger should be invoked at all
2) event triggers, where it does about the same thing as for regular
triggers, but only expressions "column IN (...)" are allowed
3) CASE WHEN ... THEN ...
I'd say 3 is rather unrelated to this discussion, and 1+2 seem to
support you objection to using WHEN for COPY, as it kinda specifies
whether the command itself should be executed.
> 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.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, berlin.ab@gmail.com, pgsql-hackers@lists.postgresql.org, surafel3000@gmail.com
Subject: Re: COPY FROM WHEN condition
In-Reply-To: <7f9880a1-416e-649d-3a5a-e36bff538814@2ndquadrant.com>
* 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