8000 Support Numeric Conversion from Object to Double · qza/postgres-async-driver@b47f0a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit b47f0a0

Browse files
Support Numeric Conversion from Object to Double
1 parent dc6b2c5 commit b47f0a0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/com/github/pgasync/impl/conversion/DataConverter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public <TArray> TArray toArray(Class<TArray> arrayType, Oid oid, byte[] value) {
8888
case FLOAT8_ARRAY:
8989
return ArrayConversions.toArray(arrayType, oid, value, NumericConversions::toBigDecimal);
9090

91+
case NUMERIC_ARRAY:
92+
return ArrayConversions.toArray(arrayType, oid, value, NumericConversions::toDouble);
93+
9194
case TIMESTAMP_ARRAY:
9295
case TIMESTAMPTZ_ARRAY:
9396
return ArrayConversions.toArray(arrayType, oid, value, TemporalConversions::toTimestamp);
@@ -178,6 +181,7 @@ public Object toObject(Oid oid, byte[] value) {
178181
case INT8: return toLong(oid, value);
179182
case FLOAT4: // fallthrough
180183
case FLOAT8: return toBigDecimal(oid, value);
184+
case NUMERIC: return toDouble(oid, value);
181185
case BYTEA: return toBytes(oid, value);
182186
case DATE: return toDate(oid, value);
183187
case TIMETZ: // fallthrough

src/main/java/com/github/pgasync/impl/conversion/NumericConversions.java

-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static Double toDouble(Oid oid, byte[] value) {
9595
case FLOAT8:
9696
return Double.valueOf(new String(value, UTF_8));
9797
default:
98-
throw new SqlException("Unsupported conversion " + oid.name() + " -> BigDecimal");
98+
throw new SqlException("Unsupported conversion " + oid.name() + " -> Double");
9999
}
100100
}
101101

0 commit comments

Comments
 (0)
0