On Tue, 2002-06-11 at 04:53, Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > Hannu Krosing wrote:
> > >> What about
> > >>
> > >> DELETE relation_expr FROM relation_expr [ , table_ref [ , ... ] ]
> > >> [ WHERE bool_expr ]
> > >>
> > >> or
> > >>
> > >> DELETE relation_expr.* FROM relation_expr [ , table_ref [ , ... ] ]
> > >> [ WHERE bool_expr ]
> >
> > > So make the initial FROM optional and allow the later FROM to be a list
> > > of relations? Seems kind of strange.
I was inspired by MS Access syntax that has optional relation_expr.* :
DELETE [relation_expr.*] FROM relation_expr WHERE criteria
it does not allow any other tablerefs in from
> Clearly this is a TODO item. I will document it when we decide on a
> direction.
Or then we can just stick with standard syntax and teach people to do
DELETE FROM t1 where t1.id1 in (select id2 from t2 where t2.id2 = t1.id1)
and perhaps even teach our optimizer to add the t2.id2 = t1.id1 part
itself to make it fast
AFAIK this should be exactly the same as the proposed
DELETE FROM t1 FROM t2
WHERE t2.id2 = t1.id1
--------------
Hannu