femibyte
femibyte

Reputation: 3507

Renaming postgres parent table with child partitions

is it ok to rename a parent table from which partitioned child tables are based ?

For example if I have

CREATE TABLE demos_qa (
demo_id int,
demo_date VARCHAR,
demo_text TEXT)
PARTITION BY RANGE (trxn_post_dt);

CREATE TABLE demos_2022 PARTITION OF demos_qa
FOR VALUES FROM ('2022-01-01') TO ('2023-01-01');

CREATE TABLE demos_2021 PARTITION OF demos_qa
FOR VALUES FROM ('2021-01-01') TO ('2022-01-01');

CREATE TABLE demos_2020 PARTITION OF demos_qa
FOR VALUES FROM ('2020-01-01') TO ('2021-01-01');

and I bulk load the partition tables.

I now want to rename the parent table from demo_qa to demo. Can I do that and will things work as normal without having to change the definitions of the partition tables ?

Upvotes: 0

Views: 1118

Answers (1)

user330315
user330315

Reputation:

Yes, this will work.

The partitions won't be renamed though, in case you expected that.

Upvotes: 1

Related Questions