The following bug has been logged on the website:
Bug reference: 16622
Logged by: Andrew Bille
Email address: andrewbille@gmail.com
PostgreSQL version: 12.4
Operating system: Ubuntu-20.04
Description:
When I perform dump/reload with the following inherited table:
CREATE TABLE public.gtest1 (
a integer NOT NULL,
b integer GENERATED ALWAYS AS ((a * 2)) STORED
);
CREATE TABLE public.gtest1_1 (
)
INHERITS (public.gtest1);
I get the error:
pg_dump postgres > dump.sql
createdb test
psql test -q -v ON_ERROR_STOP=1 -f dump.sql
psql:dump.sql:50: ERROR: column "b" of relation "gtest1_1" is a generated
column
in dump.sql i see
...
--
-- Name: gtest1; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.gtest1 (
a integer NOT NULL,
b integer GENERATED ALWAYS AS ((a * 2)) STORED
);
ALTER TABLE public.gtest1 OWNER TO postgres;
--
-- Name: gtest1_1; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.gtest1_1 (
)
INHERITS (public.gtest1);
ALTER TABLE public.gtest1_1 OWNER TO postgres;
--
-- Name: gtest1_1 b; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.gtest1_1 ALTER COLUMN b SET DEFAULT (a * 2);
...
Reproduced on 13rc1 too.