Re: public.pg_class isn't a catalog table

Поиск
Список
Период
Сортировка
От Euler Taveira de Oliveira
Тема Re: public.pg_class isn't a catalog table
Дата
Msg-id 46DF83AE.60203@timbira.com
обсуждение исходный текст
Ответ на public.pg_class isn't a catalog table  (Decibel! <decibel@decibel.org>)
Ответы Re: public.pg_class isn't a catalog table  (Guillaume Lelarge <guillaume@lelarge.info>)
Re: public.pg_class isn't a catalog table  (Dave Page <dpage@postgresql.org>)
Список pgadmin-hackers
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);

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Decibel!
Дата:
Сообщение: Re: Maintenance on indexes
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: public.pg_class isn't a catalog table