public inbox for [email protected]  
help / color / mirror / Atom feed
From: Mauricio Fernandez <[email protected]>
To: Pgsql-admin <[email protected]>
Subject: Adding timestamp column
Date: Wed, 3 Sep 2025 11:50:57 -0400
Message-ID: <CAMdfv4XEHpa8XSYf1C5EG5CE_VbcpptxiijUNOzj3HEvwLOaxQ@mail.gmail.com> (raw)

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


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Adding timestamp column
  In-Reply-To: <CAMdfv4XEHpa8XSYf1C5EG5CE_VbcpptxiijUNOzj3HEvwLOaxQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox