Skip to content

Commit a1830ef

Browse files
committed
missing numeric type mappings fix from sqlc-dev#33
1 parent cf3a9bf commit a1830ef

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/core/postgresql_type.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@ func postgresType(req *plugin.GenerateRequest, col *plugin.Column) (string, bool
1111
columnType := sdk.DataType(col.Type)
1212

1313
switch columnType {
14-
case "serial", "pg_catalog.serial4":
14+
case "serial", "serial4", "pg_catalog.serial4":
1515
return "Int", false
1616

17-
case "bigserial", "pg_catalog.serial8":
17+
case "bigserial", "serial8", "pg_catalog.serial8":
1818
return "Long", false
1919

20-
case "smallserial", "pg_catalog.serial2":
20+
case "smallserial", "serial2", "pg_catalog.serial2":
2121
return "Short", false
2222

2323
case "integer", "int", "int4", "pg_catalog.int4":
2424
return "Int", false
2525

26-
case "bigint", "pg_catalog.int8":
26+
case "bigint", "int8", "pg_catalog.int8":
2727
return "Long", false
2828

29-
case "smallint", "pg_catalog.int2":
29+
case "smallint", "int2", "pg_catalog.int2":
3030
return "Short", false
3131

32-
case "float", "double precision", "pg_catalog.float8":
32+
case "float", "double precision", "float8", "pg_catalog.float8":
3333
return "Double", false
3434

35-
case "real", "pg_catalog.float4":
35+
case "real", "float4", "pg_catalog.float4":
3636
return "Float", false
3737

38-
case "pg_catalog.numeric":
38+
case "numeric", "pg_catalog.numeric":
3939
return "java.math.BigDecimal", false
4040

4141
case "bool", "pg_catalog.bool":
@@ -52,13 +52,13 @@ func postgresType(req *plugin.GenerateRequest, col *plugin.Column) (string, bool
5252
// Date and time mappings from https://jdbc.postgresql.org/documentation/head/java8-date-time.html
5353
return "LocalDate", false
5454

55-
case "pg_catalog.time", "pg_catalog.timetz":
55+
case "time", "pg_catalog.time", "timetz", "pg_catalog.timetz":
5656
return "LocalTime", false
5757

58-
case "pg_catalog.timestamp":
58+
case "timestamp", "pg_catalog.timestamp":
5959
return "LocalDateTime", false
6060

61-
case "pg_catalog.timestamptz", "timestamptz":
61+
case "timestamptz", "pg_catalog.timestamptz":
6262
// TODO
6363
return "OffsetDateTime", false
6464

0 commit comments

Comments
 (0)