You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by "adnanhamdussalam (via GitHub)" <gi...@apache.org> on 2026/02/03 06:47:35 UTC

[I] How to Get Partition Table DDL [cloudberry]

adnanhamdussalam opened a new issue, #1556:
URL: https://github.com/apache/cloudberry/issues/1556

   Hi,
   
   I can get the table DDL using below command but unable to see the create partition DDL in it.
   Need your support in this regard.
   
    pg_dump -d gpafiniti -t test.table1  --schema-only  > 123.sql
   
   OutPut:
   
   CREATE TABLE test.table1 (
       combinedbtn character varying(200) NOT NULL,
       startdate date NOT NULL,
      
   )
   PARTITION BY RANGE (startdate) DISTRIBUTED BY (combinedbtn);
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [I] How to Get Partition Table DDL [cloudberry]

Posted by "avamingli (via GitHub)" <gi...@apache.org>.
avamingli commented on issue #1556:
URL: https://github.com/apache/cloudberry/issues/1556#issuecomment-3985212591

   ```sql
   CREATE TABLE table1_2024 PARTITION OF table1
       FOR VALUES FROM ('2024-01-01') TO ('2025-01-01');
   ```
   create a child to verify.
   
   ```shell
   pg_dump -t table1 -t 'table1_*' --schema-only
   pg_dump: warning: unsupport am pax yet, current relation "t1" will be ignore
   
   --
   -- Name: table1; Type: TABLE; Schema: public; Owner: gpadmin
   --
   
   CREATE TABLE public.table1 (
       combinedbtn character varying(200) NOT NULL,
       startdate date NOT NULL
   )
   PARTITION BY RANGE (startdate) DISTRIBUTED BY (combinedbtn);
   
   
   ALTER TABLE public.table1 OWNER TO gpadmin;
   
   SET default_table_access_method = heap;
   
   --
   -- Name: table1_2024; Type: TABLE; Schema: public; Owner: gpadmin
   --
   
   CREATE TABLE public.table1_2024 (
       combinedbtn character varying(200) NOT NULL,
       startdate date NOT NULL
   ) DISTRIBUTED BY (combinedbtn);
   
   
   ALTER TABLE public.table1_2024 OWNER TO gpadmin;
   
   --
   -- Name: table1_2024; Type: TABLE ATTACH; Schema: public; Owner: gpadmin
   --
   
   ALTER TABLE ONLY public.table1 ATTACH PARTITION public.table1_2024 FOR VALUES FROM ('2024-01-01') TO ('2025-01-01');
   
   
   --
   -- Apache Cloudberry database dump complete
   --
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [I] How to Get Partition Table DDL [cloudberry]

Posted by "avamingli (via GitHub)" <gi...@apache.org>.
avamingli commented on issue #1556:
URL: https://github.com/apache/cloudberry/issues/1556#issuecomment-3985206334

   This is expected behavior in the current version. pg_dump -t matches only the exact table name — it does not automatically include child partitions. This is consistent with upstream PostgreSQL 14 behavior.
   As a workaround, explicitly include the child partitions:
   ```shell
   pg_dump -t table1 -t 'table1_*' --schema-only
   ```
   Note that PostgreSQL 17 introduced **--table-and-children** to address exactly this use case. This could be something worth backporting to Cloudberry.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [I] How to Get Partition Table DDL [cloudberry]

Posted by "avamingli (via GitHub)" <gi...@apache.org>.
avamingli commented on issue #1556:
URL: https://github.com/apache/cloudberry/issues/1556#issuecomment-3985236318

   > Note that PostgreSQL 17 introduced **--table-and-children** to address exactly this use case. This could be something worth backporting to Cloudberry.
   
   From PG16: https://www.postgresql.org/docs/16/app-pgdump.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org