| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Cc: | andrewbille(at)gmail(dot)com | 
| Subject: | BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column | 
| Date: | 2020-09-18 04:58:14 | 
| Message-ID: | 16622-779a79851b4e2491@postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged on the website:
Bug reference:      16622
Logged by:          Andrew Bille
Email address:      andrewbille(at)gmail(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PG Bug reporting form | 2020-09-18 05:55:34 | BUG #16623: JSON select query result is getting differed when we change DB version | 
| Previous Message | Tomasz Szypowski | 2020-09-17 20:12:20 | MinGW compilation |