Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pDn33-0001ci-JM for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Jan 2023 13:46:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pDn31-0000ZB-Em for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Jan 2023 13:46:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pDmJ7-0001Rn-Lr for pgsql-bugs@lists.postgresql.org; Fri, 06 Jan 2023 12:58:50 +0000 Received: from sonic307-32.consmr.mail.ir2.yahoo.com ([87.248.110.57]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pDmJ3-0000zH-Hw for pgsql-bugs@lists.postgresql.org; Fri, 06 Jan 2023 12:58:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s2048; t=1673009922; bh=1aWPtP8WofOFuOzE0+xsBSWEeJTslpPzGHyKohrl5VM=; h=Date:From:To:Subject:References:From:Subject:Reply-To; b=PEmKgmm5zPvFxyAwSLPLH5X7rFHWM2J6Ul/4xq5cKEYx3U9cKu+ZclzA5H/DR+PB285S4eYy4q8XIRQW/4/oer/Ky2NVwvfBXFGVjYerjCoRgwD6DNGP7JEMbA8f9r9M75tlBFTl4Bcgfm5HPK/2ey/klSgGvN+kkzHGQAZhJbSq7egB2dQdYo96g9ZIJpp6yQ9w7OiLhGKOXVTJEQyD3M33EaIwx4Tu2qDgJlBMd3fpdbzwXj39nPGXzOt/FZLaFbccRZA2ZyPcy6Uw5D1Q9lwMBpvOs6PqjFFP5wOEcKPLcAmHUwFhQ5DFI2tWeXnFMQY0/civtfPOafLYRdmErg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1673009922; bh=gLx9uhhJCBfulUCUJ03xItWRVg8HaSrkPqb2y6shQry=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=tcgbWlq6Nldn6ctjDt0SHVRthGDTSu0TXo40ytOQoA7w46yxJWq8jsWknvn9xjSmmLOjC8slv/pIm3Neqtt4GRJrekDPHHQxEgkRIYOJf6tbK1EZhV3Pm7tnWXetA/DyoJrnIUJVN17aJcRtlz+YYmcSy12zMgGpe8w+bmQfPKri9fKcFaynHWvgHNTDhjsPSU+V2Cush+T6Zx5WZC5QZBDtiu+wz+A4AbfvkORuIHfQc8qgsNMkzVGXaaLszWEEUFMoI6tVG6LCu4wDO+aOl3YAmt1VlqrYmFHvIZ+d0+ZIJWm7rRM7XoyQdmdflrQHnzxCxY4JbChtiOeC/y/k4Q== X-YMail-OSG: oeNqoIYVM1lV5gqp.A.7FiHH.0SeZ7Prwv.eWLcHuWEdd0XitpYK4r_jcI_ltlG qTqs.UWg5wcLgBi2WBIZBDlRMt1X1NDF4ok9JOfocROkRmODPzHxq220t_42oXZzqI0x5J5X7Vy2 ex3VXPsHehumKj2jm40ewK_ocCF.3XGNSV6JPQzHLR7QbZciyxSNXT9KIlvg7IksX8l.SefDfNkT ufmwCx.foR4UiRsqUmWxmVhPFagj8lx71p4NF1xPA5t6jkFDdOMw0CuJYwvndzsRiwkfNm4aCndo z8sg8.PVWyP4_ChtBwyXn1w.cJo6WV8fdUdPxfyFz0rUgUjzTPBpsaRUeracoCHL4xHCz2oLX1eP LIamtXYTjy0zsWO82zVakHRPfr7BW_9MeYheXuSrYj.PsDUwvFmbgCCStPThdKFlJEotLJQ_bpYJ evMN4T1X9cvI4JIYrBTRs58Dp503RCptRp6Qk9x.5RnrjLu4ItW0TtBTXoQa05V7d6WFpV_5rPwl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.qk.t_PIr2sZ9UZ6MMw0N2s.hSbpS_RWC6ei1_OQYl6xbZ9iuFQ0hdiuOCAk1nmqxibN sD37Igoypgj5nv2CkW0QgztzGzJa8ogTxZ2qZDFA3nHv5hj_iJLJFNwi.MQ_EgmDl1m21kmIQaR_ rbhkfp7TpYLjPYJmuEcVGdP36WZgtjrI9.ex9koY.jtr3cTjX869lqgZmNxwp0WXcKzBUuE4mJUL PP7WEEIbhZq5abZku7dUW4Exoj6BueD1EPZp3JeUV4AaiCVgcEbCM.RqSq_.HHhADHZijCxRxPEj azUq8ItfyVagK.tBo7SZDq1dNSSQsSwB5rbzhHZfSzLQHp_jTcKg9ns1GAB4yYYKoQy_.on746fJ FyaCKU6xR5B9WK4dzkXuu4Ko5jh2BTdmEDdeN8eaP.4ZOaIIRDB8KNJZUrCHSBrTOmFDFtBTWWoW SRTbQOdkLkS8Q8RUFZbwGn6eY1zLXEYhGtaOaNqthHvINfLkoNB2I64yuBhzLMBfsCFi_ZZUl_YE vL_Lsu7BEYsu36bVgbWIbd0dWiuSNFMoLvZaNQSHZ.X0GghPd57dPOrq4ELTG185UxHixvqDHcFu WfkbQGMyDDZk4Lw4XDh7GdPmTjoQyJ8O1VpzAg5nk7g2M8M1fn4RMUSw2sQZE5_IGISbeT1aBJvT _4iKPkeTtnMxv4N24YK43MapwctYWWpWb.pyg6wc- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ir2.yahoo.com with HTTP; Fri, 6 Jan 2023 12:58:42 +0000 Date: Fri, 6 Jan 2023 12:56:41 +0000 (UTC) From: prevot morvan To: "pgsql-bugs@lists.postgresql.org" Message-ID: <1815939917.12528321.1673009801704@mail.yahoo.com> Subject: Issue with SQL query causing unintended consequences in database MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12528320_1538406466.1673009801702" References: <1815939917.12528321.1673009801704.ref@mail.yahoo.com> X-Mailer: WebService/1.1.20982 YMailNorrin Content-Length: 4149 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_12528320_1538406466.1673009801702 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dear PostgreSQL bug team, I am writing to report an issue I encountered when running an SQL query on = my database. I ran the following query: UPDATE=C2=A0=C2=A0 nf_job=C2=A0SET=C2=A0=C2=A0 status =3D 'TO_DO',=C2=A0= =C2=A0 error_message =3D NULL=C2=A0FROM=C2=A0=C2=A0 nf_job n=C2=A0=C2=A0 JO= IN formality f ON n.formality_id =3D f.id=C2=A0WHERE=C2=A0=C2=A0 f.liasse_n= umber IN ('J00011156148', 'J00011416104'); To my surprise, this query erased ALL of the status and error_messages in t= he nf_jobs table, rather than just changing two lines as I had intended. Upon reviewing the documentation for SELECT and UPDATE at the following lin= ks: SELECT:=C2=A0https://www.postgresql.org/docs/current/sql-select.htmlUPDATE:= =C2=A0https://www.postgresql.org/docs/current/sql-update.html I noticed that the SELECT statement allows for the use of "JOIN", but the U= PDATE statement does not. This leads me to believe that it should have been= a syntax error to include "JOIN" in an UPDATE statement. However, no synta= x error was thrown and the query seemed to attempt to run anyway, resulting= in the unintended consequences described above. I would be grateful if the team could take a look into this issue and let m= e know if there is any way to prevent this from happening in the future. Thank you in advance for your help. Sincerely,=C3=89mile PR=C3=89VOT ------=_Part_12528320_1538406466.1673009801702 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Dear PostgreSQL bug team,

I am writing to report an issue I encountered when running= an SQL query on my database.

I ran the following = query:

<= div>
UPDATE 
  nf_job 
SET 
  status =3D 'TO_DO', 
  error_message =3D = NULL 
FROM 
  nf_job n 
&= nbsp; JOIN formality f ON n.formality_id =3D f.id 
WHERE&nbs= p;
  f.liasse_number IN ('J00011156148', 'J00011416104');

<= br>
To my surprise, this query erased ALL of the status and error_messages in= the nf_jobs table, rather than just changing two lines as I had intended.<= /div>

Upon reviewing the documentation for SELECT and UP= DATE at the following links:


I noticed that the SELECT statement allows for the use of "JOIN", bu= t the UPDATE statement does not. This leads me to believe that it should ha= ve been a syntax error to include "JOIN" in an UPDATE statement. However, n= o syntax error was thrown and the query seemed to attempt to run anyway, re= sulting in the unintended consequences described above.

I would be grateful if the team could take a look into this issue and= let me know if there is any way to prevent this from happening in the futu= re.

Thank you in advance for your help.
=
Sincerely,
=C3=89mile PR=C3=89VOT
------=_Part_12528320_1538406466.1673009801702--