Mercurial > sqlpython
changeset 507:fcaf28842db7
name1 match ok in postgres
author | catherine.devlin@gmail.com |
---|---|
date | Wed, 22 Sep 2010 23:48:20 -0400 |
parents | 5d9dddc289e1 |
children | 6f6e43ed656c |
files | sqlpython/connections.py |
diffstat | 1 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/sqlpython/connections.py Wed Sep 22 18:10:05 2010 -0400 +++ b/sqlpython/connections.py Wed Sep 22 23:48:20 2010 -0400 @@ -311,24 +311,29 @@ 'Puts a tuple of (name, value) pairs into the bind format desired by psycopg2' return dict((b[0], b[1].lower()) for b in binds) all_object_qry = """SELECT * FROM ( - SELECT a.rolname AS owner, + SELECT ns.nspname AS schema, CASE c.relkind WHEN 'r' THEN 'table' WHEN 'i' THEN 'index' - WHEN 's' THEN 'sequence' + WHEN 'S' THEN 'sequence' WHEN 'v' THEN 'view' WHEN 'c' THEN 'composite type' WHEN 't' THEN 'toast table' END AS object_type, c.relname AS object_name, NULL AS synonym_name - FROM pg_authid a - JOIN pg_class c ON (a.oid = c.relowner) - WHERE a.rolname = %%(schema)s + FROM pg_namespace ns + JOIN pg_class c ON (ns.oid = c.relnamespace) + WHERE ( ns.nspname = %%(schema)s + OR position(ns.nspname in (SELECT setting FROM pg_settings WHERE name = 'search_path')) > 0 + OR ( %(all)s + AND ns.nspname = 'pg_catalog' + ) + ) AND c.relname %(name1_comparitor)s %%(name1)s ) subq WHERE object_type %(object_type_comparitor)s %%(object_type)s - ORDER BY object_type, owner, object_name %(sort)s""" + ORDER BY object_type, schema, object_name %(sort)s""" column_qry = """SELECT c.table_schema, t.table_type, c.table_name, c.column_name FROM information_schema.columns c JOIN information_schema.tables t ON (c.table_schema = t.table_schema @@ -339,8 +344,8 @@ FROM all_source WHERE owner %s %s AND UPPER(text) LIKE %s""" - gerald_types = {'BASE TABLE': gerald.postgres_schema.Table, - 'VIEW': gerald.postgres_schema.View} + gerald_types = {'table': gerald.postgres_schema.Table, + 'view': gerald.postgres_schema.View} class OracleInstance(DatabaseInstance): rdbms = 'oracle'