Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryzYY-001Qsn-IG for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 19:42:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ryzYX-00EG74-42 for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 19:42:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryzYW-00EFzs-OW for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 19:42:24 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ryzYU-0048VZ-Cf for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 19:42:23 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d872102372so44310601fa.0 for ; Mon, 22 Apr 2024 12:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713814940; x=1714419740; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=vc+jKqgWDpQbD8GB1lYtady5ulLzvvVFdLjRy2D+2pQ=; b=SsnWCeUH1DxxNWHIpdNxU81ntNbuHbGlWxc79n0ZYTUoSMAywChGq/3OwTgrFv3cYd py9uhME3c6ww6wba/5gP4DwWyXmiZqqAQPK+gHqBP3IoGAN7THQs8vC5x+g9tomijG3Y fWoxX+HLKOXgoCYcbwurf2kWS5FIchEbqqLUOHLgkDJEsK060C9gOVexGkfGw6AlfjUZ XfkU2+yoH7UVZf+8XuGh90OCLZUOgXud3Bio4TVVLPOpvZdBgcNE7XA8sY9DKpbcBuHG okHubGnzj/YqH4YqrJu7nIPQ3YL8ieRbrT0tL4Da0wSwVoCysBqKNGd8GBUDQrpCNkmy KhAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713814940; x=1714419740; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vc+jKqgWDpQbD8GB1lYtady5ulLzvvVFdLjRy2D+2pQ=; b=P8Ylv/y41ik+oAXOqFbffiiGK0D1xWhHWOciansKmXoMhRiXtJdR0qgbQUrO8SlkQ+ CK181o7bDOAvoEcwBQHDxerPZ5bwVr5iGkI8hg8O5+mXW5wX5ecYfmgCBHt2jkKa4NYS WzLGvlM41Wrd3djLv2HpYSPR5EVwslhcEJPRr9ut7w0hEkO3nbR4Skb5LELufL7ZmfNi jLpHOCuWMEorbHeX1OHN2c+kJjiYfeHD4GJ4pncoRkZkBdfxtZsNguEopHgWoe3CXWYu /X+FI8v3aXscAhKanqxe3qti5BXf2/RdP7NLrXCF82Np+ZrKFb7mbCgrBJHqblPE/13M Vw+g== X-Gm-Message-State: AOJu0YxGtYwsIUUfloc5FyKFp95LqCHYOh7/8B3Iz4A5eDEFWhnh2cqB rjg/T4y+NvZYyPsWxnhvgJguS0v1sRBK8UWn3VzuET93EgLF05M33oi84WQ8Svv0Ky8ne68D2oX OgLNItnXJcXZkmSE2NiQ+110fX+IlOCnV X-Google-Smtp-Source: AGHT+IErF8Cif99bEnuuIEqzTQNY/lTHuNh/coNfCJu8vUBc3zgLBLzgjgTPiVoglUTjjU61w0CL47KOjCLFtxNRNUU= X-Received: by 2002:a19:ca01:0:b0:51a:f2eb:19fa with SMTP id a1-20020a19ca01000000b0051af2eb19famr216166lfg.1.1713814940336; Mon, 22 Apr 2024 12:42:20 -0700 (PDT) MIME-Version: 1.0 From: Celia McInnis Date: Mon, 22 Apr 2024 15:42:09 -0400 Message-ID: Subject: altering a column to to make it generated To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000bacc300616b4a207" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000bacc300616b4a207 Content-Type: text/plain; charset="UTF-8" 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 FROM rdrtime::interval)) STORED; ERROR: syntax error at or near "generated" LINE 1: ... table tmp1 alter column avgspd type numeric(7,3) generated ... I think that at least I have the right bracketing this time! :-) ^ --000000000000bacc300616b4a207 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Can I alter a table column to now make it generated? = I tried this unsuccessfully:

create temp table tmp= 1 as select 15::numeric(6,1) as distance,'24:30'::interval,0::numer= ic(7,3) as avgspd;
alter table tmp1 alter column avgspd type nume= ric(7,3) generated always as ((3600.*distance)/EXTRACT (EPOCH FROM rdrtime:= :interval)) STORED;
ERROR: =C2=A0syntax error at or near "generated= "
LINE 1: ... table tmp1 alter column avgspd type numeric(7,3) gene= rated ...

I think that at least I have the right b= racketing this time! :-)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 ^




--000000000000bacc300616b4a207--