summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2015-02-12 13:14:08 -0800
committerAmjith Ramanujam <amjith.r@gmail.com>2015-02-12 13:14:08 -0800
commitb05a83cce2d7f401ae5f4efad47a63c465e0603f (patch)
treeca1a26dfe9259d45d77ee4ddc5f1fe4f9db68649
parentcfeb299684f910d408acb0257bd823ce84018db0 (diff)
parent12242dc7486fa9740a495641752e97150e0d3ab2 (diff)
Merge pull request #151 from darikg/bugfix_tables_query
bugfix: make tables query schema filter match schematas query
-rw-r--r--pgcli/pgcompleter.py6
-rw-r--r--pgcli/pgexecute.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/pgcli/pgcompleter.py b/pgcli/pgcompleter.py
index 95b8525c..df36d2fd 100644
--- a/pgcli/pgcompleter.py
+++ b/pgcli/pgcompleter.py
@@ -96,7 +96,11 @@ class PGCompleter(Completer):
# dbmetadata['schema_name']['table_name'] should be a list of column
# names. Default to an asterisk
for schema, table in table_data:
- self.dbmetadata[schema][table] = ['*']
+ try:
+ self.dbmetadata[schema][table] = ['*']
+ except AttributeError:
+ _logger.error('Table %r listed in unrecognized schema %r',
+ table, schema)
self.all_completions.update(t[1] for t in table_data)
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py
index 093314dd..e50b770d 100644
--- a/pgcli/pgexecute.py
+++ b/pgcli/pgexecute.py
@@ -43,8 +43,8 @@ class PGExecute(object):
LEFT JOIN pg_catalog.pg_namespace n
ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','v', 'm') -- table, view, materialized view
- AND n.nspname !~ '^pg_toast'
- AND n.nspname NOT IN ('information_schema', 'pg_catalog')
+ AND n.nspname !~ '^pg_'
+ AND nspname <> 'information_schema'
ORDER BY 1,2;'''
columns_query = '''