Skip to content

Commit 4131f75

Browse files
committed
Repair find_inheritance_children with no active snapshot
When working on a scan with only a catalog snapshot, we may not have an ActiveSnapshot set. If we were to come across a detached partition, that would cause a crash. Fix by only ignoring detached partitions when there's an active snapshot.
1 parent a3027e1 commit 4131f75

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/catalog/pg_inherits.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,13 @@ find_inheritance_children(Oid parentrelId, bool include_detached,
106106
*
107107
* The reason for this check is that we want to avoid seeing the
108108
* partition as alive in RI queries during REPEATABLE READ or
109-
* SERIALIZABLE transactions.
109+
* SERIALIZABLE transactions. (If there's no active snapshot set,
110+
* that means we're not running a user query, so it's OK to always
111+
* include detached partitions in that case.)
110112
*/
111113
if (((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhdetachpending &&
112-
!include_detached)
114+
!include_detached &&
115+
ActiveSnapshotSet())
113116
{
114117
TransactionId xmin;
115118
Snapshot snap;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy