postgres query to find partitioned table