I am having trouble changing a column called end_date
in a table called key_request
from time with time zone to timestamp
in my Postgres database . I have tried using the following code:
alter table key_request alter column end_date type timestamp with time zone using end_date::timestamp with time zone
I keep getting the following error:
ERROR: cannot cast type time with time zone to timestamp with time zone
Any idea of how I can adjust this query to work?
you can do something like this:
alter table key_request
alter column end_date type timestamp with time zone using date('20130101') + end_date;
sql fiddle demo
I woul do this in a series of steps
end_date1
as time with time zone
end_date
(old) to end_date1
end_date
columnend_date1
to end_date
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With