Subject: Discovering the class from an object identifier

From: Aaron Roydhouse <[email-masked]>
Date: Thu, 12 May 1994 10:59:43 +1200

I'm not sure how to approach this problem, maybe I'm hoping for too
much.

Given the oid of an instance, how can I discover the most specific
class the instance belongs to? 

Alternatively, how can I retrieve an instance identified by an oid,
which knowing the classes it belongs to?

Consider this toy example...

* create EMP (name = text, salary = int4,
            age = int4, dept = char16)
\g

Query sent to backend is "create EMP (name = text, salary = int4,             age = int4, dept = char16) "
CREATE
Go 
* append EMP (name = "Claire", salary = 2000,
              age = 40, dept = "shoe")
\g

Query sent to backend is "append EMP (name = "Claire", salary = 2000,               age = 40, dept = "shoe") "
APPEND 656830
Go 
* create STUD_EMP (location = point) inherits (EMP)
\g

Query sent to backend is "create STUD_EMP (location = point) inherits (EMP) "
CREATE
Go 
* append STUD_EMP (name = "Sunita", salary = 4000,
                   age = 23, dept = "electronics",
                   location = "(3, 5)")
\g

Query sent to backend is "append STUD_EMP (name = "Sunita", salary = 4000,                    age = 23, dept = "electronics",                    location = "(3, 5)") "
APPEND 656908
Go 

So given "656908"::oid how can I detemine whether it identifies a
STUD_EMP or just an EMP?

I've obviously trying to avoid querying every class in hope.

Aaron.

===============================================================================
    To add/remove yourself from the POSTGRES mailing list: send mail with 
    the subject line ADD or DEL to "[email-masked]"

    If this fails, send mail to "[email-masked]" and
    a human will deal with it.  DO NOT post to the "postgres" mailing list.
===============================================================================

---

From: [email-masked] (Paul M. Aoki)
Date: Wed, 11 May 94 19:16:16 -0700

> I've obviously trying to avoid querying every class in hope.

the commercial derivative of postgres splits oids into a class
identifier and an instance identifier, but postgres itself just
assigned oids sequentially in a given database.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki