Re: Delete with subquery deleting all records - Mailing list pgsql-general

From Francisco Reyes
Subject Re: Delete with subquery deleting all records
Date
Msg-id cone.1180052442.281492.39101.5001@35st.simplicato.com
Whole thread Raw
In response to Delete with subquery deleting all records  (Francisco Reyes <lists@stringsutils.com>)
Responses Re: Delete with subquery deleting all records
List pgsql-general
Alban Hertroys writes:

> Why not use EXISTS?
>
> DELETE FROM export_messages WHERE NOT EXISTS (
>     SELECT 1
>       FROM exports
>      WHERE exports.export_id = export_messages.export_id
> )

Didn't think of it. Thanks for the code.

> I suppose you run those queries in a transaction block, right?

Correct.
Also I do a backup before doing the deletions.


pgsql-general by date:

Previous
From: Rodrigo De León
Date:
Subject: Re: Limiting number of rows returned at a time in select query
Next
From: Andrew Sullivan
Date:
Subject: Re: why postgresql over other RDBMS