Resolving pg_catalog plpython errors during gpupgrade 2.0
search cancel

Resolving pg_catalog plpython errors during gpupgrade 2.0

book

Article ID: 442154

calendar_today

Updated On:

Products

VMware Tanzu Data VMware Tanzu Data Intelligence VMware Tanzu Data Services Solutions VMware Tanzu Data Suite VMware Tanzu Data Suite VMware Tanzu Data Services Pack VMware Tanzu Greenplum VMware Tanzu Greenplum / Gemfire

Issue/Introduction

When performing an upgrade from Greenplum Database (GPDB) 6 to GPDB 7 using gpupgrade 2.0, the initialize stage may fail with errors related to plpython functions residing in the pg_catalog schema. The functions_in_pg_catalog.txt file generated by the utility lists objects such as:

  • pg_catalog.plpython_call_handler()
  • pg_catalog.plpython_inline_handler(internal)
  • pg_catalog.plpython_validator(oid)

Customers may be concerned that dropping these system-level objects will break Python functionality in the target GPDB 7 environment.

Environment

  • Source: Greenplum Database 6.x
  • Target: Greenplum Database 7.x
  • OS: RHEL 9.x (or compatible)
  • Tool: gpupgrade 2.0

Cause

These functions are legacy Python 2 (plpythonu) background metadata drivers. They are flagged during the upgrade initialization because of a metadata inconsistency from prior database upgrades that incorrectly identifies these internal drivers as "user objects."

Greenplum 7 has completely removed support for Python 2. These functions are obsolete and do not exist in GPDB 7; therefore, they cannot be migrated and must be removed to satisfy the upgrade validation checks.

Resolution

Dropping these legacy functions is safe and will not impact Python functionality in Greenplum 7, as GPDB 7 utilizes a new set of system objects specifically for Python 3 (plpython3u).

Step 1: Verify Production Impact

Ensure there are no actual business functions dependent on Python 2. If gpupgrade does not generate a file named plpython2_dependent_functions.txt, or if that file is empty, no production code is at risk.

Step 2: Remove Obsolete Extension

In the Greenplum 6 source cluster, drop the legacy Python extension. This will remove the orphaned pg_catalog objects:

DROP EXTENSION IF EXISTS plpythonu CASCADE;

Step 3: Resume Upgrade

Rerun the gpupgrade initialize command. The validation check for pg_catalog functions should now pass.

Step 4: Post-Upgrade Configuration

After successfully upgrading to Greenplum 7, install the new Python 3 environment drivers:

CREATE EXTENSION plpython3u;

Step 5: Validate UDFs

Test your custom Python functions to ensure compatibility with Python 3.11, as there may be syntax or library differences between GPDB 6 (Python 3.9) and GPDB 7 (Python 3.11).

References