pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: andrewbille@gmail.com
Subject: BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column
Date: Fri, 18 Sep 2020 04:58:14 +0000
Message-ID: <16622-779a79851b4e2491@postgresql.org> (raw)

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.



view thread (5+ messages)  latest in thread

Message-ID: <16622-779a79851b4e2491@postgresql.org>
Permalink:  ../16622-779a79851b4e2491@postgresql.org/
Also on:    postgresql.org/message-id/16622-779a79851b4e2491@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, andrewbille@gmail.com
  Subject: Re: BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column
  In-Reply-To: <16622-779a79851b4e2491@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox