Rowid inside a trigger
Posted in 1997
Topics: Installation, Setup & Upgrades, Security, Permissions & Auditing, Triggers, Constraints & Referential Integrity
First off, I know that using the rowid as a primary key is frowned upon and is not considered a good idea by most. So please, I beg you, don't respond and say "Don't do this. It's bad.". I know that. However, we have a complex system in the field where data is being blown away in certain columns, and I am tasked with finding where and when it is happening. I've implemented a trigger to audit changes to the table with the problem and would like to pass the rowid to the trigger and log this along with the data change to the audit table. The system as it exists today was not designed very well in terms of using Informix as a relationional database, and there is nothing analogous to the row id in our table that I can use to uniquely identify a row and link corresponding audit table rows to. I can address this for the future releases, but for the existing installations that I can't change short term, is there ANY way I can get the rowid to the trigger? I've tried pre.rowid, post.rowid, rowid, and tablename.rowid and I get the error that rowid can't be found in any table in the query. If it matters, this is under Informix-SE v7.1. I think I'm asking the impossible, but I'm hoping there's SOME way to do this! Thanks, Eric