From: Nagaraj Raj <nagaraj.sf@yahoo.com>
To: Naveen Kumar <naveenmcp@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: How to add partitions to the existing table in PostgreSQL
Date: Tue, 6 Oct 2020 07:50:02 +0000 (UTC)
Message-ID: <244012893.2409051.1601970602436@mail.yahoo.com> (raw)
In-Reply-To: <CAN+uLsHX4mQq3m5Ev8szQQwU4gxijMMoO8XDAubm0GdmEKEdsg@mail.gmail.com>
References: <CAN+uLsHX4mQq3m5Ev8szQQwU4gxijMMoO8XDAubm0GdmEKEdsg@mail.gmail.com>
There is no way to add a partition to an existing table. All you need to do create a new table with the partition on the desired column and copy data from old to new then do alter table name.
Thanks,Rj
On Monday, October 5, 2020, 11:31:28 PM PDT, Naveen Kumar <naveenmcp@gmail.com> wrote:
How to add partitions to the existing table in PostgreSQL
for ex, below is my table definition:
CREATE TABLE ot.employee
(
empno smallint NOT NULL,
ename character varying(20),
job character varying(20),
deptno smallint
)
Now I would like to add partition to deptno column
I don't see any alter table command to add the partition to the existing table.
Please help me on this.
Thank youNaveen
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-admin@postgresql.org
Cc: nagaraj.sf@yahoo.com, naveenmcp@gmail.com
Subject: Re: How to add partitions to the existing table in PostgreSQL
In-Reply-To: <244012893.2409051.1601970602436@mail.yahoo.com>
* 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