pg_dump/restore in 8.0beta1 are not working well with formats other thans plain text:



$ pg_restore --version
pg_restore (PostgreSQL) 8.0.0beta1
$ pg_dump --version
pg_dump (PostgreSQL) 8.0.0beta1

$ createdb test_8
CREATE DATABASE
$ createlang plpgsql test_8

$ psql test_8 -c \
> " create function foo() returns int as 'begin return 1; end;' language 'plpgsql'"
CREATE FUNCTION


$ psql test_8 -c "select foo()";
 foo
-----
   1
(1 row)



$ pg_dump --format=c --file=test_8.dump test_8

$ pg_restore --format=c --clean --dbname=test_8 test_8.dump
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: unterminated dollar-quoted string at or near "$$begin return 1;" at character 115
pg_restore: WARNING: there is no transaction in progress
pg_restore: [archiver (db)] could not execute query: ERROR: unterminated dollar-quoted string at or near "$$
LANGUAGE plpgsql;" at character 1
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
pg_restore: [archiver (db)] could not execute query: ERROR: schema "public" does not exist
--
-- PostgreSQL database dump complete
--


WARNING, errors ignored on restore: 10
$

Note that there was a problem restoring the function.
Did --clean remove the public schema?
Hmm ...  maybe there's a problem with --clean

$ dropdb test_8
DROP DATABASE
$ pg_restore --format=c --create --dbname=test test_8.dump
pg_restore: [archiver (db)] could not execute query: ERROR: unterminated dollar-quoted string at or near "$$begin return 1;" at character 115
pg_restore: WARNING: there is no transaction in progress
pg_restore: [archiver (db)] could not execute query: ERROR: unterminated dollar-quoted string at or near "$$
LANGUAGE plpgsql;" at character 1
pg_restore: [archiver (db)] could not execute query: ERROR: function public.foo() does not exist
--
-- PostgreSQL database dump complete
--


WARNING, errors ignored on restore: 3
$


Yep, but we still can't restore the function.

tests with format=t show the same behaviour.
tests with format=p succeed

--
Edmund Bacon <[EMAIL PROTECTED]>

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to