> On 5/3/12 9:06 PM, Vineet Deodhar wrote: > > Isn't it dangerous to get a pkid from the db before commit? > > Consider a situation where UserA gets a pkid "2564' for a table "tbl1". > > Before this change is committed, UserB inserts a record to tbl1& gets > > "2564". > > > > Wouldn't is cause a mess? >
> > No, postgres knows it handed out 2564 already, even though it isn't > committed yet. > > Paul > > I see. In that case, it would lead to further trouble such as --> UserA, after getting pkid 2564 for tbl1, cancels the addition. So 5264 is unutilized. If the no. of users & data-traffic is quite low, no issue. But consider a case where hundreds of users are interacting with tbl1 and there are a lot of cases for cancelled additions to tbl1. In effect, even if the smallint data-type for this pkid is sufficient, the DBA has to opt for maybe mediumint ! Anyway, I am using MySQL and I am very much comfortable with it. -- Vineet > > Postgres can provide the PK from a record before it is committed. > > > > transaction > > begin > > insert record > > retrieve PK (I will assume that is a serial data type). > > insert record > > retrieve PK > > continue > > > > commit or rollback > > > > I realize that Dabo does not do it but I do it all the time with Dabo > temp > > cursors. > > > > Johnf > --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] 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/CAP5=7op_tpJLE-8hFsD9Ubdk24gZb+gFNTwTxg=j_zb7fly...@mail.gmail.com
