Hi,

The following set of operations induce an error:

1. Create a backup file /tmp/pg.backup of an existing database
2. Create a new database
3. Right click and select restore database by specifying this file
4. Clicking on "Display Objects" causes the following error: "An error has
occurred: Schema node not found for object DATABASE postgres [ owner
postgres ]

The frmRestore::OnEndProcess() function, when it reads the toc information,
should ignore the line which contains the entry for the dumped database
itself. So the current code erroneously tries to find the schema to which
the DATABASE object belongs and gives out the above error. The fix is to
ignore the input line which contains the db information. The pg_restore
binary also seems to do the same.

PFA, patch to fix this.

Regards,
Nikhils
diff --git a/pgadmin/frm/frmRestore.cpp b/pgadmin/frm/frmRestore.cpp
index e9b6138..1f139d7 100644
--- a/pgadmin/frm/frmRestore.cpp
+++ b/pgadmin/frm/frmRestore.cpp
@@ -558,7 +558,14 @@ void frmRestore::OnEndProcess(wxProcessEvent &ev)
 			// First interesting information: object's type
 			wxString type = col.GetNextToken();
 
-			if (type == wxT("PROCEDURAL"))
+			if (type == wxT("DATABASE"))
+			{
+				// We are restoring a database, not creating one. So ignore
+				// this line as there is no valid schema info and move on
+				// to the next object
+				continue;
+			}
+			else  if (type == wxT("PROCEDURAL"))
 			{
 				// type for a PL is PROCEDURAL LANGUAGE
 				// we'll keep the next column for the object's type
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to