postgres
postgres copied to clipboard
varchar类型的默认值处理问题
GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description
问题代码: gorm.io/driver/[email protected]/migrator.go:418
原因:
字段: "country" varchar(4) DEFAULT 'CN'
读取到的值: column.DefaultValueValue = "'CN'::character varying"
修复建议:
修改正则匹配空格
'(.*)'::[\w]+$
=> '(.*)'::[\w\s]+$