fix default on postgres

This commit is contained in:
Lunny Xiao 2019-09-28 18:51:59 +08:00
parent 7ebd9c4fe2
commit 3c9bea03bb
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 2 additions and 2 deletions

View File

@ -1046,8 +1046,8 @@ WHERE c.relkind = 'r'::char AND c.relname = $1%s AND f.attnum > 0 ORDER BY f.att
col.Length = maxLen
if !col.DefaultIsEmpty && (col.SQLType.IsText() || col.SQLType.IsTime()) {
if col.Default == "''::character varying" {
col.Default = "''"
if strings.HasSuffix(col.Default, "::character varying") {
col.Default = strings.TrimRight(col.Default, "::character varying")
} else if !strings.HasPrefix(col.Default, "'") {
col.Default = "'" + col.Default + "'"
}