agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedA better way ?
2+ messages / 2 participants
[nested] [flat]
* A better way ?
@ 1994-05-16 02:36 Niranjan Perera <perera@pollux.cs.uga.edu>
0 siblings, 1 reply; 2+ messages in thread
From: Niranjan Perera @ 1994-05-16 02:36 UTC (permalink / raw)
To: legacy
Hi:
I have a class that keeps a list of classes. What I would like to know
is there an efficent way for me to find out if any new classes have been
created since I last accessed the database, by comparing against my class ?
I currently use..
retrieve ( pg_class.relname )
where pg_class.relname !~ "pg_" and pg_class.relname !~ "myclass"
store the results and then run each result against "myclass"
-- Niranjan
--
+----------------------------------------------------------------?------+
| Niranjan Perera, 415 GSRC Bldg,CS Dept, perera@cs.uga.edu ~~~ |
| University Of Georgia, Athens GA30602. (706)-548-5826 ( . . ) |
+-----------------------------------------------------------ooO-(_)-Ooo-+
===============================================================================
To add/remove yourself from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
===============================================================================
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: A better way ?
@ 1994-05-16 03:34 Paul M. Aoki <aoki@postgres.Berkeley.EDU>
parent: Niranjan Perera <perera@pollux.cs.uga.edu>
0 siblings, 0 replies; 2+ messages in thread
From: Paul M. Aoki @ 1994-05-16 03:34 UTC (permalink / raw)
To: Niranjan Perera <perera@pollux.cs.uga.edu>; +Cc: legacy
Niranjan Perera <perera@pollux.cs.uga.edu> writes:
> I have a class that keeps a list of classes. What I would like to know
> is there an efficent way for me to find out if any new classes have been
> created since I last accessed the database, by comparing against my class ?
if your actual goal is *this* part:
> is there an efficent way for me to find out if any new classes have been
> created since I last accessed the database
then here's a gross hack to do that:
retrieve (c.relname)
from c in pg_class, a in pg_attribute
where a.tmin > "May 10 1994"::abstime /* your last access time goes here. */
and a.attname = "oid" /* just because oid always exists. */
and c.oid = a.attrelid
\g
aren't time-domain addressable databases fun? if someone comes along
and modifies your oid attribute this doesn't work quite right, but if
they do that you probably have bigger problems.. (that's why i didn't
use pg_class.tmin -- pg_class tuples are modified every time you
vacuum.)
you might have to add some typecasts to make this work right with 4.1,
i don't know.
if you need "myclass" for other reasons, this probably does want you
want, too. this is probably what you're doing already:
retrieve into difftable (pg_class.relname)
where pg_class.relname !~ "pg_"
and pg_class.relname != "myclass"
\g
delete difftable
where difftable.relname = myclass.relname
\g
retrieve (difftable.relname)
\g
it's a pain but it should be efficient enough if you index
myclass.relname.
--
Paul M. Aoki | CS Div., Dept. of EECS, UCB | aoki@postgres.Berkeley.EDU
| Berkeley, CA 94720 | ...!uunet!ucbvax!aoki
===============================================================================
To add/remove yourself from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
===============================================================================
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1994-05-16 03:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1994-05-16 02:36 A better way ? Niranjan Perera <perera@pollux.cs.uga.edu>
1994-05-16 03:34 ` Paul M. Aoki <aoki@postgres.Berkeley.EDU>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox