Re: Primary Key Violation Checking
Rich Shepard <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 29 Oct 2007, Adrian Klaver wrote: > Now that the caffeine has kicked in on this end I had a change of mind. > You might want to use INSERT OR REPLACE all the time. It would eliminate > the error condition by removing preexisting rows that share the UNIQUE > constraint. I did this in many functions, but not all. Probably thinking that when a new entity is added there won't be a conflict with an existing one. > The problem being you might not want those rows deleted automatically. > Also rows removed in this manner do not call any delete triggers that may > be present. Good to know. This situation has arisen a couple of times when adding new entities so I'm not sure just what's going on or how to try to produce that error condition on demand. Thanks very much for your comments, Rich -- Richard B. Shepard, Ph.D. | The Environmental Permitting Applied Ecosystem Services, Inc. | Accelerators(TM) <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863