Decibel! wrote:
> Version 1.6.3; if you have a table in public called pg_class and try to
> drop it, pgAdmin gives an error:
>
> ERROR: permission denied: "pg_class" is a system catalog
>
That's because pgAdmin is issuing "DROP TABLE pg_class" instead of "DROP
TABLE public.pg_class". By the way, is there any reason for not using
the namespace?
I don't know if it's the best way but this little proof of concept fix
might be applied to all objects that can be created inside a schema. I
could provide I patch if you want it.
--
Euler Taveira de Oliveira
http://www.timbira.com/
Index: pgadmin/schema/pgTable.cpp
===================================================================
--- pgadmin/schema/pgTable.cpp (revis�o 6614)
+++ pgadmin/schema/pgTable.cpp (c�pia de trabalho)
@@ -126,7 +126,13 @@
bool pgTable::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
{
- wxString sql = wxT("DROP TABLE ") + GetQuotedFullIdentifier();
+ wxString sql;
+
+ if (this->GetSchema()->GetName() == this->GetDatabase()->GetDefaultSchema())
+ sql = wxT("DROP TABLE ") + this->GetSchema()->GetName() + wxT(".") + GetQuotedFullIdentifier();
+ else
+ sql = wxT("DROP TABLE ") + GetQuotedFullIdentifier();
+
if (cascaded)
sql += wxT(" CASCADE");
return GetDatabase()->ExecuteVoid(sql);