Hello,

In testing some pg_restore functionality I found the following:

postgres@jd-laptop:~$ pg_dump -U postgres -Fc -s --file=foo.sqlc
postgres@jd-laptop:~$ dropdb test;
postgres@jd-laptop:~$ createdb test;
postgres@jd-laptop:~$ pg_restore -d test -P 'by()' foo.sqlc
postgres@jd-laptop:~$ psql -U postgres test
psql (9.1.8)
Type "help" for help.

test=# select by();
 by
----
 by
(1 row)

test=# select hello();
ERROR:  function hello() does not exist
LINE 1: select hello();
               ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

----> The above is as expected.


test=# \q
postgres@jd-laptop:~$ pg_restore -d test -P 'by(),hello()' foo.sqlc
postgres@jd-laptop:~$ psql -U postgres test;
psql (9.1.8)
Type "help" for help.

test=# select hello();
ERROR:  function hello() does not exist
LINE 1: select hello();

----> This is where I am confused. It didn't restore hello() and it also didn't error that the syntax of the restore command was invalid.
               ^
test=# drop function by();
DROP FUNCTION
test=#
test=# q
test-# \q
postgres@jd-laptop:~$ pg_restore -d test -P 'by(),hello()' foo.sqlc
postgres@jd-laptop:~$ psql -U postgres test;
psql (9.1.8)
Type "help" for help.

test=# drop function by();
ERROR:  function by() does not exist

----> by() not restored by above command


test=# \q
postgres@jd-laptop:~$ pg_restore -d test -P 'by()','hello()' foo.sqlc
postgres@jd-laptop:~$ psql -U postgres test;
psql (9.1.8)
Type "help" for help.

test=# drop function by();
ERROR:  function by() does not exist
test=# select hello();
ERROR:  function hello() does not exist
LINE 1: select hello();
               ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

----> by() and hello() also not restored


test=# \q
postgres@jd-laptop:~$ pg_restore -d test -P 'by()' -P'hello()' foo.sqlc
postgres@jd-laptop:~$ psql -U postgres test;
psql (9.1.8)
Type "help" for help.

test=# select hello();
 hello
-------
 hello
(1 row)

test=# select by();
ERROR:  function by() does not exist
LINE 1: select by();

----> hello() restored but by() was not.


It appears we need better syntax checking.

Sincerely,

JD



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to