hierarchical retreival of records in postgresql
This is a simple adjacency list traversal problem. You're not even trying to build paths, just find nodes from a root node or set. That's pretty much a textbook example of what a recursive CTE is for.

http://sqlfiddle.com/#!12/8c406/12

WITH RECURSIVE children(product_content_id, product_master_id, content_id) AS (
  SELECT pc.product_content_id, pc.product_master_id, pc.content_id
  FROM product_content pc
  WHERE pc.product_master_id = '1'
  UNION
  SELECT pc.product_content_id, pc.product_master_id, pc.content_id
  FROM product_content pc
  INNER JOIN children c ON (pc.product_master_id = c.content_id)
)
SELECT
  product_master_id AS mainproduct,
  content_id AS subproduct
FROM children;


You could pretty much adapt this from the PostgreSQL manual, which includes an example on edgelist graph traversal.



Database design side-note: Please don't use character fields for numbers. It's also not usually a good idea to use keys like A10 if the A and 10 parts have any kind of separate meaning at all.