* Alfred Perlstein <bright(at)wintelcom(dot)net> [000527 16:03] wrote:
> How is that possible? My only guess is that the rule is only being applied
> to the table _before_ the query, and if there actually are duplicate rows
> to be inserted the rule isn't catching them because the exists clause is
> only running on the snapshot of the table before the insert starts.
> is there a workaround or is this a possible bug?
Ok, this was my fault, it seems the rule system takes a snapshot of the
table at the start of a insert from select op and my rule wasn't catching
the rows that were inserted during the insert. (basically confirmed my
I found the duplicate row in my original table and once it was
removed the the inserts seem to work perfectly.
It would be nice to have an exception handler that could be executed
when an insert fails because of various reason, something like:
create rule update_instread_of_insert as on exception to mytable
where exception = violates_unique
do update ....
This would reduce the amount of searching because the insert rule only
happens when there is an exception instead of forcing an extra lookup
before each insert.
Anyhow, I can always wish. :)
-Alfred Perlstein - [bright(at)wintelcom(dot)net|alfred(at)freebsd(dot)org]
"I have the heart of a child; I keep it in a jar on my desk."
In response to
pgsql-hackers by date
|Next:||From: Hiroshi Inoue||Date: 2000-05-29 04:51:42|
|Subject: RE: Berkeley DB... |
|Previous:||From: Tom Lane||Date: 2000-05-29 04:12:49|
|Subject: Re: Probably already asked but |