|
102 | 102 | Why?
|
103 | 103 | 4.22) How do I create a column that will default to the current time?
|
104 | 104 | 4.23) Why are my subqueries using IN so slow?
|
| 105 | + 4.24) How do I do an outer join? |
105 | 106 |
|
106 | 107 | Extending PostgreSQL
|
107 | 108 |
|
@@ -992,6 +993,21 @@ BYTEA bytea variable-length array of bytes
|
992 | 993 | WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2)
|
993 | 994 |
|
994 | 995 | We hope to fix this limitation in a future release.
|
| 996 | + |
| 997 | + 4.24) How do I do an outer join? |
| 998 | + |
| 999 | + PostgreSQL does not support outer joins in the current release. They |
| 1000 | + can be simulated using UNION and NOT IN. For example, when joining |
| 1001 | + tab1 and tab2, the following query does an outer join of the two |
| 1002 | + tables: |
| 1003 | + SELECT tab1.col1, tab2.col2 |
| 1004 | + FROM tab1, tab2 |
| 1005 | + WHERE tab1.col1 = tab2.col1 |
| 1006 | + UNION ALL |
| 1007 | + SELECT tab1.col1, NULL |
| 1008 | + FROM tab1 |
| 1009 | + WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2) |
| 1010 | + ORDER BY tab1.col1 |
995 | 1011 | _________________________________________________________________
|
996 | 1012 |
|
997 | 1013 | Extending PostgreSQL
|
|