Re: CREATE TABLE LIKE with INHERITS skips checks on generated columns

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Peter Eisentraut <peter(at)eisentraut(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: CREATE TABLE LIKE with INHERITS skips checks on generated columns
Date: 2026-11-17 19:36:42
Message-ID: CAN4CZFOQdMw=0B7vCyrijbDTHwui+DEuPN+07XzXhPE1RPJG0Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

Thanks for finding this, I missed this case during the review.

create table p5 (a int, b int generated always as (a * 2) virtual);
create table s5 (a int, b int generated always as (a * 3) virtual);
create table e5 (a int, b int generated always as (a * 3) virtual)
inherits (p5); -- fails with the patch in the other thread
create table c5 (like s5 including generated) inherits (p5); -- fails
on master (but only with an elog), works with the patch

I think c5 should keep failing, but most likely with a proper ereport?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-11-17 19:36:43 Re: Expanding HOT updates for expression and partial indexes
Previous Message Zsolt Parragi 2026-11-17 19:26:56 Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned