Re: From select to delete

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: From select to delete
Дата
Msg-id CAADeyWje1A=JrkdAj4ij8xNZLCmBVyk7LxJ7wB=qGeggKH-1jg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: From select to delete  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
I've got another great advice to use DELETE ... USING
instead of DELETE ... (SUB-SELECT),
so my procedure looks now like this (for archive):

        create or replace function pref_delete_user(_id varchar,
            _reason varchar) returns void as $BODY$
                begin

                create temporary table temp_gids (gid int not null) on
commit drop;
                insert into temp_gids (gid) select gid from
pref_scores where id=_id;

                delete from pref_scores p
                using temp_gids t
                where p.gid = t.gid;

                delete from pref_games p
                using temp_gids t
                where p.gid = t.gid;

                /* more delete's here */

                end;
        $BODY$ language plpgsql;

В списке pgsql-general по дате отправления:

Предыдущее
От: Sim Zacks
Дата:
Сообщение: Re: PostgreSQL Naming Rules - another question
Следующее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Why is there no 8.3.16 rpm with _id ?