Re: Automatic joins? - Mailing list pgsql-general

From Martín Marqués
Subject Re: Automatic joins?
Date
Msg-id 1074437457.400a9d51292a0@bugs.unl.edu.ar
Whole thread Raw
In response to Automatic joins?  (Leif K-Brooks <eurleif@ecritters.biz>)
List pgsql-general
Mensaje citado por Leif K-Brooks <eurleif@ecritters.biz>:

> According to the Wikipedia article on PostgreSQL
> (http://en.wikipedia.org/wiki/PostgreSQL), it has a feature for
> automatic joins:
>
> "SELECT u.* FROM user u, address a WHERE a.city='New York' and
> a.user_name=u.user_name
>
> In Postgres the relationship between users and addresses can be
> explicity defined. Once defined the address becomes a property of the
> user, so the search above can be simplified greatly to:
>
> SELECT * FROM user WHERE address.city='New York'"

I find this totally untrue (un less I missundertud it). Check this out:

siprebi=> select version();
                                              version
---------------------------------------------------------------------------------------------------
 PostgreSQL 7.3.4 on sparc-unknown-linux-gnu, compiled by GCC sparc-linux-gcc
(GCC) 3.3.2 (Debian)
(1 row)

siprebi=> select a.nombre from admin a, biblioteca b where b.codigo = 3 and
b.codigo = a.biblioteca;
 nombre
--------
(0 rows)

siprebi=> select a.nombre from admin a, biblioteca b where b.codigo = 3;
      nombre
-------------------
 Andres C. Roman
 Martin Marques
 Mariano Markowsky
(3 rows)

siprebi=> select a.nombre from admin a where biblioteca.codigo = 3;
NOTICE:  Adding missing FROM-clause entry for table "biblioteca"
      nombre
-------------------
 Andres C. Roman
 Martin Marques
 Mariano Markowsky
(3 rows)

siprebi=> select a.nombre from admin a;
      nombre
-------------------
 Andres C. Roman
 Martin Marques
 Mariano Markowsky
(3 rows)

As you see, no automatic join was performed. Who wrote that article? I see that
example, at least poorly written, if not inaccurate.

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-------------------------------------------------------
Martín Marqués          |   Programador, DBA
Centro de Telemática    |     Administrador
               Universidad Nacional
                    del Litoral
-------------------------------------------------------

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Using a Makefile during database development
Next
From: Richard Huxton
Date:
Subject: Re: Tool to ease development of plpgsql