Mercurial > sqlpython
changeset 491:d30471cc95ac
working on column_qry for postgresql
author | catherine.devlin@gmail.com |
---|---|
date | Tue, 07 Sep 2010 03:14:02 -0400 |
parents | 2d1235fe1252 |
children | 1fff6f7bac1e |
files | sqlpython/connections.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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