Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions

Поиск
Список
Период
Сортировка
От lindebg@gmail.com
Тема Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions
Дата
Msg-id CAHp0ynfWETH3WvrJTEQ9BJT+ugTBVbk0mcjXCZ7s-wobHn50WA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #6299: pg_dump, pg_dumpall - Problem with the order of backup functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Thanks, in this case works :-) However, this does not solve all cases.
Unlikely, but possible to create, cyclic case can not be restored:


$ 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 or replace function fn1(param1 int = fn2(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 fn2(3) | normal
 public | fn2  | integer          | param1 integer DEFAULT fn1(8) | normal
(2 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 16398)
pg_dump: [sorter]   FUNCTION fn1  (ID 174 OID 16397)


$ 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 16398 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 16397 FUNCTION
fn1(integer) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function
fn2(integer) does not exist
LINE 1: CREATE FUNCTION fn1(param1 integer DEFAULT fn2(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 fn2(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: 4



$ psql test

\df
                       List of functions
 Schema | Name | Result data type | Argument data types | Type
--------+------+------------------+---------------------+------
(0 rows)

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alex Hunsaker
Дата:
Сообщение: Re: BUG #6300: duplicate key value violates unique constraint
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #6300: duplicate key value violates unique constraint