Skip to content

Conversation

belo4ya
Copy link
Contributor

@belo4ya belo4ya commented Sep 11, 2025

Problem

While trying to install pg_partman with CREATE EXTENSION pg_partman CASCADE in a database where the plpgsql extension had been dropped, I encountered the following error:

failed to create 'pg_partman' extension: pq: language "plpgsql" does not exist

PostgreSQL documentation states that PL/pgSQL is installed by default in every database. However, users can still remove it via DROP EXTENSION plpgsql. In that case, installing pg_partman fails because the dependency is not declared.

It is also worth noting that other extensions commonly declare plpgsql in their requires field (see examples on GitHub).

Fix

This PR adds

requires = 'plpgsql'

to pg_partman.control, ensuring that plpgsql is automatically installed when creating pg_partman.

pg_partman uses PL/pgSQL functions but did not declare it as a required
extension. Adding `requires = 'plpgsql'` ensures CREATE EXTENSION works
even if plpgsql was dropped.

Signed-off-by: belo4ya <41exey.kov41ev@gmail.com>
@keithf4 keithf4 self-requested a review September 23, 2025 14:04
@keithf4 keithf4 self-assigned this Sep 23, 2025
@keithf4 keithf4 added this to the 5.3 milestone Sep 23, 2025
@keithf4 keithf4 merged commit a7d4590 into pgpartman:development Sep 23, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants