From 5729222a0e2ca76c642e9f298148a3f6c6f43e4b Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sun, 6 Sep 2020 17:30:48 +0100 Subject: [PATCH] map "character" to Char for postgres Signed-off-by: Andrew Thornton --- dialects/postgres.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dialects/postgres.go b/dialects/postgres.go index 29889eeb..a2c0de74 100644 --- a/dialects/postgres.go +++ b/dialects/postgres.go @@ -857,10 +857,8 @@ func (db *postgres) SQLType(c *schemas.Column) string { res = schemas.Real case schemas.TinyText, schemas.MediumText, schemas.LongText: res = schemas.Text - case schemas.Char: - res = schemas.Varchar case schemas.NChar: - res = schemas.Varchar + res = schemas.Char case schemas.NVarchar: res = schemas.Varchar case schemas.Uuid: @@ -1090,8 +1088,10 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r'::char AND c.relname = $1%s A col.Nullable = (isNullable == "YES") switch strings.ToLower(dataType) { - case "character varying", "character", "string": + case "character varying", "string": col.SQLType = schemas.SQLType{Name: schemas.Varchar, DefaultLength: 0, DefaultLength2: 0} + case "character": + col.SQLType = schemas.SQLType{Name: schemas.Char, DefaultLength: 0, DefaultLength2: 0} case "timestamp without time zone": col.SQLType = schemas.SQLType{Name: schemas.DateTime, DefaultLength: 0, DefaultLength2: 0} case "timestamp with time zone":