From: | Richi Plana <richip(at)copycat(dot)mozcom(dot)com> |
---|---|
To: | Karl DeBisschop <kdebisschop(at)spaceheater(dot)infoplease(dot)com> |
Cc: | richip(at)mozcom(dot)com, pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] Questions regarding OID |
Date: | 1999-06-26 04:06:47 |
Message-ID: | Pine.LNX.4.10.9906261158280.12924-100000@jaguar.mozcom.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
On Fri, 25 Jun 1999, Karl DeBisschop wrote:
|o| > 3) How does one INSERT data in a table with an oid field? (what does one
|o| > put in the VALUES () entry assigned to the OID?)
|o|
|o| We've never tried to INSERT with a predetermined OID, and I'm
|o| pretty sure it would break things if you tried. What happens is
|o| that a free OID is assigned, which you can then look up. The last
|o| OID assigned is generally shown by psql. PHP and perl's DBD::Pg
|o| provide methods for accessing the last OID after an INSERT. You
|o| can then write this value into another table.
I'm sorry. What I meant was, given a the ff. definition of a table:
CREATE TABLE foo
(
id oid,
...
);
how does one INSERT data into that table? Should I do
INSERT INTO foo VALUES (???, ...);
|o| > 4) What happens if you CREATE a table with more than one field with oids?
|o|
|o| Let's be precise here. There is an OID for each row in the
|o| database, but there is also an oid datatype. By definition, you
|o| cannot have more than one OID for a given row. But you may have
|o| an arbitrary number of fields in a table that have oid types.
|o| These fields would typically point to other rows in other tables.
I think I seem to have misunderstood OIDs. So there's an oid datatype, and
there's an associated OID for every record. Hmmm ... dunno how that helps
me. What I really want is simple: I wish to assign a unique ID for each
record. I was hoping OIDs would by my solution because otherwise I'd have
to use a numeric idea increasing each by one for every INSERT. That would
require that I look for the MAX() ID value and increment that before
INSERTing. Then there's the problem of DELETEing records which would leave
blanks in my ID sequence.
I just assumed that by adding an oid datatype, it'd be assigned a unique
idea at every INSERT.
So is the OID guaranteed to never change?
|o| You're welcome. But remeber, this is a rather limited sort of
|o| help.
Well, this is the best explanation I've seen so far. Thank you again.
L L Richi Plana 8^) ,-,-. ,-,-. ,-,-. ,-,-. ,-
LL LL Systems Administrator / / \ \ / / \ \ / / \ \ / / \ \ / /
LLLLL Mosaic Communications, Inc. \ \ / / \ \ / / \ \ / / \ \ / /
LLLLL mailto:richip(at)mozcom(dot)com `-'-' `-'-' `-'-' `-'-'
From | Date | Subject | |
---|---|---|---|
Next Message | John M. Flinchbaugh | 1999-06-26 04:35:45 | Re: [GENERAL] Definitive list of new types in 6.5 needed |
Previous Message | Hub.Org News Admin | 1999-06-26 02:22:29 |