pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Table alias in DELETE statements
6+ messages / 4 participants
[nested] [flat]

* Table alias in DELETE statements
@ 2002-09-12 15:57  Hanno Wiegard <hwiegard@web.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Hanno Wiegard @ 2002-09-12 15:57 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I've already checked the mailing archive but found nothing about
problems with the DELETE statement and table alias but it's not
mentioned in the docs. 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 
and I really need the alias because the SQL is generated automaically 
by a tool)?

Thanks,
Hanno Wiegard

______________________________________________________________________________
Wie ware das: mehrere E-Mail Adressen - aber nur ein Postfach ?
Kein Problem mit WEB.DE FreeMail - http://freemail.web.de/?mc=021127




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Table alias in DELETE statements
@ 2002-09-13 12:10  Hanno Wiegard <hwiegard@web.de>
  0 siblings, 2 replies; 6+ messages in thread

From: Hanno Wiegard @ 2002-09-13 12:10 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I've already checked the mailing archive but found nothing about
problems with the DELETE statement and table alias but it's not
mentioned in the docs. 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 
and I really need the alias because the SQL is generated automaically 
by a tool)?

Thanks,
Hanno Wiegard



______________________________________________________________________________
Die clevere Geldreserve: der DiBa-Privatkredit. Funktioniert wie ein Dispo, 
ist aber viel gunstiger! Alle Infos: http://diba.web.de/?mc=021104




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Table alias in DELETE statements
@ 2002-09-13 12:46  Manfred Koizar <mkoi-pg@aon.at>
  parent: Hanno Wiegard <hwiegard@web.de>
  1 sibling, 0 replies; 6+ messages in thread

From: Manfred Koizar @ 2002-09-13 12:46 UTC (permalink / raw)
  To: Hanno Wiegard <hwiegard@web.de>; +Cc: 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> <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



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Table alias in DELETE statements
@ 2002-09-14 06:07  Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  parent: Hanno Wiegard <hwiegard@web.de>
  1 sibling, 1 reply; 6+ messages in thread

From: Christopher Kings-Lynne @ 2002-09-14 06:07 UTC (permalink / raw)
  To: Hanno Wiegard <hwiegard@web.de>; +Cc: pgsql-sql

On the several occasions I've tried using table aliases in delete
statements, it hasn't worked.

Chris

On Fri, 13 Sep 2002, Hanno Wiegard wrote:

> Hi,
>
> I've already checked the mailing archive but found nothing about
> problems with the DELETE statement and table alias but it's not
> mentioned in the docs. 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
> and I really need the alias because the SQL is generated automaically
> by a tool)?
>
> Thanks,
> Hanno Wiegard
>
>
>
> ______________________________________________________________________________
> Die clevere Geldreserve: der DiBa-Privatkredit. Funktioniert wie ein Dispo,
> ist aber viel gunstiger! Alle Infos: http://diba.web.de/?mc=021104
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Table alias in DELETE statements
@ 2002-09-16 04:03  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
  0 siblings, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2002-09-16 04:03 UTC (permalink / raw)
  To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>; +Cc: Hanno Wiegard <hwiegard@web.de>; pgsql-sql


TODO has:

	* Allow DELETE to handle table aliases for self-joins [delete]

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:
> On the several occasions I've tried using table aliases in delete
> statements, it hasn't worked.
> 
> Chris
> 
> On Fri, 13 Sep 2002, Hanno Wiegard wrote:
> 
> > Hi,
> >
> > I've already checked the mailing archive but found nothing about
> > problems with the DELETE statement and table alias but it's not
> > mentioned in the docs. 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
> > and I really need the alias because the SQL is generated automaically
> > by a tool)?
> >
> > Thanks,
> > Hanno Wiegard
> >
> >
> >
> > ______________________________________________________________________________
> > Die clevere Geldreserve: der DiBa-Privatkredit. Funktioniert wie ein Dispo,
> > ist aber viel gunstiger! Alle Infos: http://diba.web.de/?mc=021104
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Table alias in DELETE statements
@ 2002-09-16 19:50  Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2002-09-16 19:50 UTC (permalink / raw)
  To: Hanno Wiegard <hwiegard@voiceobjects.com>; +Cc: chriskl@familyhealth.com.au; pgsql-sql


More long term, if you read the link attached to the TODO item. There is
a question of how to cleanly implement it.

---------------------------------------------------------------------------

Hanno Wiegard wrote:
> Good, but is the implementation of this feature a short-term goal or
> more long-term?
> 
> Thanks,
> hanno
> 
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: Montag, 16. September 2002 06:04
> To: Christopher Kings-Lynne
> Cc: Hanno Wiegard; pgsql-sql@postgresql.org
> Subject: Re: [SQL] Table alias in DELETE statements
> 
> 
> 
> TODO has:
> 
> 	* Allow DELETE to handle table aliases for self-joins [delete]
> 
> ------------------------------------------------------------------------
> ---
> 
> Christopher Kings-Lynne wrote:
> > On the several occasions I've tried using table aliases in delete
> > statements, it hasn't worked.
> > 
> > Chris
> > 
> > On Fri, 13 Sep 2002, Hanno Wiegard wrote:
> > 
> > > Hi,
> > >
> > > I've already checked the mailing archive but found nothing about
> > > problems with the DELETE statement and table alias but it's not
> > > mentioned in the docs. 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
> > > and I really need the alias because the SQL is generated
> automaically
> > > by a tool)?
> > >
> > > Thanks,
> > > Hanno Wiegard
> > >
> > >
> > >
> > >
> ________________________________________________________________________
> ______
> > > Die clevere Geldreserve: der DiBa-Privatkredit. Funktioniert wie ein
> Dispo,
> > > ist aber viel gunstiger! Alle Infos: http://diba.web.de/?mc=021104
> > >
> > >
> > > ---------------------------(end of
> broadcast)---------------------------
> > > TIP 4: Don't 'kill -9' the postmaster
> > >
> > 
> > 
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> > 
> > http://archives.postgresql.org
> > 
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
> 19073
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2002-09-16 19:50 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12 15:57 Table alias in DELETE statements Hanno Wiegard <hwiegard@web.de>
2002-09-13 12:10 Table alias in DELETE statements Hanno Wiegard <hwiegard@web.de>
2002-09-13 12:46 ` Manfred Koizar <mkoi-pg@aon.at>
2002-09-14 06:07 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-09-16 04:03   ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-09-16 19:50 Re: Table alias in DELETE statements Bruce Momjian <pgman@candle.pha.pa.us>

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