Thread: Re: query builder / system objects

Re: query builder / system objects

From
"Dave Page"
Date:
Hi Keith,

This raises a point I'd not thought of before. In pgAdmin II we load all
object, system or not into pgSchema. We then just display whatever is
required. This allows us to use pgSchema as a cache for future queries -
ie. When we look for all functions in the CREATE OPERATOR dialogue, we
just load everything from the Functions collection.

In pgAdmin III, the hierarchy is built on the treeview, so how do we
cache everything in the same way?

I have to be honest, I haven't thought about any of this for a while now
'cos I've been too busy, but I might have some time in the next couple
of weeks.

Anyway, to answer your question, in pgSchema we say (attnum < 1) =
System. To check for views and tables, well this is easy now - if they
are in the pg_catalog, pg_temp or pg_temp_* schemas, then they are
system object. pgAdmin III is being written for 7.3+, so we know schemas
will always exist.

Regards, Dave.

> -----Original Message-----
> From: efesar [mailto:efesar@nmia.com]
> Sent: 04 March 2003 00:19
> To: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] query builder / system objects
>
>
> correction
>
> relowner > 1 instead of >=1
>
>     // We need to know if we're going to show system objects
>     wxString sysobjstr;
>     if (!settings->GetShowSystemObjects())
>         sysobjstr = " AND relowner > 1 ";
>
> -----Original Message-----
> From: efesar [mailto:efesar@nmia.com]
> Sent: Monday, March 03, 2003 5:18 PM
> To: pgadmin-hackers
> Subject: query builder / system objects
>
>
>
> dave,
>
> pga3 question
>
> i can tell system columns easily (and hopefully correctly):
>
>     // We need to know if we're going to show system objects
>     wxString sysobjstr;
>     if (!settings->GetShowSystemObjects())
>         sysobjstr = " WHERE attnum >= 0 ";
>
> but is this an adequate way to check for system tables/views?
> this is what i'm using now.
>
>     // We need to know if we're going to show system objects
>     wxString sysobjstr;
>     if (!settings->GetShowSystemObjects())
>         sysobjstr = " AND relowner >= 1 ";
>
> the other way i was going to do it was if the first three
> letters are "PG_" but maybe you have a more correct way of doing this.
>
> -keith
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>

Re: query builder / system objects

From
efesar
Date:
sorry, forgot to hit reply to all...

=====

dave,

thanks for the advice. in other news, i've got a pretty hefty update coming
your way.

i've got a rudimentary query builder fully functional. it's got a lot of
work yet to come, but i want you to see the executable and tell me what you
think. i think it's really cool so far and would like some feedback.

a zipped exec is about 1 meg. let me know if you want that emailed to you
... i prefer not to email it to the list since it is quite large.

after you see the exec, and if you like where i'm going with the query
builder, i can make a patch. i've made a lot of code changes. mostly i added
several classes, but i found some bugs that i tweaked in the main code ...
the only reason i changed them is because i needed the functionality for my
component. also, i added some system settings functions and what not to
store the query builder size and position. etc ad nauseum.

let me know. thanks again.

ps as for the cache ... i'll think on it. i really hadn't even given cache
much thought, i'm just running raw queries. i know, that's probably bad. :)

-keith

-----Original Message-----
From: Dave Page [mailto:dpage@vale-housing.co.uk]
Sent: Tuesday, March 04, 2003 1:56 AM
To: efesar; pgadmin-hackers
Subject: RE: [pgadmin-hackers] query builder / system objects


Hi Keith,

This raises a point I'd not thought of before. In pgAdmin II we load all
object, system or not into pgSchema. We then just display whatever is
required. This allows us to use pgSchema as a cache for future queries -
ie. When we look for all functions in the CREATE OPERATOR dialogue, we
just load everything from the Functions collection.

In pgAdmin III, the hierarchy is built on the treeview, so how do we
cache everything in the same way?

I have to be honest, I haven't thought about any of this for a while now
'cos I've been too busy, but I might have some time in the next couple
of weeks.

Anyway, to answer your question, in pgSchema we say (attnum < 1) =
System. To check for views and tables, well this is easy now - if they
are in the pg_catalog, pg_temp or pg_temp_* schemas, then they are
system object. pgAdmin III is being written for 7.3+, so we know schemas
will always exist.

Regards, Dave.

> -----Original Message-----
> From: efesar [mailto:efesar@nmia.com]
> Sent: 04 March 2003 00:19
> To: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] query builder / system objects
>
>
> correction
>
> relowner > 1 instead of >=1
>
>     // We need to know if we're going to show system objects
>     wxString sysobjstr;
>     if (!settings->GetShowSystemObjects())
>         sysobjstr = " AND relowner > 1 ";
>
> -----Original Message-----
> From: efesar [mailto:efesar@nmia.com]
> Sent: Monday, March 03, 2003 5:18 PM
> To: pgadmin-hackers
> Subject: query builder / system objects
>
>
>
> dave,
>
> pga3 question
>
> i can tell system columns easily (and hopefully correctly):
>
>     // We need to know if we're going to show system objects
>     wxString sysobjstr;
>     if (!settings->GetShowSystemObjects())
>         sysobjstr = " WHERE attnum >= 0 ";
>
> but is this an adequate way to check for system tables/views?
> this is what i'm using now.
>
>     // We need to know if we're going to show system objects
>     wxString sysobjstr;
>     if (!settings->GetShowSystemObjects())
>         sysobjstr = " AND relowner >= 1 ";
>
> the other way i was going to do it was if the first three
> letters are "PG_" but maybe you have a more correct way of doing this.
>
> -keith
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>



Re: query builder / system objects

From
"Dave Page"
Date:

> -----Original Message-----
> From: efesar [mailto:efesar@nmia.com]
> Sent: 04 March 2003 10:46
> To: pgadmin-hackers
> Subject: Re: [pgadmin-hackers] query builder / system objects
>
>
> sorry, forgot to hit reply to all...
>
> =====
>
> dave,
>
> thanks for the advice. in other news, i've got a pretty hefty
> update coming your way.
>
> i've got a rudimentary query builder fully functional. it's
> got a lot of work yet to come, but i want you to see the
> executable and tell me what you think. i think it's really
> cool so far and would like some feedback.
>
> a zipped exec is about 1 meg. let me know if you want that
> emailed to you ... i prefer not to email it to the list since
> it is quite large.

Excellent - yes, I would love to see it.

> after you see the exec, and if you like where i'm going with
> the query builder, i can make a patch. i've made a lot of
> code changes. mostly i added several classes, but i found
> some bugs that i tweaked in the main code ... the only reason
> i changed them is because i needed the functionality for my
> component. also, i added some system settings functions and
> what not to store the query builder size and position. etc ad nauseum.

Sounds good.

> let me know. thanks again.
>
> ps as for the cache ... i'll think on it. i really hadn't
> even given cache much thought, i'm just running raw queries.
> i know, that's probably bad. :)

<cringe>!! That's how pgAdmin I used to do it veeerrrryyy
ssssslllooowwwllyyy :-)

The idea with pgAdmin II was that everything was accessed through
pgSchema. It built it's own object hierarchy upon first access of any
collection within it, so if you need to list all functions, if they were
already there, no additional database communications were required. The
idea in pgAdmin III was that this was all done through the treeview
(because each object is attached to the appropriate node), which again
is built upon demand. Thinking about it though, I'm not sure if that
will work anyway, for example, what if the first access to a branch of
the hierarchy is not made by the user...

Hmm. Needs some thought.

Regards, Dave.