Search Postgresql Archives

adding a generated column to a table?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I have a table containing a date field, say:
create temporary table tmp1 as select now()::date as evtdate;
SELECT 1

select DATE_PART('year', evtdate)::integer as year from tmp1;
 year
------
 2024
(1 row)

Is there some way of doing something like the following?:

alter table tmp1 add column year integer generated always as DATE_PART('year', evtdate)::integer STORED;
ERROR:  syntax error at or near "DATE_PART"
LINE 1: ... tmp1 add column year integer generated always as DATE_PART(...
                                                            

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux