SELECT table_catalog, table_schema, table_nameThe last line is useful because many predefined tables don't have primary keys.
WHERE (table_catalog, table_schema, table_name) NOT IN
(SELECT table_catalog, table_schema, table_name
WHERE constraint_type = 'PRIMARY KEY')
AND table_schema NOT IN ('information_schema', 'pg_catalog');
Since you're using the standardized information schema, this query should be portable to other SQL database systems. The identical query works on MySQL, for example.