merge develop

This commit is contained in:
John Guo 2021-06-28 13:15:40 +08:00
commit 2a350fd3ab

View File

@ -142,9 +142,9 @@ 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
WHERE c.relname = '%s' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid
ORDER BY a.attnum`,
strings.ToLower(table),
)
@ -160,9 +160,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