From http://stackoverflow.com/questions/8634144/get-number-of-partitions-in-postgresql-database