I would like to change type of column in PostgreSQL from date to timestamp with time zone. But execution of follow sql continues until I stop it despite there are only 3 records in the table and without any error or successful result.
alter table some_table
alter column column_date type timestamp
using to_timestamp(extract(epoch from column_date))
At the same time select to_timestamp(extract(epoch from column_date)) from some_table is executing correct without any error.
I've try another variations for using expression
using column_date::timestamptzusing timestamp with time zone 'epoch' + (column_date + interval '0 second') * interval '1 second'using column_date AT TIME ZONE 'UTC'with no effect.
If there are null value of the column in all records type changing immediately with simple alter sql
alter table some_table
alter column column_date type timestamp
using column_date::timestamp with time zone
I use PostgreSQL 12
Is there appropriate method to change date to timestamp with time zone?
P.S. I know I can do this task by creating a new column with appropriate type and then swap them:))