diff --git a/src/smgr/pg_tde_smgr.c b/src/smgr/pg_tde_smgr.c index 872baac3..7f1bb052 100644 --- a/src/smgr/pg_tde_smgr.c +++ b/src/smgr/pg_tde_smgr.c @@ -42,6 +42,15 @@ tde_smgr_get_key(SMgrRelation reln) TdeCreateEvent* event = GetCurrentTdeCreateEvent(); + // see if we have a key for the relation, and return if yes + RelKeyData* rkd = GetRelationKey(reln->smgr_rlocator.locator); + + if(rkd != NULL) + { + recursion--; + return rkd; + } + // if this is a CREATE TABLE, we have to generate the key if(event->encryptMode == true && event->eventType == TDE_TABLE_CREATE_EVENT) { @@ -58,12 +67,9 @@ tde_smgr_get_key(SMgrRelation reln) return pg_tde_create_key_map_entry(&reln->smgr_rlocator.locator); } - // otherwise, see if we have a key for the relation, and return if yes - RelKeyData* rkd = GetRelationKey(reln->smgr_rlocator.locator); - recursion--; - return rkd; + return NULL; } void