On Mar 2, 2010, at 7:44 PM, John wrote:

> Even with a PK, the way  the dbPostgres->getLastInsertID()  works does not 
> find the field associated with the PK.  Which makes sense - sort of. 
> But you work with Postgres daily - is there a way to determine the primary PK 
> in a view?  

        First, we don't generally use views, and the ones we have used have 
been temp views.

        Secondly, views are not supposed to be updatable. From the PostgreSQL 
docs:

"Currently, views are read only: the system will not allow an insert, update, 
or delete on a view. You can get the effect of an updatable view by creating 
rules that rewrite inserts, etc. on the view into appropriate actions on other 
tables. For more information see CREATE RULE."

        In other words, you have to write code to handle this on the server; 
some of the samples I've seen simply handle the insert into the underlying 
tables, but don't change the view. You would have to refresh the view to get 
the new record along with any other PK value.


-- Ed Leafe



_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/4fcc0618-a9b8-4cb9-beb9-4601090f7...@leafe.com

Reply via email to