Re: altering a column to to make it generated

2024-04-22 Thread Tom Lane
"David G. Johnston" writes: > On Mon, Apr 22, 2024 at 12:42 PM Celia McInnis > wrote: >> Can I alter a table column to now make it generated? I tried this >> unsuccessfully: > I looked at all of the "alter table ... alter column" commands listed here: >

Re: altering a column to to make it generated

2024-04-22 Thread Adrian Klaver
On 4/22/24 12:42, Celia McInnis wrote: Can I alter a table column to now make it generated? I tried this unsuccessfully: create temp table tmp1 as select 15::numeric(6,1) as distance,'24:30'::interval,0::numeric(7,3) as avgspd; alter table tmp1 alter column avgspd type numeric(7,3) generated

Re: altering a column to to make it generated

2024-04-22 Thread David G. Johnston
On Mon, Apr 22, 2024 at 12:42 PM Celia McInnis wrote: > Can I alter a table column to now make it generated? I tried this > unsuccessfully: > I looked at all of the "alter table ... alter column" commands listed here: https://www.postgresql.org/docs/current/sql-altertable.html And none seem

altering a column to to make it generated

2024-04-22 Thread Celia McInnis
Can I alter a table column to now make it generated? I tried this unsuccessfully: create temp table tmp1 as select 15::numeric(6,1) as distance,'24:30'::interval,0::numeric(7,3) as avgspd; alter table tmp1 alter column avgspd type numeric(7,3) generated always as ((3600.*distance)/EXTRACT (EPOCH