Thank you Tom, you were right. I needed to group by all the columns: reldatabase, reltablespace, relforknumber too. Now all of them are unique. Thank you for clearing this out :) -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general