ALTER TABLE messages ADD COLUMN txt TEXT; ALTER TABLE messages ADD COLUMN repliesby TEXT; ALTER TABLE messages ADD COLUMN updated_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP; ALTER TABLE replies ALTER updated_at TYPE timestamptz USING updated_at AT TIME ZONE 'UTC'; UPDATE messages SET txt=m.txt, repliesby=m.repliesby, updated_at=m.updated_at FROM (SELECT message_id id, txt, repliesby, updated_at AT TIME ZONE 'UTC' updated_at FROM messages_txt) m WHERE message_id=m.id