PostgreSQL list-views issue
Joel Reymont <[email protected]> Wed, 21 Jun 2006 15:25:04 +0100
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
Folks,
I have an issue with the latest CLSQL and PostgreSQL 8.1.2 on Mac
OSX. Truncate databases uses list-views to figure out what to drop
and tries to drop a bunch of system views that get returned.
According to database-list-objects-of-type in generic-
postgresql.lisp, this query is being used:
select * from pg_class where relkind = 'v'
I think this should be used instead:
SELECT c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_roles r ON r.oid = c.relowner
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('v','')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid)
What do you think?
Thanks, Joel
--
http://wagerlabs.com/