Re: Delete with subquery deleting all records

Поиск
Список
Период
Сортировка
От Francisco Reyes
Тема Re: Delete with subquery deleting all records
Дата
Msg-id cone.1180052442.281492.39101.5001@35st.simplicato.com
обсуждение исходный текст
Ответ на Delete with subquery deleting all records  (Francisco Reyes <lists@stringsutils.com>)
Ответы Re: Delete with subquery deleting all records  (Scott Marlowe <smarlowe@g2switchworks.com>)
Список 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 по дате отправления:

Предыдущее
От: Rodrigo De León
Дата:
Сообщение: Re: Limiting number of rows returned at a time in select query
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: why postgresql over other RDBMS