Adding timestamp column

From: Mauricio Fernandez <mmauricio(dot)fernandez(at)gmail(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Adding timestamp column
Date: 2025-09-03 15:50:57
Message-ID: CAMdfv4XEHpa8XSYf1C5EG5CE_VbcpptxiijUNOzj3HEvwLOaxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi admins, greetings.

I'm trying to add a timestamp column in an existent table.

This query works fine:

select timecreated, timezone('America/Santiago'::text,
to_timestamp(timecreated::double precision)) datecreated
from MDL_LOGSTORE_STANDARD_LOG;

But, when I want to alter the table I get a syntax error

alter table MDL_LOGSTORE_STANDARD_LOG
add column datecreated timestamp
generated always as ( timezone ('America/Santiago'::text,
to_timestamp(timecreated::double precision)));

SQL Error [42601]: ERROR: syntax error at end of input
Position: 185

I would appreciate some tips

Thanks in advanced

kind regards

Mauricio Fernández

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2025-09-03 16:09:07 Re: Adding timestamp column
Previous Message Laurenz Albe 2025-09-01 07:52:26 Re: Query Spins