Discussion - Search Objects

From: Jasmin Dizdarevic <jasmin(dot)dizdarevic(at)gmail(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Discussion - Search Objects
Date: 2011-05-31 23:05:42
Message-ID: BANLkTimeYLno6QfVTNnZ=w7yR4fBkjTGWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

To better get into the code I've decided to implement a feature from the
todo list: "Ability to search a database for objects with a specific name"
Now I have a first result, which I like to discuss with you.

1. The search is done with this query
select * from (
select 'TABLE' as type, table_name as objectname, table_schema as path from
information_schema.views
union
select 'VIEW' as type, table_name, table_schema from
information_schema.views
union
select 'COLUMN', column_name, table_schema ||'.'||table_name from
information_schema.columns
union
select 'TRIGGER', trigger_name, event_object_schema||'.'||event_object_table
from information_schema.triggers
union
select 'FUNCTION', routine_name, specific_schema from
information_schema.routines
union
select 'SCHEMA', schema_name, '' from information_schema.schemata
union
select 'SEQUENCE', sequence_name, sequence_schema from
information_schema.sequences
union
select 'FSERVER', foreign_server_name, '' from
information_schema.foreign_servers
union
select 'FDW', foreign_data_wrapper_name, '' from
information_schema.foreign_data_wrappers
) i
where lower(objectname) like '%PATTERN%'
order by 1,2

2. I've attached the menu item to the database node

see searchobject1.png

3. The search result output is written to a wxListCtrl

see searchobject2.png

Great would be when someone clicks on the search result the object is
selected in the tree. Is there a method in the tree class which I could use
for it? It might be complex to implement because of lazy loading of the
objects.

Any further ideas?

Regards,
Jasmin

Attachment Content-Type Size
image/png 12.4 KB
image/png 36.2 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2011-06-01 06:06:05 Re: Discussion - Search Objects
Previous Message Dave Page 2011-05-31 16:51:12 Re: pgAdmin III - Default server info from postgres-reg.ini not getting picked up