Re: triggers, rowid, & SP's
Posted in 1995
kerry@kcbbs.gen.nz (Kerry Sainsbury) wrote: >> >I want to either insert this rowid in a physical column in another >> >table or pass it as a parameter to a stored procedure. >NO NO NO NO NO!! (Get the hint?) >You really do NOT want to do this. You want to store the unique key of >the first table in the second table. Rowids should NOT used as foreign >keys! >Consider this: You get nasty corruption in Table A and have to unload all >your data, recreate the table, and load it again... All your rowids have >now changed. Table B's pointers to Table A rowids are now worthless! >And in Version 7 rowids become unique only within dbspaces (or something >I'm not an 'Online' guru) and so you can have DUPLICATE ROWIDS IN A TABLE. Kiwi Solidarity on this one. The rowid in Online is constructed from the page number/slot number combination, so if you are using fragmented tables they cannot be guaranteed unique. It is possible to create an under-the-covers serial column on a fragmented table that serves the purpose of ROWID. but using rowids in applications is still not recommended by Informix and they reserve the right to make changes in how they operate at any time, IE rowids are used by the *system* programmers at Informix to *run* the RDBMS and do not form part of the *application* programmers interface to *use* the RDBMS. Even without this factor the reasons Kerry mentions are compelling. Peter Tashkoff Auckland, New Zealand e-mail ptash@iconz.co.nz