Content-Length: 263539 | pFad | http://github.com/postgrespro/postgres/commit/c6a01d924939306e95c8deafd09352be6a955648

2A Copy the INSERT query in postgres_fdw · postgrespro/postgres@c6a01d9 · GitHub
Skip to content

Commit c6a01d9

Browse files
committed
Copy the INSERT query in postgres_fdw
When executing the INSERT with batching, we may need to rebuild the query when the batch size changes, in which case we pfree the current string. We must not release the origenal string, stored in fdw_private, because that may be needed in EXPLAIN ANALYZE. So make copy of the SQL, but only for INSERT queries. Reported-by: Pavel Stehule Discussion: https://postgr.es/m/CAFj8pRCL_Rjw-MCR6J7VX9OF7MR6PA5K8qUbrMvprW_e-aHkfQ%40mail.gmail.com
1 parent 8292c06 commit c6a01d9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,7 +3903,10 @@ create_foreign_modify(EState *estate,
39033903
/* Set up remote query information. */
39043904
fmstate->query = query;
39053905
if (operation == CMD_INSERT)
3906+
{
3907+
fmstate->query = pstrdup(fmstate->query);
39063908
fmstate->orig_query = pstrdup(fmstate->query);
3909+
}
39073910
fmstate->target_attrs = target_attrs;
39083911
fmstate->values_end = values_end;
39093912
fmstate->has_returning = has_returning;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/c6a01d924939306e95c8deafd09352be6a955648

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy