Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH relpub AS (
- SELECT r.oid
- , r.relname
- FROM pg_class r
- INNER JOIN pg_namespace n ON r.relnamespace = n.oid AND r.relkind = 'r' AND n.nspname = 'public'
- ),
- pk AS (
- SELECT r.oid
- FROM relpub r
- INNER JOIN pg_index i ON r.oid = i.indrelid AND i.indisprimary
- )
- SELECT r.relname
- FROM relpub r
- WHERE NOT EXISTS (
- SELECT oid
- FROM pk
- WHERE oid = r.oid
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement