I am trying to add a new column to a table that has a data type of int using another column in the table as the default value. That column in a varchar. Vertica won;t let me do this Is this a bug?
Code: Select all
dbadmin=> create table size (pk varchar(10));
CREATE TABLE
dbadmin=> insert into size values (1);
OUTPUT
--------
1
(1 row)
dbadmin=> alter table size add column pk2 int default pk;
ROLLBACK 2632: Column "pk2" is of type int but the default expression is of type varchar
HINT: You will need to rewrite or cast the expression
dbadmin=> alter table size add column pk2 int default pk::varchar;
ROLLBACK 2632: Column "pk2" is of type int but the default expression is of type varchar
HINT: You will need to rewrite or cast the expression
dbadmin=> alter table size add column pk2 int default to_char(pk);
ROLLBACK 2632: Column "pk2" is of type int but the default expression is of type varchar
HINT: You will need to rewrite or cast the expression