Re: Table alias in DELETE statements - Mailing list pgsql-sql

From Manfred Koizar
Subject Re: Table alias in DELETE statements
Date
Msg-id n0m3ou4oeffrdhkahjqd12r1gl7r8i1llq@4ax.com
Whole thread Raw
In response to Table alias in DELETE statements  (Hanno Wiegard <hwiegard@web.de>)
List pgsql-sql
On Fri, 13 Sep 2002 14:10:25 +0200, Hanno Wiegard <hwiegard@web.de>
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 <table name> [ WHERE <search condition> ]

SQL99: DELETE FROM <target table> [ WHERE <search condition> ] <target table> ::= [ ONLY ] <left paren> <table name>
<rightparen>
 

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?

ServusManfred


pgsql-sql by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: sql group by statement
Next
From: "Chad Thompson"
Date:
Subject: Re: DISTINCT ON