diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index 4b4e469..fcf3581 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -255,6 +255,7 @@ RelationBuildRowSecurity(Relation relation)
 			 * short-lived memory context.  We must copy it into rscxt
 			 * explicitly below.
 			 */
+			MemoryContextSwitchTo(rscxt);
 
 			/* Get policy command */
 			value_datum = heap_getattr(tuple, Anum_pg_policy_polcmd,
@@ -284,6 +285,7 @@ RelationBuildRowSecurity(Relation relation)
 			/* Get policy qual */
 			value_datum = heap_getattr(tuple, Anum_pg_policy_polqual,
 									   RelationGetDescr(catalog), &isnull);
+
 			if (!isnull)
 			{
 				qual_value = TextDatumGetCString(value_datum);
@@ -303,28 +305,19 @@ RelationBuildRowSecurity(Relation relation)
 			else
 				with_check_qual = NULL;
 
-			/* Now copy everything into the cache context */
-			MemoryContextSwitchTo(rscxt);
-
 			policy = palloc0(sizeof(RowSecurityPolicy));
 			policy->policy_name = pstrdup(policy_name_value);
 			policy->polcmd = cmd_value;
 			policy->permissive = permissive_value;
 			policy->roles = DatumGetArrayTypePCopy(roles_datum);
-			policy->qual = copyObject(qual_expr);
-			policy->with_check_qual = copyObject(with_check_qual);
+			policy->qual = qual_expr;
+			policy->with_check_qual = with_check_qual;
 			policy->hassublinks = checkExprHasSubLink((Node *) qual_expr) ||
 				checkExprHasSubLink((Node *) with_check_qual);
 
 			rsdesc->policies = lcons(policy, rsdesc->policies);
 
 			MemoryContextSwitchTo(oldcxt);
-
-			/* clean up some (not all) of the junk ... */
-			if (qual_expr != NULL)
-				pfree(qual_expr);
-			if (with_check_qual != NULL)
-				pfree(with_check_qual);
 		}
 
 		systable_endscan(sscan);
