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 1tl7d6-009TAZ-2G for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2025 14:34:20 +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 1tl7d4-007eRc-JC for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2025 14:34:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tl7d4-007eRT-8m for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2025 14:34:18 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tl7d2-001yUL-0c for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2025 14:34:18 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-7272dae0604so514710a34.1 for ; Thu, 20 Feb 2025 06:34:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740062054; x=1740666854; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7to75JhKnhHWELlLXqHWGRe0kHsbecLjVnoKX6HArFU=; b=GtlsTivjr+PgSFl4sdWxpG6Ph5KSRX60SBQHHnRyuD/2wozfKJkMAMSXhLp2AJYO+9 PEMagdKZFTQGTWwh3SIZnP6Sg+D1GOxYu2zT4UrkxsvOG5DoLiblp8wCKBwEr+4wqD8/ O4qynOj+ohr8V4yHgrLOkItLFot0dTjMZqW69EKgYStwhaJ9PIkzth0a0nJ/qXeBS21S 5QQ6y03u8HElGJun/Xw7aNpjlrFn2XsL23dL6a4qsNm4su43TIkZ8ttVgf/7Ey56Jjyq JOKWJc/Dy7e36zVwbpEO7xApN91yapwunj/E4zClLwHA3iHnrLJWGFL5UcuddZBml18y XWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740062054; x=1740666854; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7to75JhKnhHWELlLXqHWGRe0kHsbecLjVnoKX6HArFU=; b=H2JLrSNY+IkTxmrOX168RvhPXBcodEusCAqtSxgM9MwloNFKKdIHsj86ATr0yyk+sM q/QIFaW1M6bNFXh6C8n08XbN3N5lhG7/GSTsM6rqpp9UHXtxmf6Jcn0hgOKzB6F5sPIM EELLGDZa+5KMkPAvVCy1YsDr4y10O79Xwzl0ylKzEpkR2QX43kXzq2L3zcMtTQTh/mJw Or46vvFBT3ubNoih3B+qwFFsaFYyszDAepkCA4nqHARoFEZaT01FIGmjhVlMaW8D4iaF 71jdY+bseYi6zygMVVq3EjrZfW9nCgGqBOho3dkzCp8UDdTf+mJYGCByGpH6J5sdAct0 4+ZA== X-Gm-Message-State: AOJu0YwDkJOgXIn3YSCSXdOR7agneylrAw+6DN36aMN3sM5PWLXWuA6I /sukq43e9FIBeXnkP1E37AQaF3KjRuBZOemFDr0Ts646M7PJ8boOH7VLWOX0MF+GOs6qJQ3dx6S HCdZNBEcsAo3O4oxNxiv/4PH5t78= X-Gm-Gg: ASbGncsSC47/SbJGILqCogAiVw2n+GN9RPfjZG4KS3fzHE7pgBjDhfa1vGoY8nlEicE ZbWn+pEzAWTjUjDlxs2uHTKdTN+kYDFz/D+/U0ued0mgqoi9cnVyLBbAcCUqrG1TIIahoCs19Pb c= X-Google-Smtp-Source: AGHT+IFW94vKPgZf1gPqmoBiCaSaMzcxRWoap84+0lmhBoFFLL1iQ29wjmUk0VtdArk/8BQSW+lIsvhFTu5xwf4OhK8= X-Received: by 2002:a05:6830:4104:b0:727:2cbb:9be6 with SMTP id 46e09a7af769-7272cbb9d2amr10603134a34.5.1740062053200; Thu, 20 Feb 2025 06:34:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dominique Devienne Date: Thu, 20 Feb 2025 15:33:57 +0100 X-Gm-Features: AWEUYZlWEOqewOkEwScqsTDe1IMfGJyJiBvoZ9IUuFTsE4r8b_vrHFRx0Kcl53M Message-ID: Subject: Re: v18 virtual columns To: Ron Johnson Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000917b45062e93c464" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000917b45062e93c464 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 20, 2025 at 3:31=E2=80=AFPM Ron Johnson wrote: > On Thu, Feb 20, 2025 at 8:07=E2=80=AFAM Dominique Devienne > wrote: > >> Hi. I've just read >> https://www.dbi-services.com/blog/postgresql-18-virtual-generated-column= s/ >> >> and I'm wondering whether there will be a way to ALTER existing STORED >> generated columns, to be virtual? W/o rewriting the whole table that is. >> > > What about dropping the existing stored column then adding the new virtua= l > column? > > You won't get any disk space saving for existing records, but it's not > going to rewrite the table. > Didn't think of that, but yes, I think that would work. They are GENERATED columns, so the values stored are derived data anyway, indeed. I also didn't know DROP COLUMN was smart enough not rewriting the column, that's good. Thanks, --DD --000000000000917b45062e93c464 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 20, 2025 at 3:31=E2=80=AFPM R= on Johnson <ronljohnsonjr@gma= il.com> wrote:
On Thu, Feb 20, 2025 at 8:07=E2=80=AFAM Dominique Devienne <ddevienne@gmail.com<= /a>> wrote:
Hi. I've just read=C2=A0https://www.dbi-services.com/blog/postgresql-18-virt= ual-generated-columns/

and I'm wondering whether= there will be a way to ALTER existing STORED generated columns, to be virt= ual? W/o rewriting the whole table that is.
What about dropping the existing stored column then adding the= new virtual column?

You won't get any disk sp= ace saving for existing records, but it's not going to rewrite the tabl= e.

Didn't think of th= at, but yes, I think that would work.
They are GENERATED columns,= so the values stored are derived data anyway, indeed.

=
I also didn't know DROP COLUMN was smart enough not rewriting the = column, that's good.

Thanks, --DD
<= /div> --000000000000917b45062e93c464--