From: lindebg <lindebg@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions
Date: Sat, 19 Nov 2011 09:24:11 +0100
Message-ID: <4EC767AB.4090005@gmail.com> (raw)
In-Reply-To: <15140.1321576938@sss.pgh.pa.us>
References: <201111172054.pAHKsFc7052692@wwwmaster.postgresql.org>
<15140.1321576938@sss.pgh.pa.us>
On 11/19/2011 12:19 AM, lindebg@gmail.com wrote:
> Thanks, in this case works :-) However, this does not solve all cases.
> Unlikely, but possible to create, cyclic case can not be restored:
>
Another example with more functions:
$ psql
create database test;
\connect test
create function fn1(param1 int)
returns int as
$$ select $1 $$
language sql immutable;
create function fn2(param1 int default fn1(8))
returns int as
$$ select $1 $$
language sql immutable;
create function fn3(param1 int default fn2(5))
returns int as
$$ select $1 $$
language sql immutable;
create or replace function fn1(param1 int default fn3(3))
returns int as
$$ select $1 $$
language sql immutable;
\df
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+-------------------------------+--------
public | fn1 | integer | param1 integer DEFAULT fn3(3) | normal
public | fn2 | integer | param1 integer DEFAULT fn1(8) | normal
public | fn3 | integer | param1 integer DEFAULT fn2(5) | normal
(3 rows)
\q
$ pg_dump -F c test > test.backup
pg_dump: [sorter] WARNING: could not resolve dependency loop among these
items:
pg_dump: [sorter] FUNCTION fn2 (ID 173 OID 16403)
pg_dump: [sorter] FUNCTION fn1 (ID 175 OID 16402)
pg_dump: [sorter] FUNCTION fn3 (ID 174 OID 16404)
$ psql -c "drop database test"
$ psql -c "create database test"
$ pg_restore -d test test.backup
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 173; 1255 16403
FUNCTION fn2(integer) postgres
pg_restore: [archiver (db)] could not execute query: ERROR: function
fn1(integer) does not exist
LINE 1: CREATE FUNCTION fn2(param1 integer DEFAULT fn1(8)) RETURNS i...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
Command was: CREATE FUNCTION fn2(param1 integer DEFAULT fn1(8))
RETURNS integer
LANGUAGE sql IMMUTABLE
AS $_$ select $1 $_$;
pg_restore: [archiver (db)] could not execute query: ERROR: function
public.fn2(integer) does not exist
Command was: ALTER FUNCTION public.fn2(param1 integer) OWNER TO
postgres;
pg_restore: [archiver (db)] Error from TOC entry 174; 1255 16404
FUNCTION fn3(integer) postgres
pg_restore: [archiver (db)] could not execute query: ERROR: function
fn2(integer) does not exist
LINE 1: CREATE FUNCTION fn3(param1 integer DEFAULT fn2(5)) RETURNS i...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
Command was: CREATE FUNCTION fn3(param1 integer DEFAULT fn2(5))
RETURNS integer
LANGUAGE sql IMMUTABLE
AS $_$ select $1 $_$;
pg_restore: [archiver (db)] could not execute query: ERROR: function
public.fn3(integer) does not exist
Command was: ALTER FUNCTION public.fn3(param1 integer) OWNER TO
postgres;
pg_restore: [archiver (db)] Error from TOC entry 175; 1255 16402
FUNCTION fn1(integer) postgres
pg_restore: [archiver (db)] could not execute query: ERROR: function
fn3(integer) does not exist
LINE 1: CREATE FUNCTION fn1(param1 integer DEFAULT fn3(3)) RETURNS i...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
Command was: CREATE FUNCTION fn1(param1 integer DEFAULT fn3(3))
RETURNS integer
LANGUAGE sql IMMUTABLE
AS $_$ select $1 $_$;
pg_restore: [archiver (db)] could not execute query: ERROR: function
public.fn1(integer) does not exist
Command was: ALTER FUNCTION public.fn1(param1 integer) OWNER TO
postgres;
WARNING: errors ignored on restore: 6
$ psql test
\df
List of functions
Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+---------------------+------
(0 rows)
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: lindebg@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions
In-Reply-To: <4EC767AB.4090005@gmail.com>
References: <201111172054.pAHKsFc7052692@wwwmaster.postgresql.org> <15140.1321576938@sss.pgh.pa.us> <4EC767AB.4090005@gmail.com>
* 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