Permalink
Browse files

Support numeric default value both 9.4 and 9.5+, fix testcase

  • Loading branch information...
1 parent 878538b commit 41ceb9ecd9523fd69aa07adbb8c7a255ee1b21e2 @AtkinsChang AtkinsChang committed Jul 31, 2016
@@ -49,5 +49,8 @@ CREATE TABLE "test" ("smallint_auto_inc" SMALLSERIAL,
"numeric_default_neg" NUMERIC DEFAULT -1.1,
"char_dafault" CHAR(5) DEFAULT 'abcde',
"varchar_default" VARCHAR DEFAULT 'abcde',
- "text_default" TEXT DEFAULT 'abcde'
+ "text_default" TEXT DEFAULT 'abcde',
+ "char_default_empty" char(1) NOT NULL DEFAULT '',
+ "char_default_valid" char(1) NOT NULL DEFAULT 'a',
+ "char_default_invalid" char(1) NOT NULL DEFAULT 'ab'
);
@@ -63,7 +63,7 @@ trait PostgresProfile extends JdbcProfile {
override def schema = super.schema.filter(_ != "public") // remove default schema
}
override def createColumnBuilder(tableBuilder: TableBuilder, meta: MColumn): ColumnBuilder = new ColumnBuilder(tableBuilder, meta) {
- val NumericPattern = "^'(-?[0-9]+.?[0-9]*)'::(?:numeric|bigint|integer)".r
+ val NumericPattern = "^['(]?(-?[0-9]+\\.?[0-9]*)[')]?(?:::(?:numeric|bigint|integer))?".r
val TextPattern = "^'(.*)'::(?:bpchar|character varying|text)".r
val UUIDPattern = "^'(.*)'::uuid".r
override def default = meta.columnDef.map((_,tpe)).collect{

0 comments on commit 41ceb9e

Please sign in to comment.