agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Aaron Roydhouse <Aaron.Roydhouse@Comp.VUW.AC.NZ>
To: postgres@postgres.Berkeley.EDU
Subject: Discovering the class from an object identifier
Date: Thu, 12 May 1994 10:59:43 +1200
Message-ID: <199405112259.KAA04148@downstage.comp.vuw.ac.nz> (raw)

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 "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.
===============================================================================




reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: Aaron.Roydhouse@Comp.VUW.AC.NZ
  Subject: Re: Discovering the class from an object identifier
  In-Reply-To: <199405112259.KAA04148@downstage.comp.vuw.ac.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox