From: | Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar> |
---|---|
To: | Leif K-Brooks <eurleif(at)ecritters(dot)biz> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Automatic joins? |
Date: | 2004-01-18 14:50:57 |
Message-ID: | 1074437457.400a9d51292a0@bugs.unl.edu.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Mensaje citado por Leif K-Brooks <eurleif(at)ecritters(dot)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
-------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Bill Moran | 2004-01-18 14:53:47 | Using a Makefile during database development |
Previous Message | Chris Travers | 2004-01-18 13:20:52 | Re: User-specific sequences... |