The following bug has been logged online:
Bug reference: 6299
Logged by: lindebg
Email address: lindebg@gmail.com
PostgreSQL version: 9.0, 9.1
Operating system: Linux, Windows
Description: pg_dump, pg_dumpall - Problem with the order of backup
functions
Details:
1. create database test and functions fn2, fn1:
$ psql -c "create database test"
$ psql test
test=# create function fn2()
returns int as
$$ select 1 $$
language sql immutable;
create function fn1(param1 int default fn2())
returns int as
$$ select $1 $$
language sql immutable;
\q
2. backup:
pg_dump -F c > test.backup
3. clear database:
psql -c "drop database test"
psql -c "create database test"
4. restore database:
pg_restore -d test test.backup
Errors:
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 221; 1255 21043 FUNCTION
fn1(integer) postgres
pg_restore: [archiver (db)] could not execute query: ERROR: function fn2()
does not exist
LINE 1: CREATE FUNCTION fn1(param1 integer DEFAULT fn2()) RETURNS in...
^
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 fn2()) 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: 2