Display materialized views

This commit is contained in:
Dan Sosedoff
2016-01-14 21:30:19 -06:00
parent 2721a90455
commit 3af20f9327
4 changed files with 38 additions and 32 deletions

View File

@@ -25,9 +25,10 @@ type Result struct {
}
type Objects struct {
Tables []string `json:"tables"`
Views []string `json:"views"`
Sequences []string `json:"sequences"`
Tables []string `json:"tables"`
Views []string `json:"views"`
MaterializedViews []string `json:"materialized_views"`
Sequences []string `json:"sequences"`
}
// Due to big int number limitations in javascript, numbers should be encoded
@@ -115,9 +116,10 @@ func ObjectsFromResult(res *Result) map[string]*Objects {
if objects[schema] == nil {
objects[schema] = &Objects{
Tables: []string{},
Views: []string{},
Sequences: []string{},
Tables: []string{},
Views: []string{},
MaterializedViews: []string{},
Sequences: []string{},
}
}
@@ -126,6 +128,8 @@ func ObjectsFromResult(res *Result) map[string]*Objects {
objects[schema].Tables = append(objects[schema].Tables, name)
case "view":
objects[schema].Views = append(objects[schema].Views, name)
case "materialized_view":
objects[schema].MaterializedViews = append(objects[schema].MaterializedViews, name)
case "sequence":
objects[schema].Sequences = append(objects[schema].Sequences, name)
}

File diff suppressed because one or more lines are too long

View File

@@ -130,7 +130,7 @@ FROM
LEFT JOIN
pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE
c.relkind IN ('r','v','S','s','') AND
c.relkind IN ('r','v','m','S','s','') AND
n.nspname !~ '^pg_toast' AND
n.nspname NOT IN ('information_schema', 'pg_catalog')
ORDER BY 1, 2`