mysqlperldbitruncated

How can I see if MySQL truncated a field during an Update using Perl DBI


When I run this Update SQL in DBVis, I get an error (Data truncation: Data too long for column 'Description' at row 1).

However, in Perl (DBI), this is not giving me an error I am guessing because the record actually was updated with the truncated value.

Can anyone tell me how to show this error?


Solution

  • As data truncations produce warnings you can use SHOW WARNINGS to see them. And you can promote warnings to fatal errors by setting server's SQL Mode to one that forbids truncations (e.g. TRADITIONAL).