Hi,
At this time, it is my understanding that custom postgres types allow to define the INPUT and OUTPUT functions with signatures, in the case of a custom type PositiveU32:
CREATE FUNCTION "positiveu32_in"(
"input" cstring /* core::option::Option<&core::ffi::c_str::CStr> */
) RETURNS PositiveU32 /* core::option::Option<example_extension::PositiveU32> */
IMMUTABLE PARALLEL SAFE
LANGUAGE c /* Rust */
AS 'MODULE_PATHNAME', 'positiveu32_in_wrapper';
and
CREATE FUNCTION "positiveu32_out"(
"input" PositiveU32 /* example_extension::PositiveU32 */
) RETURNS cstring /* alloc::ffi::c_str::CString */
IMMUTABLE STRICT PARALLEL SAFE
LANGUAGE c /* Rust */
AS 'MODULE_PATHNAME', 'positiveu32_out_wrapper';
And that is fine if I were to submit queries that provide the column value as a JSON, but since I use diesel, the data is submitted in binary and therefore PostgreSQL searches for a function which accepts a binary signature (to my understanding). Not finding one, it raises the error: no binary input function available for type positiveu32.
How can I make the pgrx sql code generation produce the analogous binary functions? If needed, I am happy to attempt a PR, with some guidance.
It should not be related to this issue, but I feel necessary to specify that in diesel, I serialize the data using serde_cbor in order to serialize it to the same format used by pgrx, or at least that is my understanding.
Best,
Luca
Hi,
At this time, it is my understanding that custom postgres types allow to define the
INPUTandOUTPUTfunctions with signatures, in the case of a custom typePositiveU32:and
And that is fine if I were to submit queries that provide the column value as a JSON, but since I use
diesel, the data is submitted in binary and therefore PostgreSQL searches for a function which accepts a binary signature (to my understanding). Not finding one, it raises the error:no binary input function available for type positiveu32.How can I make the
pgrxsql code generation produce the analogous binary functions? If needed, I am happy to attempt a PR, with some guidance.It should not be related to this issue, but I feel necessary to specify that in diesel, I serialize the data using
serde_cborin order to serialize it to the same format used by pgrx, or at least that is my understanding.Best,
Luca