Thread

  1. How do I find the table that an oid belongs to

    Roland Roberts <roberts@panix.com> — 1998-08-06T04:07:03Z

    I'm trying to get Keystone (http://www.stonekeep.com/) to work and
    have to emulate some MySQL functions.  One of these is the ability to
    return the value of a column that is an auto-increment column after a
    row was inserted, updated, or deleted.  The interface I have to work
    with is PHP.  PHP has a function, pg_getlastoid, that lets me find the
    oid of the last insert, update, or delete.  I've looked at psql.c to
    find out how to get the column attributes so I can figure out which
    one(s) are auto increment (or rather, which ones are coming from a
    sequence definition via "default nextval ('seqname')").
    
    What I can't figure out is, given an oid, how can I figure out what
    table it belongs to?
    
    roland
    -- 
    Roland B. Roberts, PhD                  Custom Software Solutions
    roberts@panix.com                           101 West 15th St #4NN
                                                   New York, NY 10011