public inbox for [email protected]  
help / color / mirror / Atom feed
Section I - 2.9: Use SELECT to confirm set of rows before DELETE
3+ messages / 3 participants
[nested] [flat]

* Section I - 2.9: Use SELECT to confirm set of rows before DELETE
@ 2022-06-06 21:19 PG Doc comments form <[email protected]>
  2022-07-10 01:17 ` Re: Section I - 2.9: Use SELECT to confirm set of rows before DELETE Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2022-06-06 21:19 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

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 ... <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 be
nice. :)


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Section I - 2.9: Use SELECT to confirm set of rows before DELETE
  2022-06-06 21:19 Section I - 2.9: Use SELECT to confirm set of rows before DELETE PG Doc comments form <[email protected]>
@ 2022-07-10 01:17 ` Bruce Momjian <[email protected]>
  2022-07-10 04:58   ` Re: Section I - 2.9: Use SELECT to confirm set of rows before DELETE Adrian Wiik <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2022-07-10 01:17 UTC (permalink / raw)
  To: [email protected]; [email protected]

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 ... <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 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  <[email protected]>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Section I - 2.9: Use SELECT to confirm set of rows before DELETE
  2022-06-06 21:19 Section I - 2.9: Use SELECT to confirm set of rows before DELETE PG Doc comments form <[email protected]>
  2022-07-10 01:17 ` Re: Section I - 2.9: Use SELECT to confirm set of rows before DELETE Bruce Momjian <[email protected]>
@ 2022-07-10 04:58   ` Adrian Wiik <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Adrian Wiik @ 2022-07-10 04:58 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: [email protected]

That makes sense. Thanks for letting me know!


On Sun, Jul 10, 2022, 3:17 AM Bruce Momjian <[email protected]> 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 ... <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 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  <[email protected]>        https://momjian.us
>   EDB                                      https://enterprisedb.com
>
>   Indecision is a decision.  Inaction is an action.  Mark Batterson
>
>


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-07-10 04:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 21:19 Section I - 2.9: Use SELECT to confirm set of rows before DELETE PG Doc comments form <[email protected]>
2022-07-10 01:17 ` Bruce Momjian <[email protected]>
2022-07-10 04:58   ` Adrian Wiik <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox