trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.18k stars 2.93k forks source link

Warn when CAST of varchar(x) -> varchar(y) results in truncation #3

Open martint opened 5 years ago

martint commented 5 years ago

Per the spec (6.13 General Rules 11.c):

11) If TD is variable-length character string or large object character string, then let MLTD
be the maximum length in characters of TD.

c) If SD is fixed-length character string, variable-length character string,
or large object character string, then

ii) If the length in characters of SV is larger than LTD, then TV is the first LTD characters
of SV.  If any of the remaining characters of SV are non-<space> characters,
then a completion condition is raised: warning — string data, right truncation.
findepi commented 4 years ago

Requires https://github.com/prestosql/presto/issues/1140