Re: [HACKERS] [GENERAL] Using oids

2003-09-04 Thread Bo Lorentsen
On Wed, 2003-09-03 at 17:28, Martijn van Oosterhout wrote: > If you know the OID of a row, PostgreSQL doesn't have a special lookup table > to find it. That's also why they're not unique; the backend would have to > scan through every table to find out if the next one is available. Ahh, thats not

Re: [HACKERS] [GENERAL] Using oids

2003-09-04 Thread Bo Lorentsen
On Wed, 2003-09-03 at 13:19, Martijn van Oosterhout wrote: > But your insert function needs to know something about the table it's > inserting into. The sequences have quite predicatable names. Besides, you > can set the name yourself (DCL does this IIRC). No it don't know anything about the table

Re: [HACKERS] [GENERAL] Using oids

2003-09-04 Thread Jonathan Bartlett
> 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 :-)

Re: [HACKERS] [GENERAL] Using oids

2003-09-04 Thread Bo Lorentsen
On Wed, 2003-09-03 at 11:38, Shridhar Daithankar wrote: > Well, what I do is, declare a serate sequence, retrive next available value and > explicitly insert it into a integer field. That avoids having to retrieve the > latest value again. Yeps, this is what I call an application specific implim

Re: [HACKERS] [GENERAL] Using oids

2003-09-03 Thread Ashley Cambrell
> That said, there is no reason why someone couldn't create a last_sequence() > function so you could say SELECT currval( last_sequence() ). Ofcourse, if > your table has no SERIAL field, you're stuffed either way. Instead of SELECT currval( last_sequence() ), what about implementing oracl type b

Re: [HACKERS] [GENERAL] Using oids

2003-09-03 Thread Martijn van Oosterhout
On Wed, Sep 03, 2003 at 01:47:01PM +0200, Bo Lorentsen wrote: > On Wed, 2003-09-03 at 13:19, Martijn van Oosterhout wrote: > > The only thing you need to know is the name of the primary key field. This > > many be a problem in a generic layer. If you like you can make a UNIQUE > > INDEX on the oid

Re: [HACKERS] [GENERAL] Using oids

2003-09-03 Thread Martijn van Oosterhout
On Wed, Sep 03, 2003 at 12:20:42PM +0200, Bo Lorentsen wrote: > On Wed, 2003-09-03 at 11:38, Shridhar Daithankar wrote: > > > Well, what I do is, declare a serate sequence, retrive next available value and > > explicitly insert it into a integer field. That avoids having to retrieve the > > late

Re: [HACKERS] [GENERAL] Using oids

2003-09-03 Thread Shridhar Daithankar
On 3 Sep 2003 at 11:28, Bo Lorentsen wrote: > On Wed, 2003-09-03 at 11:10, Shridhar Daithankar wrote: > > > Yes. It is correct. As of 7.3.x and onwards oids are optional at table creation > > times. They default to be available for new objects but that is for backwards > > compatibility I belie