On Thu, 23 Jun 2005 19:47:16 +0200, hubert depesz lubaczewski wrote:

> nexus wyrzeiĄ¦(a):
>> Does anyone know how to get the oid using the DBI library? Could it be
>> done with .func() calls? 
> 
> would you be kind enough to tell us why do you think you need oids?
> usage of oids is deprecated and dangerous. and since they're not unique
> i frankly see no point in getting them.
> 
> depesz

You are absolutely correct and raise a valid point: When you want to find
the generated primary key value from a sequence column, the correct method
is to select nextval from the sequence then insert the key yourself.

However, for quick and dirty one time imports (ie. from a CSV) into a new
table, you can safely use the OID as a unique row reference provided you
are not inserting more than 4 billion rows into the new table. Its a dirty
hack but since the oid is returned as part of the insert query, you cut
your queries in half and use less code. Our data import routines are
always one offs so I'm just looking for the simplest/quickest way to get
the data imported.