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 1oAP1Q-0003Tj-Ow for pgsql-docs@arkaria.postgresql.org; Sun, 10 Jul 2022 04:58:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oAP1P-0000A4-FC for pgsql-docs@arkaria.postgresql.org; Sun, 10 Jul 2022 04:58:19 +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 1oAP1P-00009m-5w for pgsql-docs@lists.postgresql.org; Sun, 10 Jul 2022 04:58:19 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oAP1K-0000Y0-Lf for pgsql-docs@lists.postgresql.org; Sun, 10 Jul 2022 04:58:18 +0000 Received: by mail-pj1-x1030.google.com with SMTP id s21so2267823pjq.4 for ; Sat, 09 Jul 2022 21:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DmycUDexJdVfz0TAWHRFc1gUb+2rtICxkMwnfDnhpVk=; b=hjVfgcy448LqzTTLVNZSiYOpThVyuOzFTfAm9AA3KEcY2nIed10M56r5E4pydOxzmv HWa+jw8d5eHE7qzjcw3N9/9KvANKqQ8zpIKS4itS/IMPna9L/NwnpmeaQMFeriUSEGgE 3wWJ4uZLb37ppKzciKh1pzOUVHpIt3FDH7PxQSNr4ISlkyDFpVhhVIW466oai+v7sH8w mM+BYWAgx39FCeVuwNZAA21gevBbAlI5x7mECc5YozOpc2ob1t3FKpHa3/r1enNkSD0j N9EQG5bdNdCef0YmSBcI+eeosVCKqn9n3a3TF4LtF5eU2jI1thaWrEJACGjIwEFMywqU xPwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DmycUDexJdVfz0TAWHRFc1gUb+2rtICxkMwnfDnhpVk=; b=dKC0T4eEccvAKl/SFBXjnea/ah+Tttoid8ALl+yfhBOVKX7wFARivXFzhxyTJeeEfC Sf9XPw5ots3/rnEBEnBJg4fsD8kLFkPvMhMQNTL1AgMg+Hl/O6HAirUHBrDgTuajNhUc u22poFwdix/G82XOgLikw5pjworo8Uqyp6PDUEeTN5dQ/uxXTPXwxY6JcOq74GG7NRt+ J10jg3wPURHgJ1weUsTMPsSDXaNHi3phIYslewkE8g7Vknap5BO+6RG3OaMhVj8fDlfh G+RAIbp3VXBpTfSk0FmzMO2JGwz4Sh9A1kIM8Grjcb8BKqu0sPyjz2V7Erw3sbMzaoY9 8cCw== X-Gm-Message-State: AJIora9VCwoq2SS17wNXaOE7J+hQ0/w3rtdlxPVRqq4mutfL4/P+sliL qla1xFlkTWVJ+VC8x4RcF6U3fkrX//00/gQj18u+gOnu X-Google-Smtp-Source: AGRyM1sIyxQj9vmbKpafQfmKCDY7EQlUcG8D7xnqu/OjVKMpk76gzvpcMAaW2ynfT+eeXDtuyrW9BCJ6GBJTMPgdAXM= X-Received: by 2002:a17:90a:598f:b0:1ef:32d9:1fa2 with SMTP id l15-20020a17090a598f00b001ef32d91fa2mr9685547pji.182.1657429093009; Sat, 09 Jul 2022 21:58:13 -0700 (PDT) MIME-Version: 1.0 References: <165455035739.573549.17628498892386696027@wrigleys.postgresql.org> In-Reply-To: From: Adrian Wiik Date: Sun, 10 Jul 2022 06:58:01 +0200 Message-ID: Subject: Re: Section I - 2.9: Use SELECT to confirm set of rows before DELETE To: Bruce Momjian Cc: pgsql-docs@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000544d7b05e36c482b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000544d7b05e36c482b Content-Type: text/plain; charset="UTF-8" That makes sense. Thanks for letting me know! On Sun, Jul 10, 2022, 3:17 AM Bruce Momjian wrote: > On Mon, Jun 6, 2022 at 09:19:17PM +0000, PG Doc comments form wrote: > > The following documentation comment has been logged on the website: > > > > Page: https://www.postgresql.org/docs/14/tutorial-delete.html > > Description: > > > > Since this tutorial section is coined at beginners, I think it could be > > useful to tip users about the possibility to use a SELECT statement with > the > > exact same qualification(s) as the DELETE statement they're planning to > run > > to see which rows are about to be deleted, to avoid unintended deletion > of > > rows. I suggest something like this: > > > > ... > > Without a qualification, DELETE will remove all rows from the given > table, > > leaving it empty. The system will not request confirmation before doing > > this! > > > > You can check which rows will be deleted by any DELETE statement on the > > form: > > ```DELETE FROM tablename ... ...``` > > by rewriting it into a corresponding SELECT statement: > > ```SELECT * FROM tablename ... ...``` > > > > This is my first attempt at contributing to the community, so please be > > nice. :) > > Uh, this is more of a general SQL training that we don't normally cover > in the Postgres docs --- we try to focus on Postgres-specific stuff that > people need to know. > > -- > Bruce Momjian https://momjian.us > EDB https://enterprisedb.com > > Indecision is a decision. Inaction is an action. Mark Batterson > > --000000000000544d7b05e36c482b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
That makes sense. Thanks for letting=C2=A0me know!


On Sun, Jul 10, 2022, 3:17 AM Bruce Momjia= n <bruce@momjian.us> wrote:
On Mon, Jun=C2=A0 6, 2022 at 09:19:1= 7PM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website: >
> Page: https://www.postgresql.= org/docs/14/tutorial-delete.html
> Description:
>
> Since this tutorial section is coined at beginners, I think it could b= e
> useful to tip users about the possibility to use a SELECT statement wi= th the
> exact same qualification(s) as the DELETE statement they're planni= ng to run
> to see which rows are about to be deleted, to avoid unintended deletio= n of
> rows. I suggest something like this:
>
> ...
> Without a qualification, DELETE will remove all rows from the given ta= ble,
> leaving it empty. The system will not request confirmation before doin= g
> this!
>
> You can check which rows will be deleted by any DELETE statement on th= e
> form:
> ```DELETE FROM tablename ... <qualificaton> ...```
> by rewriting it into a corresponding SELECT statement:
> ```SELECT * FROM tablename ... <qualification> ...```
>
> This is my first attempt at contributing to the community, so please b= e
> nice. :)

Uh, this is more of a general SQL training that we don't normally cover=
in the Postgres docs --- we try to focus on Postgres-specific stuff that people need to know.

--
=C2=A0 Bruce Momjian=C2=A0 <bruce@momjian.us>=C2=A0 =C2=A0 =C2=A0= =C2=A0 https://momjian.us
=C2=A0 EDB=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 https://enterprisedb.com

=C2=A0 Indecision is a decision.=C2=A0 Inaction is an action.=C2=A0 Mark Ba= tterson

--000000000000544d7b05e36c482b--