You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Errored when inserting array value of custom datatype in binary mode . #271
We created the custom type. And created the custom_type[] column. While inserting the array values in those columns in binary mode, the server errored with 'no binary input function available for type custom_type'.
If the array values are in the text mode, it works as expected.
Steps to reproduce
Create customType.
Create customtype[] column in a table.
insert into table values ('\0xcustomdatatypeValues,...); -> make sure this data is transferred via binary mode.
Expected outcome
The values to be inserted.
Actual outcome
Error from the server with ErrMessage: 'no binary input function available for type custom_type'.
Analysis
None.
If applicable, please provide logs that demonstrate the issue.
Please remove any sensitive information from the logs.
changed the title [-]Errored when inserting array value of custom datatype .[/-][+]Errored when inserting array value of custom datatype in binary mode .[/+]on Mar 27, 2024
Also, the input value has to be a textual (string) representation; a binary input representation is not supported in pg_tle yet. Could you try using a textual (string) representation instead of binary representation as the input and see if that works?
String representation works. But it doesn't work for binary representation of an array.
The following script will convert the text array to binary representation ( the following code converts array values to binary formats but not always).
Binary input representation (either an array or individual value) is not supported for a custom data type created by pg_tle API; Only string representative as the input format is supported.
If a binary input representative is important for your application, could you create a feature request and share your use cases so that we may add this feature in a future version?
Activity
[-]Errored when inserting array value of custom datatype .[/-][+]Errored when inserting array value of custom datatype in binary mode .[/+]leopan3 commentedon Apr 12, 2024
Hi, I was not able to reproduce this issue. Using the example from https://github.com/aws/pg_tle/blob/main/docs/09_datatypes.md#create-base-type, an array value can be successfully inserted and retrieved:
Not sure if this is related, an array value input should be enclosed within curly braces and separated by commas; https://www.postgresql.org/docs/current/arrays.html#ARRAYS-INPUT
Also, the input value has to be a textual (string) representation; a binary input representation is not supported in pg_tle yet. Could you try using a textual (string) representation instead of binary representation as the input and see if that works?
thiru-baffle commentedon Apr 17, 2024
String representation works. But it doesn't work for binary representation of an array.
The following script will convert the text array to binary representation ( the following code converts array values to binary formats but not always).
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Array;
public class Main {
}
Wireshark capture confirms that data is serialized using binary formats.
leopan3 commentedon Apr 17, 2024
Binary input representation (either an array or individual value) is not supported for a custom data type created by pg_tle API; Only string representative as the input format is supported.
If a binary input representative is important for your application, could you create a feature request and share your use cases so that we may add this feature in a future version?