'How to remove a partition key in Postgres

I have the following table in PostgreSQL:

CREATE TABLE foo (
   bar text NOT NULL
   ...
)
PARTITION BY LIST (bar);

How can the whole partition key be removed from the table? It is possible to remove a single partition table with DETACH PARTITION, but I can't find a way to drop the partitioning itself.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source