Merge pull request #254 from skabbes/feature/comments
Expose postgres comments to table and columns
This commit is contained in:
commit
dc57d5d15f
@ -206,7 +206,7 @@ func test_Objects(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
assert.Equal(t, []string{"schema", "name", "type", "owner"}, res.Columns)
|
assert.Equal(t, []string{"schema", "name", "type", "owner", "comment"}, res.Columns)
|
||||||
assert.Equal(t, []string{"public"}, mapKeys(objects))
|
assert.Equal(t, []string{"public"}, mapKeys(objects))
|
||||||
assert.Equal(t, tables, objects["public"].Tables)
|
assert.Equal(t, tables, objects["public"].Tables)
|
||||||
assert.Equal(t, []string{"recent_shipments", "stock_view"}, objects["public"].Views)
|
assert.Equal(t, []string{"recent_shipments", "stock_view"}, objects["public"].Views)
|
||||||
@ -230,6 +230,7 @@ func test_Table(t *testing.T) {
|
|||||||
"character_maximum_length",
|
"character_maximum_length",
|
||||||
"character_set_catalog",
|
"character_set_catalog",
|
||||||
"column_default",
|
"column_default",
|
||||||
|
"comment",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, nil, err)
|
assert.Equal(t, nil, err)
|
||||||
|
@ -81,7 +81,8 @@ SELECT
|
|||||||
is_nullable,
|
is_nullable,
|
||||||
character_maximum_length,
|
character_maximum_length,
|
||||||
character_set_catalog,
|
character_set_catalog,
|
||||||
column_default
|
column_default,
|
||||||
|
pg_catalog.col_description(($1::text || '.' || $2::text)::regclass::oid, ordinal_position) as comment
|
||||||
FROM
|
FROM
|
||||||
information_schema.columns
|
information_schema.columns
|
||||||
WHERE
|
WHERE
|
||||||
@ -120,7 +121,8 @@ SELECT
|
|||||||
WHEN 's' THEN 'special'
|
WHEN 's' THEN 'special'
|
||||||
WHEN 'f' THEN 'foreign_table'
|
WHEN 'f' THEN 'foreign_table'
|
||||||
END as "type",
|
END as "type",
|
||||||
pg_catalog.pg_get_userbyid(c.relowner) as "owner"
|
pg_catalog.pg_get_userbyid(c.relowner) as "owner",
|
||||||
|
pg_catalog.obj_description(c.oid) as "comment"
|
||||||
FROM
|
FROM
|
||||||
pg_catalog.pg_class c
|
pg_catalog.pg_class c
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user