Insert into varchar column

I'm not able to insert record into Vertica table using Pentaho DI because of length of varchar column. For example, I have column varchar(32), if the length of data is also 32, the insert will fail. If I increase the length of column definition, then it works. Any idea what problem is it? Thanks


  • Hi Mike, Hm... You say that your data is of length "32". What units? Bytes? Characters? A VARCHAR(32) is a 32-byte field. If your data is 32 bytes, then it will fit. However, if it is 32 characters but it contains multibyte characters, it won't fit. UTF-8 characters can be up to 4 bytes long. So a 32-character field will be a VARCHAR(128). Adam
  • Right, I have 32 characters. Thanks!!!
  • Here is my 32-character string, 7a115ed1b708a8783fafc922fdff66ce. Is it 32 bytes?
  • Those are all single-byte characters. So, yes, it's 32 bytes. (Assuming that you are in fact inserting them as either ASCII or UTF-8 characters.) I am able to insert that string without trouble into a VARCHAR(32). If you're having trouble, make sure that you've trimmed all whitespace on either side, that the string is in fact being sent as a UTF-8 or ASCII string, etc. I suspect that the statement that is being issued is not quite what you intended.
  • (Basic ASCII is a strict subset of UTF-8. So if you look up the ASCII character set online, all ASCII characters are "one character == one byte". ASCII includes the standard English A-Za-z0-9 characters and some common punctuation; if you use those, you're safe. But typically not characters from other languages.)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file