Thread: Re: [pgadmin-support] Search feature request

Re: [pgadmin-support] Search feature request

From
"J.F. Oster"
Date:
Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:

GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>> I know that PgAdmin has the ability to find a pattern in various object
>> names.
>>
>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>
>> For example, if I have a procedure named get_login, and it has a select
>> that looks like
>>
>>    select person_id from logins ....
>>
>> and I search for "person_id", can PgAdmin find this within the get_login
>> procedure?

GL> Nope, it doesn't work like that. But a patch might help to get it do
GL> that.

Suggested feature will be a must-have for pl-developers to find code
dependencies not maintained by DBMS.

Since searching pg_proc should be optional (right?), it's required to
modify Search Objects dialogue. And since I have some more thoughts
(plans for the future) on improving this tool, some concerning
dialogue design, I'd like to express these now altogether.

1. Make "search for pattern in object's names" one of few options,
enabled by default. Others will be "search in definitions" and "search
in comments". I see these as a number of checkboxes.
Searching in object's definitions may be further advanced by
considering constraint's expressions, column's defaults, type's fields
and so on.

2. In addition to objects Type filter implement Schema filter to cut
off objects in schemas of no interest. This is a combobox with items:
(All Schemas), (Current Schema)*, (User Schemas) plus list of all
schemas in database.

3. Allow to call Search Objects dialogue when any DB-object in Object
Browser is selected, not only DB itself. Object trees are huge
sometimes, so having to select DB item (and loose current object) each
time I wish to search for something makes the tool unattractive at
all. Required to implement (Current Schema) filter.

4. If text pattern contains "%" char then don't add %%'s to it.

5. Use statusbar: "Searching...", "Nothing was found" or "Found N
items".

Devs, please see the sketch attached. Is this OK?
I can work on this when I have time, if no one gets to this earlier.


--
Best regards,
 J.F.
Attachment

Re: [pgadmin-support] Search feature request

From
Dave Page
Date:
On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>
> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>
> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>> I know that PgAdmin has the ability to find a pattern in various object
>>> names.
>>>
>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>
>>> For example, if I have a procedure named get_login, and it has a select
>>> that looks like
>>>
>>>    select person_id from logins ....
>>>
>>> and I search for "person_id", can PgAdmin find this within the get_login
>>> procedure?
>
> GL> Nope, it doesn't work like that. But a patch might help to get it do
> GL> that.
>
> Suggested feature will be a must-have for pl-developers to find code
> dependencies not maintained by DBMS.
>
> Since searching pg_proc should be optional (right?), it's required to
> modify Search Objects dialogue. And since I have some more thoughts
> (plans for the future) on improving this tool, some concerning
> dialogue design, I'd like to express these now altogether.
>
> 1. Make "search for pattern in object's names" one of few options,
> enabled by default. Others will be "search in definitions" and "search
> in comments". I see these as a number of checkboxes.
> Searching in object's definitions may be further advanced by
> considering constraint's expressions, column's defaults, type's fields
> and so on.
>
> 2. In addition to objects Type filter implement Schema filter to cut
> off objects in schemas of no interest. This is a combobox with items:
> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
> schemas in database.
>
> 3. Allow to call Search Objects dialogue when any DB-object in Object
> Browser is selected, not only DB itself. Object trees are huge
> sometimes, so having to select DB item (and loose current object) each
> time I wish to search for something makes the tool unattractive at
> all. Required to implement (Current Schema) filter.
>
> 4. If text pattern contains "%" char then don't add %%'s to it.
>
> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
> items".
>
> Devs, please see the sketch attached. Is this OK?
> I can work on this when I have time, if no one gets to this earlier.

Looks good to me. Thanks for looking at this.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgadmin-support] Search feature request

From
"J.F. Oster"
Date:
Hello Dave,

Monday, March 10, 2014, 1:36:37 PM, you wrote:

DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>
>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>
>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>> names.
>>>>
>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>
>>>> For example, if I have a procedure named get_login, and it has a select
>>>> that looks like
>>>>
>>>>    select person_id from logins ....
>>>>
>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>> procedure?
>>
>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>> GL> that.
>>
>> Suggested feature will be a must-have for pl-developers to find code
>> dependencies not maintained by DBMS.
>>
>> Since searching pg_proc should be optional (right?), it's required to
>> modify Search Objects dialogue. And since I have some more thoughts
>> (plans for the future) on improving this tool, some concerning
>> dialogue design, I'd like to express these now altogether.
>>
>> 1. Make "search for pattern in object's names" one of few options,
>> enabled by default. Others will be "search in definitions" and "search
>> in comments". I see these as a number of checkboxes.
>> Searching in object's definitions may be further advanced by
>> considering constraint's expressions, column's defaults, type's fields
>> and so on.
>>
>> 2. In addition to objects Type filter implement Schema filter to cut
>> off objects in schemas of no interest. This is a combobox with items:
>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>> schemas in database.
>>
>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>> Browser is selected, not only DB itself. Object trees are huge
>> sometimes, so having to select DB item (and loose current object) each
>> time I wish to search for something makes the tool unattractive at
>> all. Required to implement (Current Schema) filter.
>>
>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>
>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>> items".
>>
>> Devs, please see the sketch attached. Is this OK?
>> I can work on this when I have time, if no one gets to this earlier.

DP> Looks good to me. Thanks for looking at this.

Here it is. Seems to work for me, but needs testing. I tested on 9.3
only.
I tried to make queries easier to extend with new object types with
UNIONs. May be there is a better way to write them... well, afaic.

Implemented all the points above plus use qtDbString() to process
quote signs etc.
But statusbar won't initialize for some reason. If I force it to
initialize, it doesn't obey further window resizes. Is there a secret
to make it work correctly? :)

--
Best regards,
 J.F.

Attachment

Re: [pgadmin-support] Search feature request

From
Dave Page
Date:
Ashesh, can you or one of the team help J. F. figure out the status
bar and review the patch please?

Thanks.

On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
> Hello Dave,
>
> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>
> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>
>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>
>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>>> names.
>>>>>
>>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>>
>>>>> For example, if I have a procedure named get_login, and it has a select
>>>>> that looks like
>>>>>
>>>>>    select person_id from logins ....
>>>>>
>>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>>> procedure?
>>>
>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>> GL> that.
>>>
>>> Suggested feature will be a must-have for pl-developers to find code
>>> dependencies not maintained by DBMS.
>>>
>>> Since searching pg_proc should be optional (right?), it's required to
>>> modify Search Objects dialogue. And since I have some more thoughts
>>> (plans for the future) on improving this tool, some concerning
>>> dialogue design, I'd like to express these now altogether.
>>>
>>> 1. Make "search for pattern in object's names" one of few options,
>>> enabled by default. Others will be "search in definitions" and "search
>>> in comments". I see these as a number of checkboxes.
>>> Searching in object's definitions may be further advanced by
>>> considering constraint's expressions, column's defaults, type's fields
>>> and so on.
>>>
>>> 2. In addition to objects Type filter implement Schema filter to cut
>>> off objects in schemas of no interest. This is a combobox with items:
>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>> schemas in database.
>>>
>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>> Browser is selected, not only DB itself. Object trees are huge
>>> sometimes, so having to select DB item (and loose current object) each
>>> time I wish to search for something makes the tool unattractive at
>>> all. Required to implement (Current Schema) filter.
>>>
>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>
>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>> items".
>>>
>>> Devs, please see the sketch attached. Is this OK?
>>> I can work on this when I have time, if no one gets to this earlier.
>
> DP> Looks good to me. Thanks for looking at this.
>
> Here it is. Seems to work for me, but needs testing. I tested on 9.3
> only.
> I tried to make queries easier to extend with new object types with
> UNIONs. May be there is a better way to write them... well, afaic.
>
> Implemented all the points above plus use qtDbString() to process
> quote signs etc.
> But statusbar won't initialize for some reason. If I force it to
> initialize, it doesn't obey further window resizes. Is there a secret
> to make it work correctly? :)
>
> --
> Best regards,
>  J.F.



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgadmin-support] Search feature request

From
"J.F. Oster"
Date:
Hello Ashesh,

Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:

DP> Ashesh, can you or one of the team help J. F. figure out the status
DP> bar and review the patch please?

DP> Thanks.

Got status bar working by adding

statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);

to the constructor. That line exists in one of the parent's
constructor for most dialogs. dlgSearchObject is of different
inheritance hierarchy thus missing that bit of code.

Also made few minor fixes. Please see the patch.



DP> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>> Hello Dave,
>>
>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>
>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>
>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>
>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>>>> names.
>>>>>>
>>>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>>>
>>>>>> For example, if I have a procedure named get_login, and it has a select
>>>>>> that looks like
>>>>>>
>>>>>>    select person_id from logins ....
>>>>>>
>>>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>>>> procedure?
>>>>
>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>> GL> that.
>>>>
>>>> Suggested feature will be a must-have for pl-developers to find code
>>>> dependencies not maintained by DBMS.
>>>>
>>>> Since searching pg_proc should be optional (right?), it's required to
>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>> (plans for the future) on improving this tool, some concerning
>>>> dialogue design, I'd like to express these now altogether.
>>>>
>>>> 1. Make "search for pattern in object's names" one of few options,
>>>> enabled by default. Others will be "search in definitions" and "search
>>>> in comments". I see these as a number of checkboxes.
>>>> Searching in object's definitions may be further advanced by
>>>> considering constraint's expressions, column's defaults, type's fields
>>>> and so on.
>>>>
>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>> off objects in schemas of no interest. This is a combobox with items:
>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>> schemas in database.
>>>>
>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>> Browser is selected, not only DB itself. Object trees are huge
>>>> sometimes, so having to select DB item (and loose current object) each
>>>> time I wish to search for something makes the tool unattractive at
>>>> all. Required to implement (Current Schema) filter.
>>>>
>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>
>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>> items".
>>>>
>>>> Devs, please see the sketch attached. Is this OK?
>>>> I can work on this when I have time, if no one gets to this earlier.
>>
>> DP> Looks good to me. Thanks for looking at this.
>>
>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>> only.
>> I tried to make queries easier to extend with new object types with
>> UNIONs. May be there is a better way to write them... well, afaic.
>>
>> Implemented all the points above plus use qtDbString() to process
>> quote signs etc.
>> But statusbar won't initialize for some reason. If I force it to
>> initialize, it doesn't obey further window resizes. Is there a secret
>> to make it work correctly? :)


--
Best regards,
 J.F.

Attachment

Re: [pgadmin-support] Search feature request

From
Ashesh Vashi
Date:
I will look into it tomorrow.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA:
Enterprise PostgreSQL Company

 

http://www.linkedin.com/in/asheshvashi



On Mon, Apr 7, 2014 at 10:47 PM, J.F. Oster <jinfroster@mail.ru> wrote:
Hello Ashesh,

Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:

DP> Ashesh, can you or one of the team help J. F. figure out the status
DP> bar and review the patch please?

DP> Thanks.

Got status bar working by adding

statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);

to the constructor. That line exists in one of the parent's
constructor for most dialogs. dlgSearchObject is of different
inheritance hierarchy thus missing that bit of code.

Also made few minor fixes. Please see the patch.



DP> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>> Hello Dave,
>>
>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>
>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>
>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>
>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>>>> names.
>>>>>>
>>>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>>>
>>>>>> For example, if I have a procedure named get_login, and it has a select
>>>>>> that looks like
>>>>>>
>>>>>>    select person_id from logins ....
>>>>>>
>>>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>>>> procedure?
>>>>
>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>> GL> that.
>>>>
>>>> Suggested feature will be a must-have for pl-developers to find code
>>>> dependencies not maintained by DBMS.
>>>>
>>>> Since searching pg_proc should be optional (right?), it's required to
>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>> (plans for the future) on improving this tool, some concerning
>>>> dialogue design, I'd like to express these now altogether.
>>>>
>>>> 1. Make "search for pattern in object's names" one of few options,
>>>> enabled by default. Others will be "search in definitions" and "search
>>>> in comments". I see these as a number of checkboxes.
>>>> Searching in object's definitions may be further advanced by
>>>> considering constraint's expressions, column's defaults, type's fields
>>>> and so on.
>>>>
>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>> off objects in schemas of no interest. This is a combobox with items:
>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>> schemas in database.
>>>>
>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>> Browser is selected, not only DB itself. Object trees are huge
>>>> sometimes, so having to select DB item (and loose current object) each
>>>> time I wish to search for something makes the tool unattractive at
>>>> all. Required to implement (Current Schema) filter.
>>>>
>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>
>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>> items".
>>>>
>>>> Devs, please see the sketch attached. Is this OK?
>>>> I can work on this when I have time, if no one gets to this earlier.
>>
>> DP> Looks good to me. Thanks for looking at this.
>>
>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>> only.
>> I tried to make queries easier to extend with new object types with
>> UNIONs. May be there is a better way to write them... well, afaic.
>>
>> Implemented all the points above plus use qtDbString() to process
>> quote signs etc.
>> But statusbar won't initialize for some reason. If I force it to
>> initialize, it doesn't obey further window resizes. Is there a secret
>> to make it work correctly? :)


--
Best regards,
 J.F.

Re: [pgadmin-support] Search feature request

From
"J.F. Oster"
Date:
Hello Ashesh,

Have you had time to look into the patch?



AV> On Mon, Apr 7, 2014 at 10:47 PM, J.F. Oster <jinfroster@mail.ru> wrote:
AV> Hello Ashesh,

AV> Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:

DP>> Ashesh, can you or one of the team help J. F. figure out the status
DP>> bar and review the patch please?

DP>> Thanks.

AV> Got status bar working by adding

AV> statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);

AV> to the constructor. That line exists in one of the parent's
AV> constructor for most dialogs. dlgSearchObject is of different
AV> inheritance hierarchy thus missing that bit of code.

AV> Also made few minor fixes. Please see the patch.



DP>> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>>> Hello Dave,
>>>
>>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>>
>>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>
>>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>>
>>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>>>>> names.
>>>>>>>
>>>>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>>>>
>>>>>>> For example, if I have a procedure named get_login, and it has a select
>>>>>>> that looks like
>>>>>>>
>>>>>>> ═ ═select person_id from logins ....
>>>>>>>
>>>>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>>>>> procedure?
>>>>>
>>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>>> GL> that.
>>>>>
>>>>> Suggested feature will be a must-have for pl-developers to find code
>>>>> dependencies not maintained by DBMS.
>>>>>
>>>>> Since searching pg_proc should be optional (right?), it's required to
>>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>>> (plans for the future) on improving this tool, some concerning
>>>>> dialogue design, I'd like to express these now altogether.
>>>>>
>>>>> 1. Make "search for pattern in object's names" one of few options,
>>>>> enabled by default. Others will be "search in definitions" and "search
>>>>> in comments". I see these as a number of checkboxes.
>>>>> Searching in object's definitions may be further advanced by
>>>>> considering constraint's expressions, column's defaults, type's fields
>>>>> and so on.
>>>>>
>>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>>> off objects in schemas of no interest. This is a combobox with items:
>>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>>> schemas in database.
>>>>>
>>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>>> Browser is selected, not only DB itself. Object trees are huge
>>>>> sometimes, so having to select DB item (and loose current object) each
>>>>> time I wish to search for something makes the tool unattractive at
>>>>> all. Required to implement (Current Schema) filter.
>>>>>
>>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>>
>>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>>> items".
>>>>>
>>>>> Devs, please see the sketch attached. Is this OK?
>>>>> I can work on this when I have time, if no one gets to this earlier.
>>>
>>> DP> Looks good to me. Thanks for looking at this.
>>>
>>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>>> only.
>>> I tried to make queries easier to extend with new object types with
>>> UNIONs. May be there is a better way to write them... well, afaic.
>>>
>>> Implemented all the points above plus use qtDbString() to process
>>> quote signs etc.
>>> But statusbar won't initialize for some reason. If I force it to
>>> initialize, it doesn't obey further window resizes. Is there a secret
>>> to make it work correctly? :)


--
Best regards,
 J.F.



PATCH: Search Objects by definitions and comments

From
"J.F. Oster"
Date:
Hello,

Can someone review this patch, please?


Monday, May 5, 2014, 6:22:15 PM, J.F. Oster wrote:

JFO> Hello Ashesh,
JFO> Have you had time to look into the patch?

AV>> On Mon, Apr 7, 2014 at 10:47 PM, J.F. Oster <jinfroster@mail.ru> wrote:
AV>> Hello Ashesh,

AV>> Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:

DP>>> Ashesh, can you or one of the team help J. F. figure out the status
DP>>> bar and review the patch please?

DP>>> Thanks.

AV>> Got status bar working by adding

AV>> statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);

AV>> to the constructor. That line exists in one of the parent's
AV>> constructor for most dialogs. dlgSearchObject is of different
AV>> inheritance hierarchy thus missing that bit of code.

AV>> Also made few minor fixes. Please see the patch.



DP>>> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>> Hello Dave,
>>>>
>>>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>>>
>>>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>>
>>>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>>>
>>>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>>>>>> names.
>>>>>>>>
>>>>>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>>>>>
>>>>>>>> For example, if I have a procedure named get_login, and it has a select
>>>>>>>> that looks like
>>>>>>>>
>>>>>>>> ═ ═select person_id from logins ....
>>>>>>>>
>>>>>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>>>>>> procedure?
>>>>>>
>>>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>>>> GL> that.
>>>>>>
>>>>>> Suggested feature will be a must-have for pl-developers to find code
>>>>>> dependencies not maintained by DBMS.
>>>>>>
>>>>>> Since searching pg_proc should be optional (right?), it's required to
>>>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>>>> (plans for the future) on improving this tool, some concerning
>>>>>> dialogue design, I'd like to express these now altogether.
>>>>>>
>>>>>> 1. Make "search for pattern in object's names" one of few options,
>>>>>> enabled by default. Others will be "search in definitions" and "search
>>>>>> in comments". I see these as a number of checkboxes.
>>>>>> Searching in object's definitions may be further advanced by
>>>>>> considering constraint's expressions, column's defaults, type's fields
>>>>>> and so on.
>>>>>>
>>>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>>>> off objects in schemas of no interest. This is a combobox with items:
>>>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>>>> schemas in database.
>>>>>>
>>>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>>>> Browser is selected, not only DB itself. Object trees are huge
>>>>>> sometimes, so having to select DB item (and loose current object) each
>>>>>> time I wish to search for something makes the tool unattractive at
>>>>>> all. Required to implement (Current Schema) filter.
>>>>>>
>>>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>>>
>>>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>>>> items".
>>>>>>
>>>>>> Devs, please see the sketch attached. Is this OK?
>>>>>> I can work on this when I have time, if no one gets to this earlier.
>>>>
>>>> DP> Looks good to me. Thanks for looking at this.
>>>>
>>>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>>>> only.
>>>> I tried to make queries easier to extend with new object types with
>>>> UNIONs. May be there is a better way to write them... well, afaic.
>>>>
>>>> Implemented all the points above plus use qtDbString() to process
>>>> quote signs etc.
>>>> But statusbar won't initialize for some reason. If I force it to
>>>> initialize, it doesn't obey further window resizes. Is there a secret
>>>> to make it work correctly? :)





--
Best regards,
 J.F.

Attachment

Re: PATCH: Search Objects by definitions and comments

From
Dave Page
Date:
Hi,

Sorry for the delay on this - my team is short-staffed at the moment
(and we're hiring if anyone is interested :-) ).

I had a play with this, and ran into an issue. I have multiple tables
that match the pattern %waits in my test DB, so figured that would be
a good test. It successfully finds the tables, but also finds the row
datatypes associated with them, which are not shown in the treeview at
the moment because "Show system objects" is turned off. Clicking on a
type entry in the results leads to some crazyness:

- I see a message immediately saying the object couldn't be found
(this is good).
- When I click OK on the message box, the treeview starts expanding
nodes like crazy, before displaying the error message again.
- The above may be related to another problem. When the first error
message is shown, the list of results behaves as if the shift button
is held down. When I move the mouse to click OK, all the other results
get highlighted, which I think is what's causing it to search again
for other results, and then causing another error.

One final issue for this revision - the two combo boxes at the top do
not have enough space to live in (on OSX at least - please see the
attached screenshot). Please give them some more wiggle room :-)

Thanks!

On Sat, Jun 7, 2014 at 5:28 AM, J.F. Oster <jinfroster@mail.ru> wrote:
> Hello,
>
> Can someone review this patch, please?
>
>
> Monday, May 5, 2014, 6:22:15 PM, J.F. Oster wrote:
>
> JFO> Hello Ashesh,
> JFO> Have you had time to look into the patch?
>
> AV>> On Mon, Apr 7, 2014 at 10:47 PM, J.F. Oster <jinfroster@mail.ru> wrote:
> AV>> Hello Ashesh,
>
> AV>> Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:
>
> DP>>> Ashesh, can you or one of the team help J. F. figure out the status
> DP>>> bar and review the patch please?
>
> DP>>> Thanks.
>
> AV>> Got status bar working by adding
>
> AV>> statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);
>
> AV>> to the constructor. That line exists in one of the parent's
> AV>> constructor for most dialogs. dlgSearchObject is of different
> AV>> inheritance hierarchy thus missing that bit of code.
>
> AV>> Also made few minor fixes. Please see the patch.
>
>
>
> DP>>> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>> Hello Dave,
>>>>>
>>>>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>>>>
>>>>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>>>
>>>>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>>>>
>>>>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>>>>> I know that PgAdmin has the ability to find a pattern in various object
>>>>>>>>> names.
>>>>>>>>>
>>>>>>>>> Can PgAdmin search the actual text of procedures to find a pattern as well.
>>>>>>>>>
>>>>>>>>> For example, if I have a procedure named get_login, and it has a select
>>>>>>>>> that looks like
>>>>>>>>>
>>>>>>>>> ═ ═select person_id from logins ....
>>>>>>>>>
>>>>>>>>> and I search for "person_id", can PgAdmin find this within the get_login
>>>>>>>>> procedure?
>>>>>>>
>>>>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>>>>> GL> that.
>>>>>>>
>>>>>>> Suggested feature will be a must-have for pl-developers to find code
>>>>>>> dependencies not maintained by DBMS.
>>>>>>>
>>>>>>> Since searching pg_proc should be optional (right?), it's required to
>>>>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>>>>> (plans for the future) on improving this tool, some concerning
>>>>>>> dialogue design, I'd like to express these now altogether.
>>>>>>>
>>>>>>> 1. Make "search for pattern in object's names" one of few options,
>>>>>>> enabled by default. Others will be "search in definitions" and "search
>>>>>>> in comments". I see these as a number of checkboxes.
>>>>>>> Searching in object's definitions may be further advanced by
>>>>>>> considering constraint's expressions, column's defaults, type's fields
>>>>>>> and so on.
>>>>>>>
>>>>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>>>>> off objects in schemas of no interest. This is a combobox with items:
>>>>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>>>>> schemas in database.
>>>>>>>
>>>>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>>>>> Browser is selected, not only DB itself. Object trees are huge
>>>>>>> sometimes, so having to select DB item (and loose current object) each
>>>>>>> time I wish to search for something makes the tool unattractive at
>>>>>>> all. Required to implement (Current Schema) filter.
>>>>>>>
>>>>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>>>>
>>>>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>>>>> items".
>>>>>>>
>>>>>>> Devs, please see the sketch attached. Is this OK?
>>>>>>> I can work on this when I have time, if no one gets to this earlier.
>>>>>
>>>>> DP> Looks good to me. Thanks for looking at this.
>>>>>
>>>>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>>>>> only.
>>>>> I tried to make queries easier to extend with new object types with
>>>>> UNIONs. May be there is a better way to write them... well, afaic.
>>>>>
>>>>> Implemented all the points above plus use qtDbString() to process
>>>>> quote signs etc.
>>>>> But statusbar won't initialize for some reason. If I force it to
>>>>> initialize, it doesn't obey further window resizes. Is there a secret
>>>>> to make it work correctly? :)
>
>
>
>
>
> --
> Best regards,
>  J.F.
>
> --
> 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

Attachment

Re: PATCH: Search Objects by definitions and comments

From
"J.F. Oster"
Date:
Hello Dave,

Saturday, June 7, 2014, 5:15:21 PM, you wrote:

DP> I had a play with this, and ran into an issue. I have multiple tables
DP> that match the pattern %waits in my test DB, so figured that would be
DP> a good test. It successfully finds the tables, but also finds the row
DP> datatypes associated with them, which are not shown in the treeview at
DP> the moment because "Show system objects" is turned off. Clicking on a
DP> type entry in the results leads to some crazyness
DP> ...

The issue with regular table types was there before but had no
chance to reveal itself. I forgot to mention earlier that PgAdmin 1.18
doesn't search for Types at all.

wxT("   WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\_%'    ")
had to be double-escaped:
wxT("   WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\\\_%'          ");

I couldn't reproduce the case you described in whole it's crazyness :)
but hope that it would be an appropriate fix to filter out table types
when "Show system objects" is off.


DP> One final issue for this revision - the two combo boxes at the top do
DP> not have enough space to live in (on OSX at least - please see the
DP> attached screenshot). Please give them some more wiggle room :-)

Done, changed vgap from 3 to 5.

Please see the attached patch.


--

DP> On Sat, Jun 7, 2014 at 5:28 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>> Hello,
>>
>> Can someone review this patch, please?
>>
>>
>> Monday, May 5, 2014, 6:22:15 PM, J.F. Oster wrote:
>>
>> JFO> Hello Ashesh,
>> JFO> Have you had time to look into the patch?
>>
>> AV>> On Mon, Apr 7, 2014 at 10:47 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>> AV>> Hello Ashesh,
>>
>> AV>> Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:
>>
>> DP>>> Ashesh, can you or one of the team help J. F. figure out the status
>> DP>>> bar and review the patch please?
>>
>> DP>>> Thanks.
>>
>> AV>> Got status bar working by adding
>>
>> AV>> statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);
>>
>> AV>> to the constructor. That line exists in one of the parent's
>> AV>> constructor for most dialogs. dlgSearchObject is of different
>> AV>> inheritance hierarchy thus missing that bit of code.
>>
>> AV>> Also made few minor fixes. Please see the patch.
>>
>>
>>
>> DP>>> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>> Hello Dave,
>>>>>>
>>>>>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>>>>>
>>>>>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>>>>
>>>>>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>>>>>
>>>>>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>>>>>> I know that PgAdmin has the ability to find a
>>>>>>>>>> pattern in various object
>>>>>>>>>> names.
>>>>>>>>>>
>>>>>>>>>> Can PgAdmin search the actual text of
>>>>>>>>>> procedures to find a pattern as well.
>>>>>>>>>>
>>>>>>>>>> For example, if I have a procedure named
>>>>>>>>>> get_login, and it has a select
>>>>>>>>>> that looks like
>>>>>>>>>>
>>>>>>>>>> = =select person_id from logins ....
>>>>>>>>>>
>>>>>>>>>> and I search for "person_id", can PgAdmin find
>>>>>>>>>> this within the get_login
>>>>>>>>>> procedure?
>>>>>>>>
>>>>>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>>>>>> GL> that.
>>>>>>>>
>>>>>>>> Suggested feature will be a must-have for
>>>>>>>> pl-developers to find code
>>>>>>>> dependencies not maintained by DBMS.
>>>>>>>>
>>>>>>>> Since searching pg_proc should be optional
>>>>>>>> (right?), it's required to
>>>>>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>>>>>> (plans for the future) on improving this tool, some concerning
>>>>>>>> dialogue design, I'd like to express these now altogether.
>>>>>>>>
>>>>>>>> 1. Make "search for pattern in object's names" one of few options,
>>>>>>>> enabled by default. Others will be "search in definitions" and "search
>>>>>>>> in comments". I see these as a number of checkboxes.
>>>>>>>> Searching in object's definitions may be further advanced by
>>>>>>>> considering constraint's expressions, column's defaults, type's fields
>>>>>>>> and so on.
>>>>>>>>
>>>>>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>>>>>> off objects in schemas of no interest. This is a combobox with items:
>>>>>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>>>>>> schemas in database.
>>>>>>>>
>>>>>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>>>>>> Browser is selected, not only DB itself. Object trees are huge
>>>>>>>> sometimes, so having to select DB item (and loose current object) each
>>>>>>>> time I wish to search for something makes the tool unattractive at
>>>>>>>> all. Required to implement (Current Schema) filter.
>>>>>>>>
>>>>>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>>>>>
>>>>>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>>>>>> items".
>>>>>>>>
>>>>>>>> Devs, please see the sketch attached. Is this OK?
>>>>>>>> I can work on this when I have time, if no one gets to this earlier.
>>>>>>
>>>>>> DP> Looks good to me. Thanks for looking at this.
>>>>>>
>>>>>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>>>>>> only.
>>>>>> I tried to make queries easier to extend with new object types with
>>>>>> UNIONs. May be there is a better way to write them... well, afaic.
>>>>>>
>>>>>> Implemented all the points above plus use qtDbString() to process
>>>>>> quote signs etc.
>>>>>> But statusbar won't initialize for some reason. If I force it to
>>>>>> initialize, it doesn't obey further window resizes. Is there a secret
>>>>>> to make it work correctly? :)

--
Best regards,
 J.F.

Attachment

Re: PATCH: Search Objects by definitions and comments

From
Dave Page
Date:
Hi

Thanks, patch applied. Please note that the combo boxes are still not
displayed correctly on Mac. After spending some time trying to fix it,
I remembered that it's a known issue that wxWidgets seems to have that
my brain has learnt to ignore on the existing UI :-(. I've really
gotta knuckle down on pgAdmin4...

On Mon, Jun 9, 2014 at 4:32 PM, J.F. Oster <jinfroster@mail.ru> wrote:
> Hello Dave,
>
> Saturday, June 7, 2014, 5:15:21 PM, you wrote:
>
> DP> I had a play with this, and ran into an issue. I have multiple tables
> DP> that match the pattern %waits in my test DB, so figured that would be
> DP> a good test. It successfully finds the tables, but also finds the row
> DP> datatypes associated with them, which are not shown in the treeview at
> DP> the moment because "Show system objects" is turned off. Clicking on a
> DP> type entry in the results leads to some crazyness
> DP> ...
>
> The issue with regular table types was there before but had no
> chance to reveal itself. I forgot to mention earlier that PgAdmin 1.18
> doesn't search for Types at all.
>
> wxT("   WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\_%'    ")
> had to be double-escaped:
> wxT("   WHERE t.typtype != 'd' AND t.typname NOT LIKE E'\\\\_%'          ");
>
> I couldn't reproduce the case you described in whole it's crazyness :)
> but hope that it would be an appropriate fix to filter out table types
> when "Show system objects" is off.
>
>
> DP> One final issue for this revision - the two combo boxes at the top do
> DP> not have enough space to live in (on OSX at least - please see the
> DP> attached screenshot). Please give them some more wiggle room :-)
>
> Done, changed vgap from 3 to 5.
>
> Please see the attached patch.
>
>
> --
>
> DP> On Sat, Jun 7, 2014 at 5:28 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>> Hello,
>>>
>>> Can someone review this patch, please?
>>>
>>>
>>> Monday, May 5, 2014, 6:22:15 PM, J.F. Oster wrote:
>>>
>>> JFO> Hello Ashesh,
>>> JFO> Have you had time to look into the patch?
>>>
>>> AV>> On Mon, Apr 7, 2014 at 10:47 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>>> AV>> Hello Ashesh,
>>>
>>> AV>> Friday, April 4, 2014, 4:24:01 PM, Dave Page wrote:
>>>
>>> DP>>> Ashesh, can you or one of the team help J. F. figure out the status
>>> DP>>> bar and review the patch please?
>>>
>>> DP>>> Thanks.
>>>
>>> AV>> Got status bar working by adding
>>>
>>> AV>> statusBar = XRCCTRL(*this, "unkStatusBar", wxStatusBar);
>>>
>>> AV>> to the constructor. That line exists in one of the parent's
>>> AV>> constructor for most dialogs. dlgSearchObject is of different
>>> AV>> inheritance hierarchy thus missing that bit of code.
>>>
>>> AV>> Also made few minor fixes. Please see the patch.
>>>
>>>
>>>
>>> DP>>> On Fri, Apr 4, 2014 at 12:33 PM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>>> Hello Dave,
>>>>>>>
>>>>>>> Monday, March 10, 2014, 1:36:37 PM, you wrote:
>>>>>>>
>>>>>>> DP> On Sun, Mar 9, 2014 at 8:27 AM, J.F. Oster <jinfroster@mail.ru> wrote:
>>>>>>>>>
>>>>>>>>> Thursday, March 6, 2014, 12:38:33 AM, Guillaume Lelarge wrote:
>>>>>>>>>
>>>>>>>>> GL> On Wed, 2014-03-05 at 07:40 -0600, Michael Shapiro wrote:
>>>>>>>>>>> I know that PgAdmin has the ability to find a
>>>>>>>>>>> pattern in various object
>>>>>>>>>>> names.
>>>>>>>>>>>
>>>>>>>>>>> Can PgAdmin search the actual text of
>>>>>>>>>>> procedures to find a pattern as well.
>>>>>>>>>>>
>>>>>>>>>>> For example, if I have a procedure named
>>>>>>>>>>> get_login, and it has a select
>>>>>>>>>>> that looks like
>>>>>>>>>>>
>>>>>>>>>>> = =select person_id from logins ....
>>>>>>>>>>>
>>>>>>>>>>> and I search for "person_id", can PgAdmin find
>>>>>>>>>>> this within the get_login
>>>>>>>>>>> procedure?
>>>>>>>>>
>>>>>>>>> GL> Nope, it doesn't work like that. But a patch might help to get it do
>>>>>>>>> GL> that.
>>>>>>>>>
>>>>>>>>> Suggested feature will be a must-have for
>>>>>>>>> pl-developers to find code
>>>>>>>>> dependencies not maintained by DBMS.
>>>>>>>>>
>>>>>>>>> Since searching pg_proc should be optional
>>>>>>>>> (right?), it's required to
>>>>>>>>> modify Search Objects dialogue. And since I have some more thoughts
>>>>>>>>> (plans for the future) on improving this tool, some concerning
>>>>>>>>> dialogue design, I'd like to express these now altogether.
>>>>>>>>>
>>>>>>>>> 1. Make "search for pattern in object's names" one of few options,
>>>>>>>>> enabled by default. Others will be "search in definitions" and "search
>>>>>>>>> in comments". I see these as a number of checkboxes.
>>>>>>>>> Searching in object's definitions may be further advanced by
>>>>>>>>> considering constraint's expressions, column's defaults, type's fields
>>>>>>>>> and so on.
>>>>>>>>>
>>>>>>>>> 2. In addition to objects Type filter implement Schema filter to cut
>>>>>>>>> off objects in schemas of no interest. This is a combobox with items:
>>>>>>>>> (All Schemas), (Current Schema)*, (User Schemas) plus list of all
>>>>>>>>> schemas in database.
>>>>>>>>>
>>>>>>>>> 3. Allow to call Search Objects dialogue when any DB-object in Object
>>>>>>>>> Browser is selected, not only DB itself. Object trees are huge
>>>>>>>>> sometimes, so having to select DB item (and loose current object) each
>>>>>>>>> time I wish to search for something makes the tool unattractive at
>>>>>>>>> all. Required to implement (Current Schema) filter.
>>>>>>>>>
>>>>>>>>> 4. If text pattern contains "%" char then don't add %%'s to it.
>>>>>>>>>
>>>>>>>>> 5. Use statusbar: "Searching...", "Nothing was found" or "Found N
>>>>>>>>> items".
>>>>>>>>>
>>>>>>>>> Devs, please see the sketch attached. Is this OK?
>>>>>>>>> I can work on this when I have time, if no one gets to this earlier.
>>>>>>>
>>>>>>> DP> Looks good to me. Thanks for looking at this.
>>>>>>>
>>>>>>> Here it is. Seems to work for me, but needs testing. I tested on 9.3
>>>>>>> only.
>>>>>>> I tried to make queries easier to extend with new object types with
>>>>>>> UNIONs. May be there is a better way to write them... well, afaic.
>>>>>>>
>>>>>>> Implemented all the points above plus use qtDbString() to process
>>>>>>> quote signs etc.
>>>>>>> But statusbar won't initialize for some reason. If I force it to
>>>>>>> initialize, it doesn't obey further window resizes. Is there a secret
>>>>>>> to make it work correctly? :)
>
> --
> Best regards,
>  J.F.



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company