Skip to content

Commit

Permalink
Merge pull request #1280 from imloama/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn authored Jun 11, 2021
2 parents eb723e4 + b935a8c commit 5ef4ef6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions database/gdb/gdb_driver_pgsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (d *DriverPgsql) TableFields(ctx context.Context, table string, schema ...s
result Result
link, err = d.SlaveLink(useSchema)
structureSql = fmt.Sprintf(`
SELECT a.attname AS field, t.typname AS type FROM pg_class c, pg_attribute a
SELECT a.attname AS field, t.typname AS type,b.description as comment FROM pg_class c, pg_attribute a
LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid,pg_type t
WHERE c.relname = '%s' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid
ORDER BY a.attnum`,
Expand All @@ -153,9 +153,10 @@ ORDER BY a.attnum`,
fields = make(map[string]*TableField)
for i, m := range result {
fields[m["field"].String()] = &TableField{
Index: i,
Name: m["field"].String(),
Type: m["type"].String(),
Index: i,
Name: m["field"].String(),
Type: m["type"].String(),
Comment: m["comment"].String(),
}
}
return fields
Expand Down

0 comments on commit 5ef4ef6

Please sign in to comment.