Byte strings in postgres aren't 0x... #1906
|
@ -824,6 +824,11 @@ func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
|
|||
}
|
||||
}
|
||||
|
||||
// FormatBytes formats bytes
|
||||
func (db *postgres) FormatBytes(bs []byte) string {
|
||||
return fmt.Sprintf("E'\\x%x'", bs)
|
||||
}
|
||||
|
||||
func (db *postgres) SQLType(c *schemas.Column) string {
|
||||
var res string
|
||||
switch t := c.SQLType.Name; t {
|
||||
|
|
|
@ -460,7 +460,7 @@ func formatColumnValue(dstDialect dialects.Dialect, d interface{}, col *schemas.
|
|||
if col.SQLType.IsText() {
|
||||
var v string
|
||||
switch reflect.TypeOf(d).Kind() {
|
||||
case reflect.Struct, reflect.Array, reflect.Slice:
|
||||
case reflect.Struct, reflect.Array, reflect.Slice, reflect.Map:
|
||||
bytes, err := json.DefaultJSONHandler.Marshal(d)
|
||||
if err != nil {
|
||||
v = fmt.Sprintf("%s", d)
|
||||
|
|
Loading…
Reference in New Issue
Block a user