From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #16137: pg_upgrade fails with an index over nesting function
Date: Mon, 25 Nov 2019 21:00:07 +0000
Message-ID: <16137-4917a81e8491110e@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16137
Logged by: Alexander Lakhin
Email address: exclusion@gmail.com
PostgreSQL version: 12.1
Operating system: Ubuntu 18.04
Description:
The following simple script:
CREATE TABLE test(i INT PRIMARY KEY);
CREATE FUNCTION func2(i INT) RETURNS INT IMMUTABLE LANGUAGE SQL
AS 'SELECT $1';
CREATE FUNCTION func1(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
AS 'SELECT func2($1)';
CREATE INDEX ON test(func1(i));
makes pg_upgrade choke on the database:
...
Performing Upgrade
------------------
Analyzing all rows in the new cluster ok
Freezing all rows in the new cluster ok
Deleting files from new pg_xact ok
Copying old pg_xact to new server ok
Setting next transaction ID and epoch for new cluster ok
Deleting files from new pg_multixact/offsets ok
Copying old pg_multixact/offsets to new server ok
Deleting files from new pg_multixact/members ok
Copying old pg_multixact/members to new server ok
Setting next multixact ID and offset for new cluster ok
Resetting WAL archives ok
Setting frozenxid and minmxid counters in new cluster ok
Restoring global objects in the new cluster ok
Restoring database schemas in the new cluster
postgres
*failure*
Consult the last few lines of "pg_upgrade_dump_12717.log" for
the probable cause of the failure.
Failure, exiting
pg_upgrade_dump_12717.log contains:
...
pg_restore: creating INDEX "public.test_func1_idx"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 2089; 1259 16391 INDEX test_func1_idx postgres
pg_restore: error: could not execute query: ERROR: function func2(integer)
does not exist
LINE 1: SELECT func2($1)
^
HINT: No function matches the given name and argument types. You might need
to add explicit type casts.
QUERY: SELECT func2($1)
CONTEXT: SQL function "func1" during inlining
Command was:
-- For binary upgrade, must preserve pg_class oids
SELECT
pg_catalog.binary_upgrade_set_next_index_pg_class_oid('16391'::pg_catalog.oid);
CREATE INDEX "test_func1_idx" ON "public"."test" USING "btree"
("public"."func1"("i"));
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, exclusion@gmail.com
Subject: Re: BUG #16137: pg_upgrade fails with an index over nesting function
In-Reply-To: <16137-4917a81e8491110e@postgresql.org>
References: <16137-4917a81e8491110e@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox