postgres icon indicating copy to clipboard operation
postgres copied to clipboard

varchar类型的默认值处理问题

Open yuxinyin opened this issue 2 years ago • 0 comments

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]+$

yuxinyin avatar Oct 13 '22 13:10 yuxinyin