Обсуждение: errors while restoring data.

Поиск
Список
Период
Сортировка

errors while restoring data.

От
Pritesh Shah
Дата:
hi,

I'm trying to restore some databases from the plain text format dumps.
To restore I'm using:

psql -e -f nmayande.sql template1

I captured a small part while restoring the database which has an error,

CREATE OPERATOR >= (
    PROCEDURE = daterange_greater_than_equals,
    LEFTARG = daterange,
    RIGHTARG = daterange,
    NEGATOR = <,
    RESTRICT = scalargtsel,
    JOIN = scalargtjoinsel
);
psql:/var/tmp/backup/pgsql/20050202/nmayande.sql:1272: ERROR:
function daterange_greater_than_equals(daterange, daterange) does not
exist


These are some of the lines from the *.sql plain text dump file:

......
......

CREATE OPERATOR >= (
    PROCEDURE = daterange_greater_than_equals,
    LEFTARG = daterange,
    RIGHTARG = daterange,
    NEGATOR = <,
    RESTRICT = scalargtsel,
    JOIN = scalargtjoinsel
);

.......
.......

CREATE FUNCTION daterange_greater_than_equals(daterange,
daterange)RETURNS boolean
     AS '$libdir/daterange.so', 'daterange_greater_than_equals'
    LANGUAGE c;

.......
.......


I know that the CREATE FUNCTION part should come before using it in
CREATE OPERATOR. If it was one or two databases i would have edited
the plain text dump file by hand appropriately. But the problem is
this error spreads to lot of other database's plain text dump files
that i'm trying to restore. Please help me out so that i do not have
to do all this editing manually.

Thanks,
Pritesh

Re: errors while restoring data.

От
Tom Lane
Дата:
Pritesh Shah <pritesh.krish@gmail.com> writes:
> I know that the CREATE FUNCTION part should come before using it in
> CREATE OPERATOR. If it was one or two databases i would have edited
> the plain text dump file by hand appropriately.

If you can use the pg_dump from the 8.0 release, it should get this
right.  Prior versions don't do real dependency analysis but rely on
dumping in OID order, which is not a very reliable guide.

            regards, tom lane