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
334
335
335
336
Features
336
337
PostgreSQL has most features present in large commercial
337
- DBMS's, like transactions, subselects, triggers, views,and
338
- sophisticated locking. We have some features they don't have,
339
- like user-defined types, inheritance, rules, and multi-version
340
- concurrency control to reduce lock contention. We don't have
341
- foreign key referential integrity or outer joins, but are
338
+ DBMS's, like transactions, subselects, triggers, views,foreign
339
+ key referential integrity, and sophisticated locking. We have
340
+ some features they don't have, like user-defined types,
341
+ inheritance, rules, and multi-version concurrency control to
342
+ reduce lock contention. We don't have outer joins, but are
342
343
working on them for our next release.
343
344
344
345
Performance
395
396
396
397
2.1) Are there ODBC drivers for PostgreSQL?
397
398
398
- There are two ODBC drivers available,PostODBC and OpenLink ODBC.
399
+ There are two ODBC drivers available,PsqlODBC and OpenLink ODBC.
399
400
400
- PostODBC is included in the distribution. More information about it
401
- can be gotten from:http ://www.insightdist.com/psqlodbc
401
+ PsqlODBC is included in the distribution. More information about it
402
+ can be gotten from:ftp ://ftp.postgresql.org/pub/odbc/index.html
402
403
403
404
OpenLink ODBC can be gotten from http://www.openlinksw.com. It works
404
405
with their standard ODBC client software so you'll have PostgreSQL
409
410
commercial-quality support, but a freeware version will always be
410
411
available. Questions to postgres95@openlink.co.uk.
411
412
413
+ See also the ODBC chapter of the Programmer's Guide.
414
+
412
415
2.2) What tools are available for hooking PostgreSQL to Web pages?
413
416
414
417
A nice introduction to Database-backed Web pages can be seen at:
@@ -971,12 +974,9 @@ BYTEA bytea variable-length array of bytes
971
974
972
975
4.22) How do I create a column that will default to the current time?
973
976
974
- This way always works :
977
+ Use now() :
975
978
CREATE TABLE test (x int, modtime timestamp default now() );
976
979
977
- In releases 7.0 and later, you may use:
978
- create table test (x int, modtime timestamp default 'now');
979
-
980
980
4.23) Why are my subqueries using IN so slow?
981
981
982
982
Currently, we join subqueries to outer queries by sequential scanning
@@ -992,6 +992,21 @@ BYTEA bytea variable-length array of bytes
992
992
WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2)
993
993
994
994
We hope to fix this limitation in a future release.
995
+
996
+ 4.24) How do I do an outer join?
997
+
998
+ PostgreSQL does not support outer joins in the current release. They
999
+ can be simulated using UNION and NOT IN. For example, when joining
1000
+ tab1 and tab2, the following query does an outer join of the two
1001
+ tables:
1002
+ SELECT tab1.col1, tab2.col2
1003
+ FROM tab1, tab2
1004
+ WHERE tab1.col1 = tab2.col1
1005
+ UNION ALL
1006
+ SELECT tab1.col1, NULL
1007
+ FROM tab1
1008
+ WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
1009
+ ORDER BY tab1.col1
995
1010
_________________________________________________________________
996
1011
997
1012
Extending PostgreSQL