Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #844 > unrolled thread
| Started by | lboc80@gmail.com |
|---|---|
| First post | 2018-10-05 09:44 -0700 |
| Last post | 2018-10-06 13:17 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.databases.postgresql
issue with UPDATE lboc80@gmail.com - 2018-10-05 09:44 -0700
Re: issue with UPDATE Robert Klemme <shortcutter@googlemail.com> - 2018-10-06 13:17 +0200
| From | lboc80@gmail.com |
|---|---|
| Date | 2018-10-05 09:44 -0700 |
| Subject | issue with UPDATE |
| Message-ID | <9b72e44b-fa9b-47cf-8cf2-668f047fbc53@googlegroups.com> |
I'm stuck with an UPDATE, probably I'm messing something up:
the amount of rows in the '`proj_los`' table expected to be updated are 32, but only 8 get updated, unless I add an AND condition.
select count(*) from import.tmp_kk where root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e';
> 32
1) correct result -> using last AND clause (`root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e'`)
sql> update
proj_los as oko
set lo_root_id = import.tmp_kk.root_id
from import.tmp_kk
where oko.lo_id = import.tmp_kk.lo_id
and import.tmp_kk.root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e'
[2018-10-05 18:13:59] 32 rows affected in 50 ms
select count(*) from proj_los where lo_root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e';
> 32
2) wrong result
sql> update
proj_los as oko
set lo_root_id = import.tmp_kk.root_id
from import.tmp_kk
where oko.lo_id = import.tmp_kk.lo_id;
[2018-10-05 18:17:31] 174202 rows affected in 17 s 427 ms
select count(*) from proj_los where lo_root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e';
> 8
Any help on this?
[toc] | [next] | [standalone]
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Date | 2018-10-06 13:17 +0200 |
| Message-ID | <g1rjumF8qufU1@mid.individual.net> |
| In reply to | #844 |
On 05.10.2018 18:44, lboc80@gmail.com wrote: > I'm stuck with an UPDATE, probably I'm messing something up: > > > the amount of rows in the '`proj_los`' table expected to be updated are 32, but only 8 get updated, No, 174202 get updated. > unless I add an AND condition. > > select count(*) from import.tmp_kk where root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e'; > > 32 > > > > > 1) correct result -> using last AND clause (`root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e'`) > > > sql> update > proj_los as oko > set lo_root_id = import.tmp_kk.root_id > from import.tmp_kk > where oko.lo_id = import.tmp_kk.lo_id > and import.tmp_kk.root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e' > [2018-10-05 18:13:59] 32 rows affected in 50 ms > > > select count(*) from proj_los where lo_root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e'; > > > 32 > > > > > 2) wrong result > > sql> update > proj_los as oko > set lo_root_id = import.tmp_kk.root_id > from import.tmp_kk > where oko.lo_id = import.tmp_kk.lo_id; > [2018-10-05 18:17:31] 174202 rows affected in 17 s 427 ms > > select count(*) from proj_los where lo_root_id = '57b2e67b-5862-499a-a471-0f2f6b23440e'; > > > 8 > > Any help on this? > -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.postgresql
csiph-web