Return-Path: owner-postman Delivery-Date: Sun, 15 May 94 22:51:19 -0700 Return-Path: owner-postman Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id UAA06160 for postgres-redist; Sun, 15 May 1994 20:34:18 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199405160334.UAA06160@nobozo.CS.Berkeley.EDU> Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from faerie.CS.Berkeley.EDU (faerie.CS.Berkeley.EDU [128.32.149.14]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id UAA06150 for ; Sun, 15 May 1994 20:34:17 -0700 Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.4/8.1B) with SMTP id UAA21274; Sun, 15 May 1994 20:34:13 -0700 Message-Id: <199405160334.UAA21274@faerie.CS.Berkeley.EDU> X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost didn't use HELO protocol From: aoki@postgres.Berkeley.EDU (Paul M. Aoki) To: Niranjan Perera Cc: postgres@postgres.Berkeley.EDU Subject: Re: A better way ? Reply-To: aoki@postgres.Berkeley.EDU (Paul M. Aoki) In-reply-to: Your message of Sun, 15 May 1994 22:36:45 -0400 (EDT) <9405160236.AA04523@pollux.cs.uga.edu> Date: Sun, 15 May 94 20:34:13 -0700 X-Sender: aoki@postgres.Berkeley.EDU Resent-To: postgres-redist@postgres.Berkeley.EDU X-Mts: smtp Resent-Date: Sun, 15 May 94 20:34:18 -0700 Resent-XMts: smtp Niranjan Perera 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. ===============================================================================