summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarik Gamble <darik.gamble@gmail.com>2015-02-27 10:06:44 -0500
committerDarik Gamble <darik.gamble@gmail.com>2015-02-27 10:06:44 -0500
commit687578eafbe18b8538f23ff951207e5c15efae0c (patch)
treea907cefa9032c317dbfaf7e56f04ba5603c9c350
parent5d44904aa3f7d25c0eba2ae2893d966fa64a0598 (diff)
\dn suggests schemas only
-rw-r--r--pgcli/packages/sqlcompletion.py3
-rw-r--r--tests/test_pgspecial.py8
2 files changed, 11 insertions, 0 deletions
diff --git a/pgcli/packages/sqlcompletion.py b/pgcli/packages/sqlcompletion.py
index 91bd616d..b4379437 100644
--- a/pgcli/packages/sqlcompletion.py
+++ b/pgcli/packages/sqlcompletion.py
@@ -86,6 +86,9 @@ def suggest_special(text):
if cmd == '\\c':
return [{'type': 'database'}]
+ if cmd == '\\dn':
+ return [{'type': 'schema'}]
+
if arg:
# Try to distinguish "\d name" from "\d schema.name"
# Note that this will fail to obtain a schema name if wildcards are
diff --git a/tests/test_pgspecial.py b/tests/test_pgspecial.py
index e16631a2..39f9f979 100644
--- a/tests/test_pgspecial.py
+++ b/tests/test_pgspecial.py
@@ -11,6 +11,14 @@ def test_slash_d_suggests_special():
assert sorted_dicts(suggestions) == sorted_dicts(
[{'type': 'special'}])
+def test_dn_suggests_schemata():
+ suggestions = suggest_type('\\dn ', '\\dn ')
+ assert suggestions == [{'type': 'schema'}]
+
+ suggestions = suggest_type('\\dn xxx', '\\dn xxx')
+ assert suggestions == [{'type': 'schema'}]
+
+
def test_d_suggests_tables_and_schemas():
suggestions = suggest_type('\d ', '\d ')
assert sorted_dicts(suggestions) == sorted_dicts([