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 1ryzqk-001S9b-CQ for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 20:01:14 +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 1ryzqj-00Er17-0e for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 20:01:13 +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 1ryzqi-00Er0k-1l for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 20:01:12 +0000 Received: from fhigh4-smtp.messagingengine.com ([103.168.172.155]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryzqe-0048cz-5J for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 20:01:10 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id C70091140181; Mon, 22 Apr 2024 16:01:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 22 Apr 2024 16:01:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1713816066; x=1713902466; bh=dWqI3vU7OxPAq0E7/9F5izGBttI2ZptpNwseeiYc/7k=; b= SMyIqvcr2yvd6ba1DQkJkBX0IIyXogSuiZwm1fROXMiiFnnF8yxLbBTVuYdgUT8E kQeHDVC43Vu3AzWUwjYRP6PulRVGpwdAAM8N8+kRd7a7zpAhDYevCqhl7ZZvmFgY 0KaUcY7pGbuMXLZM6UlmJgW8taK5cH+0qKxMCmCMm3fb1CeBHkUpYailK6hxzh+W QFvBk57GY9ErSZZsgwiVVRiEhYspnE03ofprOUtCTxsjBvZdI68krZXCYctbi96g psXPcvW94MER8KgssIZby3nzHVAs2VvdOQfPrcBonf7Q/2en71nd+BHFqvrbFXM2 u6DKf+Kc7PUCXoP9zVlScQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1713816066; x= 1713902466; bh=dWqI3vU7OxPAq0E7/9F5izGBttI2ZptpNwseeiYc/7k=; b=d KAhoKY/FLctvf7z7VWE03cKzip/Nx4raKqRhbmSP8Y4pLKjM8howgtBYjJrjZamW C4j6E0fECpd3heinVF3MGe5bNvMNfafBs0jlc3RDrNan8QVibzl57i9VT63qCn2k eji8/6Bn/3euyNPShExqCyq8x2YeJBs5PTXdUQXv5RcSyVkx2XOT7xiXcRLgcrmu 5PICEh1kbSXXrDu+ec1cPkXWmhGEErJHZR2YKaPmj2X6LyECBU4aEJPGLGKdSWM4 533jxV5L4DwmCDmwplBnhjYUJgFFyCsqMNSVeLok3OopeZhb7na/ixDFm+Jyt+qR VH5ZQBSq0NPLmzgeD/XZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudekledgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepffelgeeifefgveduhedthfekuedtffejveegffeg jeevtdehgfduieetfeehjeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Apr 2024 16:01:05 -0400 (EDT) Message-ID: Date: Mon, 22 Apr 2024 13:01:04 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: altering a column to to make it generated To: Celia McInnis , "pgsql-generallists.postgresql.org" References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 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! :-) See David Johnston's comment. I keep on wanting to believe that ALTER TABLE supports GENERATED expressions, when it only supports GENERATED IDENTITY:) > > > > > -- Adrian Klaver adrian.klaver@aklaver.com