I have a table in Postgres that has a date column and time column. I would like to add a new column that has utc (or timestamp) values based on on the date and time columns.
I tried the following:
INSERT INTO mytable (utc) SELECT EXTRACT(EPOCH FROM (date || ' ' || time )::timestamp);
But I get the error:
ERROR: column "date" does not exist
SQL state: 42703
Hint: There is a column named "date" in table "mytable", but it cannot be referenced from this part of the query.
And there definitely are the columns date and time.
Does anyone know how to add values to UTC column based on date and time columns?
For example: 09/21/2012 12:56:00 should become something like 411730.830555
I'm trying to do something similar to this question (I think).