Replies: 1 comment
-
I'm not sure what squirrel is doing. But I would suggest calling |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good day!
Previously I used default database/sql package to connect to my Postgres.
And my Insert worked fine.
Now I changed the library to PGX (jackc/pgx/v5 v5.6.0) for the COPY method and got an interesting behavior: the code on my local system with Postgres 14.12 worked as it should and inserted all my data fine.
But the production version of Postgres 13 does something strange, giving me errors about bad insert types, as if either the columns or the data have swapped, and now the data is in the wrong columns.
ERROR: invalid input syntax for type bigint: "[{"tipPs":"3","nomPs":"13183439","dlina":0}]" (SQLSTATE 22P02) ERROR: invalid input syntax for type bigint: "2024-07-31 10:36:00.000000" (SQLSTATE 22P02) ERROR: value too long for type character varying(3) (SQLSTATE 22001) failed to encode args[0]: unable to encode 1722433220 into text format for text (OID 25): cannot find encode plan ERROR: value "010002031070605" is out of range for type smallint (SQLSTATE 22003) ERROR: value "125280" is out of range for type smallint (SQLSTATE 22003)
In my DSN I previosly used binary_parametres=yes
host=%s port=%d user=%s password=%s dbname=%s sslmode=%s connect_timeout=%s fallback_application_name=%s binary_parameters=yes
And mine query uses SQUIRREL lib to make queries like this:
//name of columns changes to them type in DB for this example (and Goland data type is same as in table)
And with database/sql was all the same, but end was:
And mine connection here:
I've searched around, but I can't find a reason why this is happening.
Maybe there is an additional setting needed somewhere in the connection, or the data needs to be processed differently in the call itself? It's confusing that all this works locally.
Please tell me, maybe you have some ideas on what to look for in my case?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions