From e999912036d1bf7842e65d96e1732c68e8de522d Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 6 Jun 2018 17:40:22 -0400 Subject: [PATCH] update dialect --- dialect_postgres.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dialect_postgres.go b/dialect_postgres.go index dd101375..309c1dc8 100644 --- a/dialect_postgres.go +++ b/dialect_postgres.go @@ -993,9 +993,9 @@ WHERE c.relkind = 'r'::char AND c.relname = $1%s AND f.attnum > 0 ORDER BY f.att col.Indexes = make(map[string]int) var colName, isNullable, dataType string - var maxLenStr, colDefault, numPrecision *string + var maxLenStr, colDefault, numPrecision, numRadix *string var isPK, isUnique bool - err = rows.Scan(&colName, &colDefault, &isNullable, &dataType, &maxLenStr, &numPrecision, &isPK, &isUnique) + err = rows.Scan(&colName, &colDefault, &isNullable, &dataType, &maxLenStr, &numPrecision, &numRadix, &isPK, &isUnique) if err != nil { return nil, nil, err } @@ -1026,7 +1026,7 @@ WHERE c.relkind = 'r'::char AND c.relname = $1%s AND f.attnum > 0 ORDER BY f.att col.Nullable = (isNullable == "YES") switch strings.ToLower(dataType) { - case "character varying", "character": + case "character varying", "character", "varchar": col.SQLType = core.SQLType{Name: core.Varchar, DefaultLength: 0, DefaultLength2: 0} case "timestamp without time zone": col.SQLType = core.SQLType{Name: core.DateTime, DefaultLength: 0, DefaultLength2: 0} @@ -1047,7 +1047,7 @@ WHERE c.relkind = 'r'::char AND c.relname = $1%s AND f.attnum > 0 ORDER BY f.att if startIdx != -1 && strings.HasSuffix(dataType, ")") { length := dataType[startIdx+8 : len(dataType)-1] l, _ := strconv.Atoi(length) - col.SQLType = core.SQLType{Name: "varchar", DefaultLength: l, DefaultLength2: 0} + col.SQLType = core.SQLType{Name: "VARCHAR", DefaultLength: l, DefaultLength2: 0} } else { col.SQLType = core.SQLType{Name: strings.ToUpper(dataType), DefaultLength: 0, DefaultLength2: 0} }