Class ColumnLengthException

All Implemented Interfaces:
Serializable

public final class ColumnLengthException extends RuntimeException
A value too long for its VARCHAR(n) column, rejected on the write path.

It exists because Snowflake words this ONE violation two different ways depending on which path hit it, and the check itself is shared. Live-verified on a real account, the same over-long value against the same VARCHAR(3) column:

  • DML — INSERT, INSERT … SELECT, UPDATE and MERGE all reported String 'abcdefgh' is too long and would be truncated, which is what Throwable.getMessage() returns;
  • COPY — the per-file result's first_error reported User character length limit (3) exceeded by string 'abcdefgh' instead.
So the parts are carried rather than the sentence: the COPY layer renders its own wording from getLimit() and getValue() while every DML caller reads the message as-is. Two other write violations were probed the same way and turned out NOT to differ — a NOT NULL breach is NULL result in a non-nullable column and a bad numeric is Numeric value 'BADX' is not recognized on both paths — so only this one needs splitting.

The DML wording is the one the plain message carries because Snowflake nests it in a per-statement envelope (DML operation to table E1 failed on column NAME with error: …) that names the table and column separately. Frostlake does not build that envelope, which is a distinct gap from this one.

See Also:
  • Constructor Details

    • ColumnLengthException

      public ColumnLengthException(int limit, String value)
  • Method Details

    • forBinary

      public static ColumnLengthException forBinary(int limit, String hex)
      The same violation for a BINARY column, which live words by the family: Binary value '0AFF' is too long and would be truncated, the bytes spelled as upper-case hex whatever they were written as.
      Parameters:
      limit - the column's declared width in bytes
      hex - the offending value as upper-case hex
      Returns:
      the exception the DML envelope then wraps
    • getLimit

      public int getLimit()
      The column's declared maximum length.
    • getValue

      public String getValue()
      The offending value, in full — Snowflake quotes the whole string, not a truncation of it.