Re: DELETE using an outer join

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: DELETE using an outer join
Date: 2012-07-20 08:21:43
Message-ID: CAL_0b1shAZWP76=jpA47MLJE4p3q9_FHnAAy9ki_gXk1kVYJuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Jul 19, 2012 at 6:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Now I was wondering if a DELETE statement could be rewritten with the same "strategy":
>
> Not at the moment. There have been discussions of allowing the same
> table name to be respecified in USING, but there are complications.

However it works.

DELETE FROM some_table USING some_table AS s
WHERE
some_table.col1 = s.col1 AND
some_table.col2 = s.col2 AND
some_table.id < s.id;

--
Sergey Konoplev

a database and software architect
http://www.linkedin.com/in/grayhemp

Jabber: gray(dot)ru(at)gmail(dot)com Skype: gray-hemp Phone: +79160686204

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2012-07-20 10:27:22 Re: DELETE using an outer join
Previous Message Thomas Kellerer 2012-07-20 08:17:27 Re: DELETE using an outer join