Commit 4a8283d0 authored by Tomas Vondra's avatar Tomas Vondra

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

The checking for calls to volatile functions in the COPY FROM ... WHERE
expression was treating all WHERE clauses as if containing such calls.
While that does not produce incorrect results, this disables batching
which may result in significant performance regression.

Discussion: https://www.postgresql.org/message-id/flat/CALAY4q_DdpWDuB5-Zyi-oTtO2uSk8pmy+dupiRe3AvAc++1imA@mail.gmail.com
parent 00588103
...@@ -2612,8 +2612,7 @@ CopyFrom(CopyState cstate) ...@@ -2612,8 +2612,7 @@ CopyFrom(CopyState cstate)
*/ */
insertMethod = CIM_SINGLE; insertMethod = CIM_SINGLE;
} }
else if (cstate->whereClause != NULL || else if (contain_volatile_functions(cstate->whereClause))
contain_volatile_functions(cstate->whereClause))
{ {
/* /*
* Can't support multi-inserts if there are any volatile funcation * Can't support multi-inserts if there are any volatile funcation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment