X-Received: by 2002:ac8:520c:: with SMTP id r12-v6mr9055171qtn.9.1538757849759; Fri, 05 Oct 2018 09:44:09 -0700 (PDT) X-Received: by 2002:a25:1c83:: with SMTP id c125-v6mr132810ybc.6.1538757849596; Fri, 05 Oct 2018 09:44:09 -0700 (PDT) Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!m93-v6no1081009qte.0!news-out.google.com!k67-v6ni2999qte.1!nntp.google.com!m93-v6no1081003qte.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.databases.postgresql Date: Fri, 5 Oct 2018 09:44:09 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.32.231.195; posting-account=XtDTcwoAAACYpD2f1s_pcwYJw55Tbths NNTP-Posting-Host: 85.32.231.195 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9b72e44b-fa9b-47cf-8cf2-668f047fbc53@googlegroups.com> Subject: issue with UPDATE From: lboc80@gmail.com Injection-Date: Fri, 05 Oct 2018 16:44:09 +0000 Content-Type: text/plain; charset="UTF-8" Lines: 43 Xref: csiph.com comp.databases.postgresql:844 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?