Re: Table alias in DELETE statements

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Hanno Wiegard <hwiegard(at)web(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Table alias in DELETE statements
Date: 2002-09-13 12:46:05
Message-ID: n0m3ou4oeffrdhkahjqd12r1gl7r8i1llq@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 13 Sep 2002 14:10:25 +0200, Hanno Wiegard <hwiegard(at)web(dot)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> <right paren>

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chad Thompson 2002-09-13 14:35:39 Re: DISTINCT ON
Previous Message Manfred Koizar 2002-09-13 12:16:02 Re: sql group by statement