Fix postgres genScanResult (#1972)

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1972
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny Xiao 2021-07-07 11:34:33 +08:00
parent c433fd51cb
commit bb91a0773c
1 changed files with 3 additions and 7 deletions

View File

@ -1387,26 +1387,22 @@ func (p *pqDriver) GenScanResult(colType string) (interface{}, error) {
case "VARCHAR", "TEXT":
var s sql.NullString
return &s, nil
case "BIGINT":
case "BIGINT", "BIGSERIAL":
var s sql.NullInt64
return &s, nil
case "TINYINT", "INT", "INT8", "INT4":
case "SMALLINT", "INT", "INT8", "INT4", "INTEGER", "SERIAL":
var s sql.NullInt32
return &s, nil
case "FLOAT", "FLOAT4":
case "FLOAT", "FLOAT4", "REAL", "DOUBLE PRECISION":
var s sql.NullFloat64
return &s, nil
case "DATETIME", "TIMESTAMP":
var s sql.NullTime
return &s, nil
case "BIT":
var s sql.RawBytes
return &s, nil
case "BOOL":
var s sql.NullBool
return &s, nil
default:
fmt.Printf("unknow postgres database type: %v\n", colType)
var r sql.RawBytes
return &r, nil
}