synth icon indicating copy to clipboard operation
synth copied to clipboard

bug: generating int2 for postgres gives 'incorrect binary data format' error

Open chesedo opened this issue 3 years ago • 0 comments

Describe the bug Trying to generate a number for a postgres int2 column gives an 'incorrect binary data format' error.

To Reproduce Steps to reproduce the behavior:

  1. Schema (postgres)
CREATE TABLE test
(
	age int2
)
  1. Schema (Synth)
{
  "type": "array",
  "length": 1,
  "content": {
    "type": "object",
    "age": {
      "type": "number",
      "subtype": "i64",
      "constant": 5
    }
  }
}
  1. See error
Error: At namespace "int2"

Caused by:
    0: Failed to insert data for collection test
    1: One or more database inserts failed: error returned from database: incorrect binary data format in bind parameter 1: incorrect binary data format in bind parameter 1
  1. Error (postgres logs)
2021-12-23 07:33:04.840 UTC [89] ERROR:  incorrect binary data format in bind parameter 1
2021-12-23 07:33:04.840 UTC [89] CONTEXT:  unnamed portal parameter $1
2021-12-23 07:33:04.840 UTC [89] STATEMENT:  INSERT INTO test (age) VALUES
	($1);

Expected behavior According to the postgres integration page the generation should succeed. On a technical level, the integration page is wrong as an int2 is equivalent to an i16 which Synth does not have.

Environment (please complete the following information):

  • OS: Linux
  • Version: 0.6.2

Additional context A successful fix should restore this e2e test and possibly also update the integration page

chesedo avatar Dec 23 '21 07:12 chesedo