PostgreSQL patch: Do not return system views/tables unless :owner is :all

Joel Reymont <[email protected]> Thu, 22 Jun 2006 15:01:29 +0100
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
This is a patch against 3.6.1.

For whatever reason (list-views) and friends return system views and  
tables. This causes truncate-database to try to drop system views/ 
tables which fails. It also causes tests to fail since they expect to  
get back just the tables that they have created.

I tested the patch by running the test harness.

sql/generic-postgresql.lisp
80,90c80
<                    (if (not (eq owner :all))
<                    "
< 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 ('~A','')
<       AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
<       AND pg_catalog.pg_table_is_visible(c.oid)
<       ~A"
<                    "SELECT relname FROM pg_class WHERE (relkind =  
'~A')~A")
---
 >                  "SELECT relname FROM pg_class WHERE (relkind =  
'~A')~A"



--
http://wagerlabs.com/