If you want to send [NULL, 'null', '{"key": "value"}']::jsonb[] to postgres there are means to do so.
I think the fix is the allow us to write:
TypedValue(
Type.jsonbArray,
[
TypedValue(type.jsonbArray, null, isSqlNull: true), // NULL
null, // 'null'::jsonb
{"key": "value"}, //'{"key": "value"}'::jsonb
],
isSqlNull: false,
),
Probably, something we can fix in:
|
case TypeOid.jsonbArray: |
|
{ |
|
if (input is List) { |
|
final objectsArray = input |
|
.map(_jsonFusedEncoding(encoding).encode) |
|
.toList(); |
|
return _writeListBytes<List<int>>( |
|
objectsArray, |
|
3802, |
|
(item) => item.length + 1, |
|
(writer, item) { |
|
writer.writeUint8(1); |
|
writer.write(item); |
|
}, |
|
encoding, |
|
); |
|
} |
|
throw FormatException( |
|
'Invalid type for parameter value. Expected: List Got: ${input.runtimeType}', |
|
); |
|
} |
All we really need is a sentinel value that acts as SQL NULL, we probably don't even need to change anything we can just interpret TypedValue(type.jsonbArray, null, isSqlNull: true) as such sentinel.
If you want to send
[NULL, 'null', '{"key": "value"}']::jsonb[]to postgres there are means to do so.I think the fix is the allow us to write:
Probably, something we can fix in:
postgresql-dart/lib/src/types/binary_codec.dart
Lines 583 to 603 in ffcd22a
All we really need is a sentinel value that acts as SQL
NULL, we probably don't even need to change anything we can just interpretTypedValue(type.jsonbArray, null, isSqlNull: true)as such sentinel.