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: dafoer_x@163.com
Subject: BUG #17836: Why does pg_dump need to add * to dump the full partition table structure
Date: Mon, 13 Mar 2023 07:44:48 +0000
Message-ID: <17836-b247028bebff8821@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17836
Logged by:          Why does pg_dump need to add * to dump the full partition table structure
Email address:      dafoer_x@163.com
PostgreSQL version: 15.0
Operating system:   centos_x86
Description:        

Why does pg_dump need to add * to dump the full partition table structure

Use case:
1. Create a partition table
create table t_native_range (f1 bigint,f2 timestamp default now(), f3 text)
partition by range ( f2 );   
create table t_native_range_201901 partition of t_native_range for values
from ('2019-01-01') to ('2019-02-01');
create table t_native_range_201902 partition of t_native_range for values
from ('2019-02-01') to ('2019-03-01');
create table t_native_range_201903 partition of t_native_range for values
from ('2019-03-01') to ('2019-04-01');
CREATE INDEX t_native_range_f1_idx ON t_native_range (f1);
CREATE INDEX t_native_range_f3_idx ON t_native_range (f3);

2.pg_dump dump the partition table structure
pg_dump -d postgres -p 29822 -h 127.0.0.1  -t t_native_range -s

3.There is only the parent table information, so why not also export the
child partition information
--
-- Name: t_native_range; Type: TABLE; Schema: public; Owner: pg14
--
CREATE TABLE public.t_native_range (
    f1 bigint,
    f2 timestamp without time zone DEFAULT now(),
    f3 text
)
PARTITION BY RANGE (f2);
ALTER TABLE public.t_native_range OWNER TO pg14;
--
-- Name: t_native_range_f1_idx; Type: INDEX; Schema: public; Owner: pg14
--
CREATE INDEX t_native_range_f1_idx ON ONLY public.t_native_range USING btree
(f1);
--
-- Name: t_native_range_f3_idx; Type: INDEX; Schema: public; Owner: pg14
--
CREATE INDEX t_native_range_f3_idx ON ONLY public.t_native_range USING btree
(f3);



Message-ID: <17836-b247028bebff8821@postgresql.org>
Permalink:  ../17836-b247028bebff8821@postgresql.org/
Also on:    postgresql.org/message-id/17836-b247028bebff8821@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, dafoer_x@163.com
  Subject: Re: BUG #17836: Why does pg_dump need to add * to dump the full partition table structure
  In-Reply-To: <17836-b247028bebff8821@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