The following bug has been logged online:
Bug reference: 1089
Logged by: Joseph Tate
Email address: jtate@mi-corporation.com
PostgreSQL version: 7.4
Operating system: Win32/Cygwin
Description: pg_restore fails when restoring lo.sql functions from
contrib
Details:
I've been having no end to problems with pg_dump/pg_restore. This stuff
should just work!
Execute the following as a user with createdb privs.
$ createdb test-lo
$ psql -f $CONTRIB/lo.sql -d test-lo
$ pg_dump --format=c --file=/tmp/test-lo.bak test-lo
$ dropdb test-lo
$ pg_restore -vCd template1 /tmp/test-lo.bak
This returns
pg_restore: connecting to database for restore
pg_restore: creating DATABASE test-lo
pg_restore: connecting to new database "test-lo" as user "postgres"
pg_restore: connecting to database "test-lo" as user "postgres"
pg_restore: creating ACL public
pg_restore: creating FUNCTION lo_in(cstring)
pg_restore: NOTICE: type "lo" is not yet defined
DETAIL: Creating a shell type definition.
pg_restore: creating FUNCTION lo_out(lo)
pg_restore: NOTICE: argument type lo is only a shell
pg_restore: creating TYPE lo
pg_restore: creating FUNCTION lo_oid(lo)
pg_restore: creating FUNCTION oid(lo)
pg_restore: creating CAST CAST (public.lo AS oid)
pg_restore: creating FUNCTION lo(oid)
pg_restore: creating CAST CAST (oid AS public.lo)
pg_restore: [archiver (db)] could not execute query: ERROR: function
lo(oid) does not exist
pg_restore: *** aborted because of error
To me it looks like the function is created two lines above the failure.
This works fine on Linux using 7.3.4. It also worked on 7.2.x on Cygwin.