Hi hackers, I ran into this while extending the patch in [1] to plain inheritance, as Zsolt suggested.
CREATE TABLE ... (LIKE ...) INHERITS adds the copied defaults and generation expressions after the table is created. That path skips the checks the explicit syntax gets. In the worst case a stored generated column is never computed: create table p (a int, b int generated always as (a * 10) stored); create table s (b int, v int generated always as (b * 2) stored); create table c (like s including generated) inherits (p); insert into c (a) values (1); select * from c; a | b | v ---+----+--- 1 | 10 | (1 row) The patch does the same checks as the explicit syntax. When the copied expression replaces an inherited one, it first drops the internal dependency like SET EXPRESSION does. The tests are in a separate patch. [1] https://postgr.es/m/[email protected]
