|
|
|
@ -102,6 +102,7 @@ |
|
|
|
Why? |
|
|
|
Why? |
|
|
|
4.22) How do I create a column that will default to the current time? |
|
|
|
4.22) How do I create a column that will default to the current time? |
|
|
|
4.23) Why are my subqueries using IN so slow? |
|
|
|
4.23) Why are my subqueries using IN so slow? |
|
|
|
|
|
|
|
4.24) How do I do an outer join? |
|
|
|
|
|
|
|
|
|
|
|
Extending PostgreSQL |
|
|
|
Extending PostgreSQL |
|
|
|
|
|
|
|
|
|
|
|
@ -334,11 +335,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
Features |
|
|
|
Features |
|
|
|
PostgreSQL has most features present in large commercial |
|
|
|
PostgreSQL has most features present in large commercial |
|
|
|
DBMS's, like transactions, subselects, triggers, views, and |
|
|
|
DBMS's, like transactions, subselects, triggers, views, foreign |
|
|
|
sophisticated locking. We have some features they don't have, |
|
|
|
key referential integrity, and sophisticated locking. We have |
|
|
|
like user-defined types, inheritance, rules, and multi-version |
|
|
|
some features they don't have, like user-defined types, |
|
|
|
concurrency control to reduce lock contention. We don't have |
|
|
|
inheritance, rules, and multi-version concurrency control to |
|
|
|
foreign key referential integrity or outer joins, but are |
|
|
|
reduce lock contention. We don't have outer joins, but are |
|
|
|
working on them for our next release. |
|
|
|
working on them for our next release. |
|
|
|
|
|
|
|
|
|
|
|
Performance |
|
|
|
Performance |
|
|
|
@ -395,10 +396,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
2.1) Are there ODBC drivers for PostgreSQL? |
|
|
|
2.1) Are there ODBC drivers for PostgreSQL? |
|
|
|
|
|
|
|
|
|
|
|
There are two ODBC drivers available, PostODBC and OpenLink ODBC. |
|
|
|
There are two ODBC drivers available, PsqlODBC and OpenLink ODBC. |
|
|
|
|
|
|
|
|
|
|
|
PostODBC is included in the distribution. More information about it |
|
|
|
PsqlODBC is included in the distribution. More information about it |
|
|
|
can be gotten from: http://www.insightdist.com/psqlodbc |
|
|
|
can be gotten from: ftp://ftp.postgresql.org/pub/odbc/index.html |
|
|
|
|
|
|
|
|
|
|
|
OpenLink ODBC can be gotten from http://www.openlinksw.com. It works |
|
|
|
OpenLink ODBC can be gotten from http://www.openlinksw.com. It works |
|
|
|
with their standard ODBC client software so you'll have PostgreSQL |
|
|
|
with their standard ODBC client software so you'll have PostgreSQL |
|
|
|
@ -409,6 +410,8 @@ |
|
|
|
commercial-quality support, but a freeware version will always be |
|
|
|
commercial-quality support, but a freeware version will always be |
|
|
|
available. Questions to postgres95@openlink.co.uk. |
|
|
|
available. Questions to postgres95@openlink.co.uk. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See also the ODBC chapter of the Programmer's Guide. |
|
|
|
|
|
|
|
|
|
|
|
2.2) What tools are available for hooking PostgreSQL to Web pages? |
|
|
|
2.2) What tools are available for hooking PostgreSQL to Web pages? |
|
|
|
|
|
|
|
|
|
|
|
A nice introduction to Database-backed Web pages can be seen at: |
|
|
|
A nice introduction to Database-backed Web pages can be seen at: |
|
|
|
@ -971,12 +974,9 @@ BYTEA bytea variable-length array of bytes |
|
|
|
|
|
|
|
|
|
|
|
4.22) How do I create a column that will default to the current time? |
|
|
|
4.22) How do I create a column that will default to the current time? |
|
|
|
|
|
|
|
|
|
|
|
This way always works: |
|
|
|
Use now(): |
|
|
|
CREATE TABLE test (x int, modtime timestamp default now() ); |
|
|
|
CREATE TABLE test (x int, modtime timestamp default now() ); |
|
|
|
|
|
|
|
|
|
|
|
In releases 7.0 and later, you may use: |
|
|
|
|
|
|
|
create table test (x int, modtime timestamp default 'now'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4.23) Why are my subqueries using IN so slow? |
|
|
|
4.23) Why are my subqueries using IN so slow? |
|
|
|
|
|
|
|
|
|
|
|
Currently, we join subqueries to outer queries by sequential scanning |
|
|
|
Currently, we join subqueries to outer queries by sequential scanning |
|
|
|
@ -992,6 +992,21 @@ BYTEA bytea variable-length array of bytes |
|
|
|
WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2) |
|
|
|
WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2) |
|
|
|
|
|
|
|
|
|
|
|
We hope to fix this limitation in a future release. |
|
|
|
We hope to fix this limitation in a future release. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4.24) How do I do an outer join? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PostgreSQL does not support outer joins in the current release. They |
|
|
|
|
|
|
|
can be simulated using UNION and NOT IN. For example, when joining |
|
|
|
|
|
|
|
tab1 and tab2, the following query does an outer join of the two |
|
|
|
|
|
|
|
tables: |
|
|
|
|
|
|
|
SELECT tab1.col1, tab2.col2 |
|
|
|
|
|
|
|
FROM tab1, tab2 |
|
|
|
|
|
|
|
WHERE tab1.col1 = tab2.col1 |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
SELECT tab1.col1, NULL |
|
|
|
|
|
|
|
FROM tab1 |
|
|
|
|
|
|
|
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2) |
|
|
|
|
|
|
|
ORDER BY tab1.col1 |
|
|
|
_________________________________________________________________ |
|
|
|
_________________________________________________________________ |
|
|
|
|
|
|
|
|
|
|
|
Extending PostgreSQL |
|
|
|
Extending PostgreSQL |
|
|
|
|