Search code examples
postgresqlrenamepartition

PostgreSQL: rename an unnamed partition?


I created a table with monthly partitions, however I made a mistake with the initial partition.

When I browse the partitions in Data Grip it first one shows up as unnamed (see image)

Partition list from Data Grip

However, when selecting the partition tables there is tabled for this partition, named abc_1_prt_2. All the other partitions' tables are named something like abc_1_prt_p202208

Is it possible to rename the unnamed partition?

When I right-click on partition in Data Grip and select Rename, Data Grip provides the following script:

alter table sam_tap.fct_tap_metadata rename partition "" to "'p201809'";

which gives the following error:

[42601] ERROR: zero-length delimited identifier at or near """"


Solution

  • Just FYI, in the end I dropped the table and recreated it with the correct partition name (and populated the data from a back-up).

    I was not able to re-name the unnamed partition.