Re: From select to delete
От | Alexander Farber |
---|---|
Тема | Re: From select to delete |
Дата | |
Msg-id | CAADeyWhwtKUrQTkdRt8WAnE668FZEg8sZp-KWbJx=GX9hmUboA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: From select to delete ("David Johnston" <polobo@yahoo.com>) |
Ответы |
Re: From select to delete
Re: From select to delete Re: From select to delete |
Список | pgsql-general |
Thank you, David - On Fri, Oct 28, 2011 at 7:00 PM, David Johnston <polobo@yahoo.com> wrote: > The easiest way is to create FOREIGN KEY relationships between the various > tables and allow "ON DELETE CASCADE" to do the work. > > Otherwise you need to DELETE with an appropriate WHERE clause (and > sub-selects) or you can use the "USING" clause with the DELETE to add > additional condition tables. > > DELETE FROM t1 > USING (t2 JOIN t3 ON (...)) t_linked > WHERE t1.something = t_linked.something; > I'll try that. My own 3 commands suggested above fail with Foreign key violation: 7 ERROR: update or delete on table "pref_games" violates foreign key constraint "pref_scores_gid_fkey" on table "pref_scores" DETAIL: Key (gid)=(1998) is still referenced from table "pref_scores". CONTEXT: SQL statement "delete from pref_games where gid in (select gid from pref_scores where id= $1 )" Regards Alex
В списке pgsql-general по дате отправления: