[Nitro] question about postgresql.rb && last_insert_id and insert_sql
reid.thompson at ateb.com
Tue Oct 24 23:11:19 EDT 2006
Jonathan Buch wrote:
>> could someone explain to me the reasoning behind the following code in
>> postgresql.rb. If the klass.primary_key is a sequence, there is no need
>> to explicitly set the primary key value in PostgreSQL, PG will
>> automatically do it. You can do this by either not passing a value for
>> that column, or by passing default or DEFAULT. This would make
>> insert_sql a less costly call. What am I missing that requires the code
>> to be written as it currently is??
> The problem is, that the frontend (Og) has to know the oid which has
> been inserted.
Why does the frontend need to know which oid has been inserted?
When I think of an activity that requires insertion ( the creation of a
new record in the DB ), I think in terms that all actions that need to
be performed on the object are performed prior to .create .save, etc.
I.E. at the point that I insert into the DB, that is the last action I
expect to take on that object. If I need to alter the record after it's
created, then I expect to have to query for it first.
More information about the Nitro-general