Issue with AWS Aurora DB PostgreSQL Database Upgrade using pg_upgrade v13 to v14 or 15v

298 Views Asked by At

I'm encountering difficulties while trying to upgrade my Amazon Aurora PostgreSQL database from version 13 to version 15 using the pg_upgrade utility. The upgrade process is failing with an error, and I need assistance to resolve this issue.

Error Message: pg_restore: creating FUNCTION "public.rds_get_stat_connections_counters()" pg_restore: while PROCESSING TOC: pg_restore: from TOC entry 225; 1255 2922011 FUNCTION rds_get_stat_connections_counters() rdsadmin pg_restore: error: could not execute query: ERROR: could not find function "rds_get_stat_connections_counters" in file "/rdsdbbin/aurora-15.5.15.5.0.21262.0/lib/postgresql/rdsutils.so" Command was: CREATE FUNCTION "public"."rds_get_stat_connections_counters"(OUT "dbid" "oid", OUT "db_name" "text", OUT "rolid" "oid", OUT "role_name" "text", OUT "application_name" "text", OUT "ssl" "text", OUT "auth" "text", OUT "client_addr" "text", OUT "authorized" integer, OUT "not_authorized" integer, OUT "total_auth_failed" integer, OUT "bad_db_name" integer, OUT "bad_db_oid" integer, OUT "bad_db_perm" integer, OUT "bad_conn_packet" integer, OUT "startup_packet_timeout" integer, OUT "lastattempt" timestamp with time zone) RETURNS SETOF "record" LANGUAGE "c" STRICT AS '$libdir/rdsutils', 'rds_get_stat_connections_counters';

Steps Taken So Far: Ensured that I have taken a full backup of my database before initiating the upgrade. Verified the compatibility of extensions and custom functions with PostgreSQL version 15.

Your prompt attention and assistance are greatly appreciated.

AWS Aurora DB PostgreSQL Database Upgrade using pg_upgrade v13 to v14 or 15v

1

There are 1 best solutions below

0
user322889 On

I recently had this exact error while trying to upgrade an Aurora pgsql cluster. What this error seemed to indicate is a problem with a pg_stats extension version, but the extension in question is within the "rdsadmin" database. Since the "rdsadmin" database is unavailable to me, I couldn't update the extension, so I ended up opening a support case with AWS and they were able to perform the fix (and this also somewhat implies that there was no way for me to do it myself.)

My guess here is that this was a database that was migrated from just an RDS instance to an Aurora cluster, and the stat counter functions there are holdovers from when it was RDS. Performing the upgrade in Aurora doesn't handle the "rdsadmin" database as special (maybe) and therefore it tries to do something it can't and gets stuck.