core: fixing user types cleanup support

Changing implementation code to support PG version < 9.2
Since we support CentOS 6.5 that comes with PG 8.4, the query that gets
the user defined types cannot rely on the user_defined_types view that
was added only in PG 9.2.

This patch changed the underlying PG query to use basic pg tables that
exists in PG 8.4 and up.

Change-Id: I9a13cbf218bc39f9b5d3f988e10cfadb7121af67
Signed-off-by: Eli Mesika <emesika@redhat.com>