Trying to update a column with varchar
datatype e.g. '1950-08-14' to a date
datatype using
UPDATE tablename SET columnname = to_date(columnname, 'YYYY-MM-DD');
or
ALTER TABLE tablename ALTER COLUMN columnname TYPE DATE USING to_date(columnname, 'YYYY-MM-DD');
but both return the error message
ERROR: invalid value "columnname" for "YYYY"
DETAIL: Value must be an integer.
Referencing http://www.postgresql.org/docs/9.4/static/functions-formatting.html