Closed jackdeguest closed 1 year ago
country => PG_CHAR,
This will cause the bind parameter to have the type character
, which truncates the input to just one character.
This will cause the bind parameter to have the type
character
, which truncates the input to just one character.
I had tried it with PG_VARCHAR
or PG_TEXT
, but it still yielded the same result. However, I just did it now, and it worked with PG_VARCHAR
and not with PG_CHAR
.
Maybe it ought to be documented somewhere that the data type PG_CHAR
equates to just one character and if the data is greater it would get truncated.
Open to adding something, but not sure where to put it; ideas welcome.
Okay, added a little blurb in commit b074817ab3d6a74f2e21c5c3cba11eb356793da8
I am performing an upsert using PostgreSQL v12.11 with DBD::Pg version
3.16.0
and DBI version1.643
, i.e. the latest as of today 2022-11-03. I am getting a PostgreSQL error the value violates a contraint because it isJ
where it should beJP
(this is a country code). When I perform the query directly withpsql
no problem and the row is successfully inserted or updated. However, if I do it using DBI and DBD::Pg, I get this error:The PostgreSQL server shows the same message, and if I do a trace, such as:
I get:
The perl code used is:
The SQL table is:
I have run out of ideas on how to solve this riddle, and would very much appreciate a workaround to this apparent bug.