BUG #18115: pg_restore of extensions does not respect dependencies

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: vasilgiann(at)gmail(dot)com
Subject: BUG #18115: pg_restore of extensions does not respect dependencies
Date: 2023-09-18 10:14:35
Message-ID: 18115-e1bb51d5c161484e@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18115
Logged by: Vasileios Giannakidis
Email address: vasilgiann(at)gmail(dot)com
PostgreSQL version: 14.7
Operating system: Red Hat 7.3.1-6 64-bit
Description:

I have an issue that takes place during restore of a 14.4 database. During
this process creation of extension aws_s3 fails because it depends on
plpgsql extension which it seems to be created later on. These are the
commands we use for dump / restore:

pg_dump -d \$DATABASE_URL -j 8 -Z 0 -Fd -f ${backupDir}
pg_restore --verbose --clean --no-owner -d \$DATABASE_URL -j 8 --format=d
${backupDir}

This is the output of the pg_restore:
[2023-09-15T14:31:48.653Z] pg_restore: processing item 2 EXTENSION aws_s3
[2023-09-15T14:31:48.653Z] pg_restore: creating EXTENSION "aws_s3"
[2023-09-15T14:31:48.653Z] pg_restore: from TOC entry 2; 3079 57504364
EXTENSION aws_s3 (no owner)
[2023-09-15T14:31:48.653Z] pg_restore: error: could not execute query:
ERROR: language "plpgsql" does not exist
[2023-09-15T14:31:48.653Z] HINT: Use CREATE EXTENSION to load the language
into the database.
[2023-09-15T14:31:48.653Z] Command was: CREATE EXTENSION IF NOT EXISTS
aws_s3 WITH SCHEMA extensions;
[2023-09-15T14:31:48.653Z]
[2023-09-15T14:31:48.653Z]
[2023-09-15T14:31:48.653Z] pg_restore: processing item 8536 COMMENT
EXTENSION aws_s3
[2023-09-15T14:31:48.653Z] pg_restore: creating COMMENT "EXTENSION aws_s3"
[2023-09-15T14:31:48.653Z] pg_restore: from TOC entry 8536; 0 0 COMMENT
EXTENSION aws_s3
[2023-09-15T14:31:48.653Z] pg_restore: error: could not execute query:
ERROR: extension "aws_s3" does not exist
[2023-09-15T14:31:48.653Z] Command was: COMMENT ON EXTENSION aws_s3 IS 'AWS
S3 extension for importing data from S3';
[2023-09-15T14:31:48.653Z]
[2023-09-15T14:31:48.653Z]
[2023-09-15T14:31:48.653Z] pg_restore: processing item 194 SCHEMA
extensions
[2023-09-15T14:31:48.653Z] pg_restore: creating SCHEMA "extensions"
[2023-09-15T14:31:48.653Z] pg_restore: processing item 1 EXTENSION plpgsql
[2023-09-15T14:31:48.653Z] pg_restore: creating EXTENSION "plpgsql"
[2023-09-15T14:31:48.653Z] pg_restore: processing item 8539 COMMENT
EXTENSION plpgsql
[2023-09-15T14:31:48.653Z] pg_restore: creating COMMENT "EXTENSION
plpgsql"

It seems that dependencies between extensions are not considered by pg_dump.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-09-18 11:46:22 BUG #18116: This is definitiv a BUG in INOUT parameter in stored procedures in Postgres 12.16
Previous Message Michael Paquier 2023-09-18 10:13:50 Re: BUG #18070: Assertion failed when processing error from plpy's iterator