Changing Column Types in External Tables
Data from external tables is not stored in Vertica, so Vertica cannot validate any changes that you make in column data types. Vertica checks external table definitions only when it tries to read table data. If external column data is incompatible with the data type that is declared in the Vertica table, Vertica returns an error.
For example:
=> CREATE EXTERNAL TABLE t (a char(10), b binary(20)) AS COPY FROM '...'; => ALTER TABLE t ALTER COLUMN a SET DATA TYPE long varchar(1000000); ALTER TABLE => ALTER TABLE t ALTER COLUMN b SET DATA TYPE long varbinary(1000000); ALTER TABLE
If you convert a column to a size that is too small for the data, Vertica truncates the data during the read. For example, if you convert a column from varchar(25)
to varchar(10
) and the column holds a 20-character string, Vertica reads the first ten and logs a truncation event.