Display empty schemas on the sidebar (#621)
* Display empty schemas on the sidebar * Add schemas fetching test * Skip pg_temp schemas * Exclude pg_temp tables from other queries
This commit is contained in:
@@ -234,6 +234,12 @@ func testDatabases(t *testing.T) {
|
||||
assertMatches(t, []string{"booktown", "postgres"}, res)
|
||||
}
|
||||
|
||||
func testSchemas(t *testing.T) {
|
||||
res, err := testClient.Schemas()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []string{"public"}, res)
|
||||
}
|
||||
|
||||
func testObjects(t *testing.T) {
|
||||
res, err := testClient.Objects()
|
||||
objects := ObjectsFromResult(res)
|
||||
@@ -617,6 +623,7 @@ func TestAll(t *testing.T) {
|
||||
testInfo(t)
|
||||
testActivity(t)
|
||||
testDatabases(t)
|
||||
testSchemas(t)
|
||||
testObjects(t)
|
||||
testTable(t)
|
||||
testTableRows(t)
|
||||
|
||||
@@ -20,7 +20,7 @@ WITH all_objects AS (
|
||||
pg_catalog.pg_namespace n ON n.oid = c.relnamespace
|
||||
WHERE
|
||||
c.relkind IN ('r','v','m','S','s','')
|
||||
AND n.nspname !~ '^pg_toast'
|
||||
AND n.nspname !~ '^pg_(toast|temp)'
|
||||
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
||||
AND has_schema_privilege(n.nspname, 'USAGE')
|
||||
|
||||
@@ -38,7 +38,7 @@ WITH all_objects AS (
|
||||
JOIN
|
||||
pg_catalog.pg_proc p ON p.pronamespace = n.oid
|
||||
WHERE
|
||||
n.nspname !~ '^pg_toast'
|
||||
n.nspname !~ '^pg_(toast|temp)'
|
||||
AND n.nspname NOT IN ('information_schema', 'pg_catalog')
|
||||
)
|
||||
SELECT * FROM all_objects
|
||||
|
||||
@@ -2,5 +2,8 @@ SELECT
|
||||
schema_name
|
||||
FROM
|
||||
information_schema.schemata
|
||||
WHERE
|
||||
schema_name NOT IN ('information_schema', 'pg_catalog')
|
||||
AND schema_name !~ '^pg_(toast|temp)'
|
||||
ORDER BY
|
||||
schema_name ASC
|
||||
|
||||
Reference in New Issue
Block a user