Converting Epoch Time values To Timestamps
Just a quick one. If you've ever created a table using the number of seconds since 1970 and realised, after populating it with data, that you really need it in a TIMESTAMP type? If so, you can quickly convert it using this SQL:
ALTER TABLE entries
ALTER COLUMN created TYPE TIMESTAMP WITH TIME ZONE
USING TIMESTAMP WITH TIME ZONE 'epoch' + created *interval '1 second';With thanks to the PostgreSQL manual for saving me hours working out how to do this.