From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | adh(at)sanger(dot)ac(dot)uk |
Subject: | BUG #15418: pg_restore fails with [archiver (db)] could not execute query: ERROR: function XXXXX does not exist |
Date: | 2018-10-03 13:11:24 |
Message-ID: | 15418-c3f193b2fcaac1c9@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: 15418
Logged by: David Harper
Email address: adh(at)sanger(dot)ac(dot)uk
PostgreSQL version: 10.5
Operating system: Ubuntu 16.04.5 LTS
Description:
A database dumped using "pg_dump -Fc ..." cannot subsequently be loaded
correctly using pg_restore. This happens because pg_restore imports
functions in the wrong order, attempting to import function A before
function B, when the definition of function A uses function B. This bug
manifests itself on versions 9.6.9 and 10.5.1 of the server and client. The
following shell script reliably manifests the bug:
#!/bin/bash
echo ">>>> Create first database"
dropdb --if-exists testdb1
createdb testdb1
echo ">>>> Populate first database"
psql -d testdb1 <<'EOSQL'
CREATE SCHEMA david;
CREATE TABLE david.featuregroup (
featuregroup_id bigint NOT NULL,
subject_id bigint NOT NULL,
object_id bigint NOT NULL,
group_id bigint NOT NULL,
srcfeature_id bigint,
fmin bigint,
fmax bigint,
strand integer,
is_root integer DEFAULT 0 NOT NULL
);
CREATE FUNCTION public.create_point(bigint, bigint) RETURNS point
LANGUAGE sql
AS $_$SELECT point ($1, $2)$_$;
CREATE FUNCTION public.boxrange(bigint, bigint) RETURNS box
LANGUAGE sql IMMUTABLE
AS $_$SELECT box (create_point(0, $1), create_point($2,500000000))$_$;
CREATE INDEX bingroup_boxrange ON david.featuregroup
USING gist (public.boxrange(fmin, fmax)) WHERE (is_root = 1);
EOSQL
echo ">>>> Dump first database"
pg_dump -Fc -f testdb1.dmp testdb1
pg_dump -Fp -f testdb1.sql testdb1
echo ">>>> Create second database"
dropdb --if-exists testdb2
createdb testdb2
echo ">>>> Load dump file into second database"
pg_restore -d testdb2 testdb1.dmp
### End of script
From | Date | Subject | |
---|---|---|---|
Next Message | Sergei Kornilov | 2018-10-03 13:38:16 | Re: BUG #15418: pg_restore fails with [archiver (db)] could not execute query: ERROR: function XXXXX does not exist |
Previous Message | Dean Rasheed | 2018-10-03 13:04:45 | Re: BUG #15307: Low numerical precision of (Co-) Variance |