Re: [HACKERS] Unique index: update error

2006-09-18 Thread Tom Lane
"Golden Liu" <[EMAIL PROTECTED]> writes: > ... The first update DOES insert index entries into unique_key's index. Right, but weren't you proposing to make it not do so? regards, tom lane ---(end of broadcast)--- TIP 9: In v

Re: [HACKERS] Unique index: update error

2006-09-18 Thread Golden Liu
On 9/18/06, Tom Lane <[EMAIL PROTECTED]> wrote: Jim Nasby <[EMAIL PROTECTED]> writes: > On Sep 14, 2006, at 9:16 PM, Golden Liu wrote: >> I try to solve this problem this way: >> First, update the table t but DON'T update the index. >> Next, find all the tuples updated by this command and insert

Re: [HACKERS] Unique index: update error

2006-09-18 Thread Simon Riggs
On Fri, 2006-09-15 at 09:16 +0800, Golden Liu wrote: > this problem I'm sorry but I don't see any problem. Why would you want to issue that kind of SQL statement? Assuming you really do, why not just DELETE/re-INSERT ? -- Simon Riggs EnterpriseDB http://www.enterprisedb.com

Re: [HACKERS] Unique index: update error

2006-09-17 Thread Tom Lane
Jim Nasby <[EMAIL PROTECTED]> writes: > On Sep 14, 2006, at 9:16 PM, Golden Liu wrote: >> I try to solve this problem this way: >> First, update the table t but DON'T update the index. >> Next, find all the tuples updated by this command and insert them into >> the unique index. > I suspect that y

Re: [HACKERS] Unique index: update error

2006-09-17 Thread Jim Nasby
On Sep 14, 2006, at 9:16 PM, Golden Liu wrote: Suppose there are too tuples in a table t, named id --- 1 2 and there is a unique index on id. Now we do an update on table t update t set id=id+1 Since PG executes the update one tuple at a time, it updates tuple "1" to "2" and insert it into the

[HACKERS] Unique index: update error

2006-09-14 Thread Golden Liu
Suppose there are too tuples in a table t, named id --- 1 2 and there is a unique index on id. Now we do an update on table t update t set id=id+1 Since PG executes the update one tuple at a time, it updates tuple "1" to "2" and insert it into the index. Before insert into the index, it check wh