Re: ADD TO UPDATE LIMIT

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andrey Furs <aefurs93(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: ADD TO UPDATE LIMIT
Date: 2020-10-23 18:06:45
Message-ID: CAKFQuwb=6PBtyDn2EXzbGJu7S8wqT6txkAEpaTkLY1pYCsF38w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Oct 23, 2020 at 10:32 AM Andrey Furs <aefurs93(at)gmail(dot)com> wrote:

> Hi there!
> Are you serious !?
> Postgresql not UPDATE LIMIT !?
>
> UPDATE table SET id=100 WHERE id<1000 LIMIT 1;
>

As Christophe said, you failed to describe what you expected to happen. If
you are looking for SQL to protect you from yourself then this is but one
example that suggests that you need to change your general expectations and
just be more diligent about testing your data destructing SQL commands. If
you actually expected it to change a single record when more than one match
you likewise need to change your expectations - though in this case there
isn't much to be done when writing SQL generally.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-10-24 04:05:07 BUG #16685: The ecpg thread/descriptor test fails sometimes on Windows
Previous Message Christophe Pettus 2020-10-23 17:35:03 Re: ADD TO UPDATE LIMIT