Re: Efficient DELETE Strategies

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Efficient DELETE Strategies
Date: 2002-06-10 16:48:16
Message-ID: 200206101648.g5AGmG419376@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Tom Lane wrote:
> Christoph Haller <ch(at)rodos(dot)fzk(dot)de> writes:
>
> DELETE FROM relation_expr [ FROM table_ref [ , ... ] ]
> [ WHERE bool_expr ]
>
> The two FROMs in the second form look a little weird, but they help to
> make a clear separation between the deletion target table and the
> merely-referenced tables. Also, the first one might look to people
> like they'd be allowed to write
>
> DELETE FROM foo FULL JOIN bar ...
>
> which is not any part of my intention (it's very unclear what it'd
> mean for the target table to be on the nullable side of an outer join).
> OTOH there'd be no harm in outer joins in a separate from-clause, eg
>
> DELETE FROM foo FROM (bar FULL JOIN baz ON ...) WHERE ...
>
> Actually, either syntax above would support that; I guess what's really
> bothering me about the first syntax is that a comma suggests a list of
> things that will all be treated similarly, while in reality the first
> item will be treated much differently from the rest.

Interesting. We could allow an alias on the primary table:

DELETE FROM foo f
WHERE

and allow the non-alias version of the table for the join. Of course,
that doesn't allow "FULL JOIN" and stuff like that. The FROM ... FROM
looks weird, and there is clearly confusion over the FROM t1, t2. I
wish there was another option.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-06-10 17:18:44 Re: Timestamp/Interval proposals: Part 2
Previous Message David Santinoli 2002-06-10 16:47:55 Mac OS X shutdown

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2002-06-10 17:20:10 Re: [SQL] VIEWs and FOREIGN keys
Previous Message Stephan Szabo 2002-06-10 16:10:42 Re: [SQL] VIEWs and FOREIGN keys