Re: [HACKERS] Enhancing PGSQL to be compatible with Informix SQL - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] Enhancing PGSQL to be compatible with Informix SQL
Date
Msg-id 38759491.FD69EE66@alumni.caltech.edu
Whole thread Raw
In response to Re: [HACKERS] Enhancing PGSQL to be compatible with Informix SQL  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [HACKERS] SQL outer join syntax
List pgsql-hackers
> > select ...
> > from t1 inner join t4 on t1.x=t4.x,
> >      t2 left outer join t1
> >        on t2.y=t1.y and
> >           (t1.start_date between t2.start_date and t1.start_date),
> >      t3 left outer join t1 on t3.x=t1.x and t3.y = t1.y;
> Let's be honest, folks.  This is almost unreadable.  I think we will
> need some simpler way to access _outer_ in addition to the ANSI way.

Nonsense! Especially since this isn't quite SQL92. Here is an SQL92
query (I think ;) :

select a, b, c from (t1 left join t2 using (x)) as j1 (a, b)  right join t3 on (j1.a = t3.y);

So you do a left join with t1 and t2, name the resulting intermediate
table and columns, and then do a right join of the result with t3. I
can't see other syntaxes being very much more obvious, particularly
wrt predicting the actual result. Just because a query looks simpler
doesn't necessarily mean that the syntax alway produces a more robust
query.

> I can't imagine how I would answer a question: "How do I do an ANSI
> outer join".  It would need its own FAQ page.

Well, *you're* the one writing the book :))
                - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] Enhancing PGSQL to be compatible with Informix SQL
Next
From: "Ansley, Michael"
Date:
Subject: RE: [HACKERS] Enhancing PGSQL to be compatible with Informix SQL