From: | Jonathan Bartlett <johnnyb(at)eskimo(dot)com> |
---|---|
To: | Bo Lorentsen <bl(at)netgroup(dot)dk> |
Cc: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, <shridhar_daithankar(at)persistent(dot)co(dot)in>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Using oids |
Date: | 2003-09-03 20:03:10 |
Message-ID: | Pine.GSU.4.44.0309031300270.23907-100000@eskimo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
> No it don't know anything about the table it insert into. I simply do
> the following :
>
> 1. INSERT data (comming from another layer)
> 2. Get the last oid
> 3. SELECT * FROM the same table where oid = what I just found.
>
> I know absolutly nothing about the table, and I like it this way :-)
The way I do it is to have a global sequence called 'objects' that spits
out 64-bit values, and then EVERY TABLE has a 64-bit field called
object_id, which defaults to nextval('objects') if I don't specify it.
So, on every table no matter what, I could do:
1. select nextval('objects');
2. INSERT data (comming from another layer, but set object_id to the
value I got in #1)
3. SELECT * FROM the same table where oid = what I just selected in #1
Jon
From | Date | Subject | |
---|---|---|---|
Next Message | Bo Lorentsen | 2003-09-03 20:08:47 | Re: Using oids |
Previous Message | Jonathan Bartlett | 2003-09-03 19:58:30 | Re: Using oids |
From | Date | Subject | |
---|---|---|---|
Next Message | ohp | 2003-09-03 20:05:33 | Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...) |
Previous Message | Dann Corbit | 2003-09-03 20:00:01 | Re: Win32 native port |