diff --git a/src/pg_tde_event_capture.c b/src/pg_tde_event_capture.c index 8b1a741f..916cc293 100644 --- a/src/pg_tde_event_capture.c +++ b/src/pg_tde_event_capture.c @@ -113,7 +113,9 @@ pg_tde_ddl_command_start_capture(PG_FUNCTION_ARGS) tablespace_oid = stmt->tablespacename != NULL ? get_tablespace_oid(stmt->tablespacename, false) : MyDatabaseTableSpace; - principal_key = GetPrincipalKey(MyDatabaseId, tablespace_oid); + LWLockAcquire(tde_lwlock_enc_keys(), LW_SHARED); + principal_key = GetPrincipalKey(MyDatabaseId, tablespace_oid, LW_SHARED); + LWLockRelease(tde_lwlock_enc_keys()); if (principal_key == NULL) { ereport(ERROR,