Re: Automatic rollback on error, duplicate key?
Gerhard Häring <[email protected]>
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Organization | People's Front of Judea |
| Message-ID | <[email protected]> |
* Bob Kimble <bob-ECzipMoozfpWk0Htik3J/[email protected]> [2002-11-12 00:21 -0500]: > Perhaps you could use a rule to achieve what you want. You could create a > clone of table 2 augmented with a rule that checks to see if the row you just > inserted into the clone exists already in table 2. [...] Well, no need for a separate table: CREATE RULE RUL_MYTABLE_INS AS ON INSERT TO MYTABLE WHERE NEW.MYUNIQUECOLUMN IN ( SELECT MYUNIQUECOLUMN FROM MYTABLE) DO INSTEAD NOTHING; -- Gerhard ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf