Обсуждение: wrong current schema in Search Objects dialog box
Hello.
I applied this patch http://git.postgresql.org/gitweb/?p=pgadmin3.git;a=commitdiff;h=010e38cdd4991feaf2e757e803d330dc6c5bdba6
and found that current schema is determined incorrectly when I select such objects as Constraints, Indexes, Rules or Triggers (parts of any Table).
In this case combo-box contains item named "Current Schema (<table_name>)" instead of "Current Schema (<schema_name>)".
Please, look at the module /pgadmin/dlg/dlgSearchObject.cpp (line 153) and especially at this place:
if (obj->GetSchema())
currentSchema = obj->GetSchema()->GetName();
else if (obj->GetMetaType() == PGM_SCHEMA && !obj->IsCollection())
currentSchema = obj->GetName();
else
currentSchema = wxEmptyString;
Maybe here must be an additional check for an object's type (in first condition) or there is a bug in the definition of schemas for object tree?
I have attached screenshots for better explaining the problem.
I applied this patch http://git.postgresql.org/gitweb/?p=pgadmin3.git;a=commitdiff;h=010e38cdd4991feaf2e757e803d330dc6c5bdba6
and found that current schema is determined incorrectly when I select such objects as Constraints, Indexes, Rules or Triggers (parts of any Table).
In this case combo-box contains item named "Current Schema (<table_name>)" instead of "Current Schema (<schema_name>)".
Please, look at the module /pgadmin/dlg/dlgSearchObject.cpp (line 153) and especially at this place:
if (obj->GetSchema())
currentSchema = obj->GetSchema()->GetName();
else if (obj->GetMetaType() == PGM_SCHEMA && !obj->IsCollection())
currentSchema = obj->GetName();
else
currentSchema = wxEmptyString;
Maybe here must be an additional check for an object's type (in first condition) or there is a bug in the definition of schemas for object tree?
I have attached screenshots for better explaining the problem.
-- Dmitriy Olshevskiy
Вложения
Hi J.F. Do you have a few minutes to look at this please? Thanks. On Sun, Jun 15, 2014 at 7:30 PM, Dmitriy Olshevskiy <olshevskiy87@bk.ru> wrote: > Hello. > I applied this patch > http://git.postgresql.org/gitweb/?p=pgadmin3.git;a=commitdiff;h=010e38cdd4991feaf2e757e803d330dc6c5bdba6 > and found that current schema is determined incorrectly when I select such > objects as Constraints, Indexes, Rules or Triggers (parts of any Table). > In this case combo-box contains item named "Current Schema (<table_name>)" > instead of "Current Schema (<schema_name>)". > Please, look at the module /pgadmin/dlg/dlgSearchObject.cpp (line 153) and > especially at this place: > > if (obj->GetSchema()) > currentSchema = obj->GetSchema()->GetName(); > else if (obj->GetMetaType() == PGM_SCHEMA && !obj->IsCollection()) > currentSchema = obj->GetName(); > else > currentSchema = wxEmptyString; > > Maybe here must be an additional check for an object's type (in first > condition) or there is a bug in the definition of schemas for object tree? > I have attached screenshots for better explaining the problem. > > -- > Dmitriy Olshevskiy > > > > -- > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Hello, Monday, June 16, 2014, 11:58:28 AM, Dave Page wrote: DP> Do you have a few minutes to look at this please? Sure! DP> On Sun, Jun 15, 2014 at 7:30 PM, Dmitriy Olshevskiy <olshevskiy87@bk.ru> wrote: >> I applied this patch >> http://git.postgresql.org/gitweb/?p=pgadmin3.git;a=commitdiff;h=010e38cdd4991feaf2e757e803d330dc6c5bdba6 >> and found that current schema is determined incorrectly when I select such >> objects as Constraints, Indexes, Rules or Triggers (parts of any Table). >> In this case combo-box contains item named "Current Schema (<table_name>)" >> instead of "Current Schema (<schema_name>)". ... >> Maybe here must be an additional check for an object's type (in first >> condition) or there is a bug in the definition of schemas for object tree? Dmitry, thanks for testing and reporting! A surprise for me but really, GetSchema() for collections of indexes, rules, constraints and triggers returns not <schema_name>, but <table_name>. Some lines of code like collection->GetSchema()->GetSchema() speak well for a design consideration, not a bug. Dave, please see the attached patch to workaround that. It also includes minor fixes: - Extend ORDER BY over 3-rd column (path) - Dedublicate objects in results grid that have a match in several search modes simultaneously. -- Best regards, J.F.
Вложения
Hi On Mon, Jun 16, 2014 at 8:54 PM, J.F. Oster <jinfroster@mail.ru> wrote: > Hello, > > Monday, June 16, 2014, 11:58:28 AM, Dave Page wrote: > > DP> Do you have a few minutes to look at this please? > > Sure! > > DP> On Sun, Jun 15, 2014 at 7:30 PM, Dmitriy Olshevskiy <olshevskiy87@bk.ru> wrote: > >>> I applied this patch >>> http://git.postgresql.org/gitweb/?p=pgadmin3.git;a=commitdiff;h=010e38cdd4991feaf2e757e803d330dc6c5bdba6 >>> and found that current schema is determined incorrectly when I select such >>> objects as Constraints, Indexes, Rules or Triggers (parts of any Table). >>> In this case combo-box contains item named "Current Schema (<table_name>)" >>> instead of "Current Schema (<schema_name>)". > ... >>> Maybe here must be an additional check for an object's type (in first >>> condition) or there is a bug in the definition of schemas for object tree? > > Dmitry, thanks for testing and reporting! > A surprise for me but really, GetSchema() for collections of indexes, > rules, constraints and triggers returns not <schema_name>, but > <table_name>. Some lines of code like > collection->GetSchema()->GetSchema() > speak well for a design consideration, not a bug. Oh, yeah - that's a horrible hack that's (unfortunately) deeply baked into the code. Guillaume has spent a lot of time trying to fix that in the past, but it needs a huge amount of work :-( > Dave, please see the attached patch to workaround that. > It also includes minor fixes: > - Extend ORDER BY over 3-rd column (path) > - Dedublicate objects in results grid that have a match in several > search modes simultaneously. Committed - thanks! -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company