Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8916E475FA5 for ; Fri, 13 Sep 2002 08:44:44 -0400 (EDT) Received: from email04.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id B9D14475F34 for ; Fri, 13 Sep 2002 08:44:43 -0400 (EDT) Received: (qmail 252748 invoked from network); 13 Sep 2002 12:44:46 -0000 Received: from m153p017.dipool.highway.telekom.at (HELO cantor) ([62.46.9.17]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 13 Sep 2002 12:44:46 -0000 From: Manfred Koizar To: Hanno Wiegard Cc: pgsql-sql@postgresql.org Subject: Re: Table alias in DELETE statements Date: Fri, 13 Sep 2002 14:46:05 +0200 Message-ID: References: <200209131210.g8DCAPX06979@mailgate5.cinetic.de> In-Reply-To: <200209131210.g8DCAPX06979@mailgate5.cinetic.de> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/134 X-Sequence-Number: 9411 On Fri, 13 Sep 2002 14:10:25 +0200, Hanno Wiegard wrote: >So the question for me is whether it is possible >to use a table alias in a DELETE statement or not, e.g. >DELETE FROM foo f WHERE f.ID > 3000 (more complicated cases in reality Hanno, looks like you are out of luck here. PG 7.3: DELETE FROM [ ONLY ] table [ WHERE condition ] SQL92: DELETE FROM [ WHERE ] SQL99: DELETE FROM [ WHERE ] ::= [ ONLY ]
which BTW makes "DELETE FROM mytable" invalid. This would have to be "DELETE FROM (mytable)". Is there something wrong with my copy of the standard? There has been a discussion on -hackers about extensions to the DELETE statement (DELETE [FROM] a FROM b, c WHERE ...). If this gets implemented in a future release, there's a certain chance for a table alias. >and I really need the alias because the SQL is generated automaically >by a tool)? ... and this tool works with what database? Servus Manfred