pg_dump/restore syntax checking bug?

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_dump/restore syntax checking bug?
Date: 2013-03-23 04:35:47
Message-ID: 514D3123.3040907@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello,

In testing some pg_restore functionality I found the following:

postgres(at)jd-laptop:~$ pg_dump -U postgres -Fc -s --file=foo.sqlc
postgres(at)jd-laptop:~$ dropdb test;
postgres(at)jd-laptop:~$ createdb test;
postgres(at)jd-laptop:~$ pg_restore -d test -P 'by()' foo.sqlc
postgres(at)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(at)jd-laptop:~$ pg_restore -d test -P 'by(),hello()' foo.sqlc
postgres(at)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(at)jd-laptop:~$ pg_restore -d test -P 'by(),hello()' foo.sqlc
postgres(at)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(at)jd-laptop:~$ pg_restore -d test -P 'by()','hello()' foo.sqlc
postgres(at)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(at)jd-laptop:~$ pg_restore -d test -P 'by()' -P'hello()' foo.sqlc
postgres(at)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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2013-03-23 04:57:45 Re: Let's invent a function to report lock-wait-blocking PIDs
Previous Message Jim Nasby 2013-03-23 04:35:35 Re: Enabling Checksums