You can use both rules and policies in one table if you define another column in a composite
create table entp_details( entp_name text, type text, name text, value text, primary key (entp_name, type, name));
Here the type is either (policy or rule).
INSERT INTO entp_details (entp_name, type, name, value) VALUES ('entp_name_xyz', 'Policy', 'p1', '{policy_name: "default policy", type: "type 1", ...}'); INSERT INTO entp_details (entp_name, type, name, value) VALUES ('entp_name_xyz', 'Policy', 'p2', '{policy_name: "default policy2", type: "type 1", ...}'); INSERT INTO entp_details (entp_name, type, name, value) VALUES ('entp_name_xyz', 'Rule', 'r1', null);
And the queries are like
select * from entp_details WHERE entp_name = 'entp_name_xyz' and type = 'Policy'; select * from entp_details WHERE entp_name = 'entp_name_xyz' and type = 'Rule';
source share