Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1he4Qg-00048p-Bn for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2019 21:17:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1he4Qf-0004lb-7v for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2019 21:17:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1he4Qe-0004ci-QT for pgsql-general@lists.postgresql.org; Thu, 20 Jun 2019 21:17:08 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1he4Qc-0005Tc-0P for pgsql-general@postgresql.org; Thu, 20 Jun 2019 21:17:08 +0000 Received: by mail-qt1-x844.google.com with SMTP id s15so4701684qtk.9 for ; Thu, 20 Jun 2019 14:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2CgybH7pPT+Gd+qTLyAbLg9ZeNCDxr9bjLmDrqkWfDI=; b=Qj6JzbsO0ptRZAtV2uyFtPJG7GslMEXBEsN5/vxOYa1kQIfJ5/5p+Z/kE+RjVcF4Sx AAUl4ceHp+KdDDFwXHn65zGYYEV6kW7lFNfMfM1frp9uehRCp20I1BFdb4j1jOCzVbMI QTRANxeG9Ek2XvOt+paHy21PoID/e6SEIkz/hzz6oNKNXwE/p4ov4yzRNt3gEqt+foAo m9EnBKI5gNKqG48o/vtKUua/546GEERzfzfNHY+ElD0k2EvDouDLu4Ix4HpXowxRae8b FwdEIZ5w9x8ePD15Fp+WZ5a9+r7ovynuhfzPuZLVLjjwBe7A4pfWdhsr2eTbtI05edyl ZxJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2CgybH7pPT+Gd+qTLyAbLg9ZeNCDxr9bjLmDrqkWfDI=; b=pIXbCvnQN5yzBOBbxAdjjbhPMmsFY2r8SuMuqFxPKh9cHk0WaXw/Q6930ygn9uxi4M 3HiygMVkhHHy30Mtu9FjCSEQTHe6bOy/PvjJrNBTcYPIR+t0pZ6HdOled2KZnqwfnM3m x3MDZA/h2hIItKnHMUH6ufZBggdYKFIVTNsPn5K77G3Js6jmptgKlk+RUB+feRr1kgst 3XpFDdlrYTgA/pxUjWfAHZ4+WgczxNN3yUo3Cf5w3E/moEH2O9bzhyn4RHH8h9yAAH+a HR7I4NKjb+TGPiSer1jIn4decq1KILQ8OEejRaLNNIwQvo+tM2j9WHhHdKZHkW0m9+H7 xUIA== X-Gm-Message-State: APjAAAVo3sOmAVx2fvliZZiIPeFloteBHHh3hCVOYpKZ6cMBkRSRGJPw xGM0EtJ9cEOKtI8ieGphh1Yt9TQ0dytsKYw+/fo= X-Google-Smtp-Source: APXvYqxwBF5g0GG7iWfFRYws+klXGxrwNJXDBy2BRKGdyRrb3g1CFCqkD4JptW9rQiF4lDYHnJQacnkFbKOnzQmcsbU= X-Received: by 2002:ac8:1946:: with SMTP id g6mr26836161qtk.225.1561065423959; Thu, 20 Jun 2019 14:17:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Thu, 20 Jun 2019 14:16:50 -0700 Message-ID: Subject: Re: Odd Update Behaviour To: Harry Ambrose Cc: pgsql-general Content-Type: multipart/alternative; boundary="00000000000010f9aa058bc7def0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000010f9aa058bc7def0 Content-Type: text/plain; charset="UTF-8" On Thu, Jun 20, 2019 at 2:13 PM Harry Ambrose wrote: > Hi, > > I noticed some weird update behaviour today in one of our development > environments. In my opinion this appears to be a bug, but before reporting > it I thought I should seek the opinions of others in the community. Maybe > this is known and/or seen before? > Yep, seen before, even has an FAQ entry: https://wiki.postgresql.org/wiki/FAQ#Why_doesn.27t_PostgreSQL_report_a_column_not_found_error_when_using_the_wrong_name_in_a_subquery.3F > The behaviour is visible when a subquery is used in an update. More > specifically when a subquery is rejected by the parser when executed on > it's own. This causes the where condition to be ignored entirely and thus > the whole table updated rather than the parser throwing an error. > David J. --00000000000010f9aa058bc7def0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jun 20, 2019 at 2:13 PM Harry Ambrose <harry.ambrose@gmail.com> wrote:<= /span>
Hi,

= I noticed some weird update behaviour today in one of our development envir= onments. In my opinion this appears to be a bug, but before reporting it I = thought I should seek the opinions of others in the community. Maybe this i= s known and/or seen before?

= Yep, seen before, even has an FAQ entry:



The behavio= ur is visible when a subquery is used in an update. More specifically when = a subquery is rejected by the parser when executed on it's own. This ca= uses the where condition to be ignored entirely and thus the whole table up= dated rather than the parser throwing an error.

David J.
--00000000000010f9aa058bc7def0--