X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 60B154759AF for ; Tue, 18 Feb 2003 11:06:39 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id AE207475957 for ; Tue, 18 Feb 2003 11:06:38 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1E882D613; Tue, 18 Feb 2003 08:06:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1038A5C03; Tue, 18 Feb 2003 08:06:43 -0800 (PST) Date: Tue, 18 Feb 2003 08:06:42 -0800 (PST) From: Stephan Szabo To: Tom Lane Cc: Bruno Wolff III , Christoph Haller , Subject: Re: " Adding missing FROM-clause entry for table .... " problem. In-Reply-To: <23770.1045583425@sss.pgh.pa.us> Message-ID: <20030218075714.E20577-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/403 X-Sequence-Number: 11801 On Tue, 18 Feb 2003, Tom Lane wrote: > Bruno Wolff III writes: > > Christoph Haller wrote: > >> AFAIK, statements like > >> DELETE FROM t1 where t1.id = t2.id ; > >> are legal. Could the parser still work on this, if the feature is > >> removed? > > > Only if a new syntax is added. > > For UPDATE, we actually do have an extension syntax that allows naming > secondary tables explicitly: > > UPDATE target SET ... FROM other-tables WHERE ... > > The trouble with extending this to DELETE is that DELETE already uses > the keyword FROM. Seems like we are stuck with a choice between > > DELETE FROM target FROM other-tables WHERE ... > > DELETE FROM target, other-tables WHERE ... > > both of which are bizarre and confusing to my eyes. I think that MySQL > uses the second form, which I like even less than the first (it obscures > the very fundamental semantic difference between the deletion target and > the other tables). > > Or we could go off with a different keyword, perhaps > > DELETE FROM target WITH other-tables WHERE ... > > but that doesn't seem to pass the low-astonishment test either. It'd seem reasonable to use something like SQL99's WITH, although that'd put the WITH before the FROM I think. That'd at least be similar to using it in select (admittedly we don't have it yet, but wasn't someone talking about it?)