Search Postgresql Archives

FULL JOIN is only supported with merge-joinable join conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,

I have a question about outer join. For example as follow (pg 8.4.1):
------------------------------
create table t_1(a int);
create table t_3(a int);
insert into t_1 values(1);
insert into t_1 values(2);
insert into t_3 values(1);
insert into t_3 values(3);

postgres=# select version();
                           version
-------------------------------------------------------------
 PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit
(1 row)
postgres=# select * from t_1 full outer join t_3 on t_1.a=1;
ERROR:  FULL JOIN is only supported with merge-joinable join conditions
--------------------------

My question is: why on clause restrict "t_1.a=1"?

I test it in Oracle, it support to such as "t_1.a=1":
------------------------

SQL> SELECT * FROM TAB1;
         A          B          C
---------- ---------- ----------
         2
         3
SQL> SELECT * FROM TAB2;
         A
----------
         1
         2
SQL> select * from tab1 full outer join tab2 on tab1.a=2;
         A          B          C          A
---------- ---------- ---------- ----------
         2                                1
         2                                2
         3
SQL> select * from tab1 left outer join tab2 on tab1.a=2;
         A          B          C          A
---------- ---------- ---------- ----------
         2                                1
         2                                2
         3
SQL> select * from tab1 right outer join tab2 on tab1.a=2;
         A          B          C          A
---------- ---------- ---------- ----------
         2                                1
         2                                2

SQL> select * from tab1 right outer join tab2 on 1=1;
         A          B          C          A
---------- ---------- ---------- ----------
         2                                1
         3                                1
         2                                2
         3                                2
SQL> select * from tab1 right outer join tab2 on tab2.a=2;
         A          B          C          A
---------- ---------- ---------- ----------
                                          1
         2                                2
         3                                2 



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux