# HG changeset patch # User catherine.devlin@gmail.com # Date 1283843642 14400 # Node ID d30471cc95acc6a1039dd8a1c6573c1c82aff7b1 # Parent 2d1235fe12522f4f8119f89433ed7aae428d774a working on column_qry for postgresql diff -r 2d1235fe1252 -r d30471cc95ac sqlpython/connections.py --- a/sqlpython/connections.py Tue Sep 07 03:01:41 2010 -0400 +++ b/sqlpython/connections.py Tue Sep 07 03:14:02 2010 -0400 @@ -323,10 +323,16 @@ AND table_type %s AND table_name %s ORDER BY table_schema, table_type, table_name %s""" - column_qry = """SELECT table_schema, object_type, table_name, column_name - FROM information_schema.columns - WHERE ( (table_schema %s %s) OR (table_schema = 'public')) - AND column_name %s %s """ + column_qry = """SELECT c.table_schema, o.object_type, c.table_name, c.column_name + FROM information_schema.columns c + JOIN ( SELECT table_type AS object_type, table_schema, table_name + FROM information_schema.tables + UNION ALL + SELECT 'view' AS object_type, table_schema, table_name + FROM information_schema.views ) o ON ( c.table_schema = o.table_schema + AND c.table_name = o.table_name ) + WHERE ( (c.table_schema %s %s) OR (c.table_schema = 'public')) + AND c.column_name %s %s """ source_qry = """SELECT owner, type, name, line, text FROM all_source WHERE owner %s %s