|
4 | 4 | *This module sets planner hooks, handles SELECT queries and produces
|
5 | 5 | *paths for partitioned tables
|
6 | 6 | *
|
7 |
| - * Copyright (c) 2015-2016, Postgres Professional |
| 7 | + * Copyright (c) 2015-2021, Postgres Professional |
8 | 8 | *
|
9 | 9 | * ------------------------------------------------------------------------
|
10 | 10 | */
|
@@ -281,6 +281,32 @@ estimate_paramsel_using_prel(const PartRelationInfo *prel, int strategy)
|
281 | 281 | elsereturn1.0;
|
282 | 282 | }
|
283 | 283 |
|
| 284 | +#if defined(PGPRO_EE)&&PG_VERSION_NUM >=130000 |
| 285 | +/* |
| 286 | + * Reset cache at start and at finish ATX transaction |
| 287 | + */ |
| 288 | +staticvoid |
| 289 | +pathman_xact_cb(XactEventevent,void*arg) |
| 290 | +{ |
| 291 | +if (getNestLevelATX()>0) |
| 292 | +{ |
| 293 | +/* |
| 294 | + * For each ATX transaction start/finish: need to reset pg_pathman |
| 295 | + * cache because we shouldn't see uncommitted data in autonomous |
| 296 | + * transaction and data of autonomous transaction in main transaction |
| 297 | + */ |
| 298 | +if ((event==XACT_EVENT_START/* start */)|| |
| 299 | +(event==XACT_EVENT_ABORT|| |
| 300 | +event==XACT_EVENT_PARALLEL_ABORT|| |
| 301 | +event==XACT_EVENT_COMMIT|| |
| 302 | +event==XACT_EVENT_PARALLEL_COMMIT|| |
| 303 | +event==XACT_EVENT_PREPARE/* finish */)) |
| 304 | +{ |
| 305 | +pathman_relcache_hook(PointerGetDatum(NULL),InvalidOid); |
| 306 | +} |
| 307 | +} |
| 308 | +} |
| 309 | +#endif |
284 | 310 |
|
285 | 311 | /*
|
286 | 312 | * -------------------
|
@@ -330,6 +356,11 @@ _PG_init(void)
|
330 | 356 | init_partition_filter_static_data();
|
331 | 357 | init_partition_router_static_data();
|
332 | 358 | init_partition_overseer_static_data();
|
| 359 | + |
| 360 | +#if defined(PGPRO_EE)&&PG_VERSION_NUM >=130000 |
| 361 | +/* Callbacks for reload relcache for ATX transactions */ |
| 362 | +RegisterXactCallback(pathman_xact_cb,NULL); |
| 363 | +#endif |
333 | 364 | }
|
334 | 365 |
|
335 | 366 | /* Get cached PATHMAN_CONFIG relation Oid */
|
|