From: Manfred Koizar <mkoi-pg@aon.at>
To: Hanno Wiegard <hwiegard@web.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Table alias in DELETE statements
Date: Fri, 13 Sep 2002 14:46:05 +0200
Message-ID: <n0m3ou4oeffrdhkahjqd12r1gl7r8i1llq@4ax.com> (raw)
In-Reply-To: <200209131210.g8DCAPX06979@mailgate5.cinetic.de>
References: <200209131210.g8DCAPX06979@mailgate5.cinetic.de>
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> <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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: mkoi-pg@aon.at, hwiegard@web.de
Subject: Re: Table alias in DELETE statements
In-Reply-To: <n0m3ou4oeffrdhkahjqd12r1gl7r8i1llq@4ax.com>
References: <200209131210.g8DCAPX06979@mailgate5.cinetic.de> <n0m3ou4oeffrdhkahjqd12r1gl7r8i1llq@4ax.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox