text: DROP PROCEDURE IF EXISTS msg.save_topic_for_entry;
  
  CREATE PROCEDURE msg.save_topic_for_entry 
  (
  	IN p_entity_type VARCHAR(25),
  	IN p_entity_id VARCHAR(25),
  	IN p_topic VARCHAR(150),
  	IN p_purpose VARCHAR(150),
  	IN p_partition_no INT,
  	IN p_compacted BOOLEAN,
  	IN p_read_earliest BOOLEAN
  ) 
  AS $$
  BEGIN
  
  	INSERT INTO msg.messaging_entities
  	(
  		entity_type,
  		entity_id,
  		topic,
  		purpose,
  		partition_no,
  		compacted,
  		read_earliest
  	)
  	VALUES
  	(
  		p_entity_type,
  		p_entity_id,
  		p_topic,
  		p_purpose,
  		p_partition_no,
  		p_compacted,
  		p_read_earliest
  	);
  	
  END
  $$ LANGUAGE plpgsql;