Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id A0207475E20; Mon, 10 Jun 2002 16:57:46 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 670BB476086; Mon, 10 Jun 2002 16:34:52 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g5AKY1b08493; Mon, 10 Jun 2002 16:34:02 -0400 (EDT) To: Bruce Momjian Cc: Hannu Krosing , Christoph Haller , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [HACKERS] Efficient DELETE Strategies In-reply-to: <200206101833.g5AIXj600263@candle.pha.pa.us> References: <200206101833.g5AIXj600263@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 10 Jun 2002 14:33:45 -0400" Date: Mon, 10 Jun 2002 16:34:01 -0400 Message-ID: <8490.1023741241@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200206/120 X-Sequence-Number: 8085 Bruce Momjian writes: > Hannu Krosing wrote: >> What about >> >> DELETE relation_expr FROM relation_expr [ , table_ref [ , ... ] ] >> [ WHERE bool_expr ] >> >> or >> >> DELETE relation_expr.* FROM relation_expr [ , table_ref [ , ... ] ] >> [ WHERE bool_expr ] > So make the initial FROM optional and allow the later FROM to be a list > of relations? Seems kind of strange. No, I think he's suggesting that one be able to pick out any element of the FROM-list and say that that is the deletion target. I really don't want to get into that (unless there is precedent in Oracle or someplace); it seems way too confusing to me. It would also force us to do error checking to eliminate cases that ought to just be syntactically impossible: target table not present, target is a join or subselect instead of a table, target is on wrong side of an outer join, etc. [ and in another message ] > The FROM ... FROM looks weird, and there is clearly confusion over the > FROM t1, t2. I wish there was another option. The only other thing that's come to mind is to use a different keyword (ie, not FROM) for the list of auxiliary relations. WITH might work from a simple readability point of view: DELETE FROM target WITH other-tables WHERE ... But we've already got FROM as the equivalent construct in UPDATE, so it seems weird to use something else in DELETE. regards, tom lane