diff options
Diffstat (limited to 'src/include/storage/backendid.h')
-rw-r--r-- | src/include/storage/backendid.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/storage/backendid.h b/src/include/storage/backendid.h index 7d9676f5348..dec8a972715 100644 --- a/src/include/storage/backendid.h +++ b/src/include/storage/backendid.h @@ -24,4 +24,14 @@ typedef int BackendId; /* unique currently active backend identifier */ extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */ +/* backend id of our parallel session leader, or InvalidBackendId if none */ +extern PGDLLIMPORT BackendId ParallelMasterBackendId; + +/* + * The BackendId to use for our session's temp relations is normally our own, + * but parallel workers should use their leader's ID. + */ +#define BackendIdForTempRelations() \ + (ParallelMasterBackendId == InvalidBackendId ? MyBackendId : ParallelMasterBackendId) + #endif /* BACKENDID_H */ |