Improvements to Ian Barwick patch.
This commit is contained in:
parent
0896707ef6
commit
daaf999fcb
36
doc/FAQ
36
doc/FAQ
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL
|
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||||
|
|
||||||
Last updated: Sun Oct 13 22:49:56 EDT 2002
|
Last updated: Sun Oct 13 23:15:09 EDT 2002
|
||||||
|
|
||||||
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
3.6) How do I tune the database engine for better performance?
|
3.6) How do I tune the database engine for better performance?
|
||||||
3.7) What debugging features are available?
|
3.7) What debugging features are available?
|
||||||
3.8) Why do I get "Sorry, too many clients" when trying to connect?
|
3.8) Why do I get "Sorry, too many clients" when trying to connect?
|
||||||
3.9) What are the pg_sorttempNNN.NN files in my database directory?
|
3.9) What is in the pgsql_tmp directory?
|
||||||
3.10) Why do I need to do a dump and restore to upgrade PostgreSQL
|
3.10) Why do I need to do a dump and restore to upgrade PostgreSQL
|
||||||
releases?
|
releases?
|
||||||
|
|
||||||
|
@ -197,8 +197,7 @@
|
||||||
distribution or the MS Windows FAQ at
|
distribution or the MS Windows FAQ at
|
||||||
http://www.PostgreSQL.org/docs/faq-mswin.html.
|
http://www.PostgreSQL.org/docs/faq-mswin.html.
|
||||||
|
|
||||||
A native port to some Microsoft platforms is currently being worked
|
A native port to MS Win NT/2000/XP is currently being worked on.
|
||||||
upon.
|
|
||||||
|
|
||||||
1.5) Where can I get PostgreSQL?
|
1.5) Where can I get PostgreSQL?
|
||||||
|
|
||||||
|
@ -368,7 +367,7 @@
|
||||||
1.15) How can I financially assist PostgreSQL?
|
1.15) How can I financially assist PostgreSQL?
|
||||||
|
|
||||||
PostgreSQL has had a first-class infrastructure since we started in
|
PostgreSQL has had a first-class infrastructure since we started in
|
||||||
1994. This is all thanks to Marc Fournier, who has created and managed
|
1996. This is all thanks to Marc Fournier, who has created and managed
|
||||||
this infrastructure over the years.
|
this infrastructure over the years.
|
||||||
|
|
||||||
Quality infrastructure is very important to an open-source project. It
|
Quality infrastructure is very important to an open-source project. It
|
||||||
|
@ -419,9 +418,9 @@
|
||||||
2.3) Does PostgreSQL have a graphical user interface? A report generator?
|
2.3) Does PostgreSQL have a graphical user interface? A report generator?
|
||||||
An embedded query language interface?
|
An embedded query language interface?
|
||||||
|
|
||||||
We have a nice graphical user interface called PgAccess, which is
|
We have a nice graphical user interface called PgAccess which can also
|
||||||
shipped as part of the distribution. PgAccess also has a report
|
be used as a report generator. The Web page is
|
||||||
generator. The Web page is http://www.pgaccess.org/.
|
http://www.pgaccess.org/.
|
||||||
|
|
||||||
We also include ecpg, which is an embedded SQL query language
|
We also include ecpg, which is an embedded SQL query language
|
||||||
interface for C.
|
interface for C.
|
||||||
|
@ -433,7 +432,7 @@
|
||||||
* C++ (libpq++)
|
* C++ (libpq++)
|
||||||
* Embedded C (ecpg)
|
* Embedded C (ecpg)
|
||||||
* Java (jdbc)
|
* Java (jdbc)
|
||||||
* Perl (DBD::Pg)
|
* Perl (DBD::Pg and perl5)
|
||||||
* ODBC (odbc)
|
* ODBC (odbc)
|
||||||
* Python (PyGreSQL)
|
* Python (PyGreSQL)
|
||||||
* TCL (libpgtcl)
|
* TCL (libpgtcl)
|
||||||
|
@ -441,7 +440,8 @@
|
||||||
* PHP ('pg_' functions, Pear::DB)
|
* PHP ('pg_' functions, Pear::DB)
|
||||||
|
|
||||||
Additional interfaces are available at
|
Additional interfaces are available at
|
||||||
http://www.PostgreSQL.org/interfaces.html.
|
http://www.PostgreSQL.org/interfaces.html and
|
||||||
|
http://gborg.PostgreSQL.org.
|
||||||
_________________________________________________________________
|
_________________________________________________________________
|
||||||
|
|
||||||
Administrative Questions
|
Administrative Questions
|
||||||
|
@ -596,16 +596,16 @@
|
||||||
was 64, and changing it required a rebuild after altering the
|
was 64, and changing it required a rebuild after altering the
|
||||||
MaxBackendId constant in include/storage/sinvaladt.h.
|
MaxBackendId constant in include/storage/sinvaladt.h.
|
||||||
|
|
||||||
3.9) What are the pg_tempNNN.NN files in my database directory?
|
3.9) What are the pgsql_tmp directory?
|
||||||
|
|
||||||
They are temporary files generated by the query executor. For example,
|
They are temporary files generated by the query executor. For example,
|
||||||
if a sort needs to be done to satisfy an ORDER BY, and the sort
|
if a sort needs to be done to satisfy an ORDER BY, and the sort
|
||||||
requires more space than the backend's -S parameter allows, then
|
requires more space than the backend's -S parameter allows, then
|
||||||
temporary files are created to hold the extra data.
|
temporary files are created to hold the extra data.
|
||||||
|
|
||||||
The temporary files should be deleted automatically, but might not if
|
The temporary files are usually deleted automatically, but might
|
||||||
a backend crashes during a sort. If you have no backends running at
|
remain if a backend crashes during a sort. A stop and restart of the
|
||||||
the time, it is safe to delete the pg_tempNNN.NN files.
|
postmaster will remove files from those directories.
|
||||||
|
|
||||||
3.10) Why do I need to do a dump and restore to upgrade between major
|
3.10) Why do I need to do a dump and restore to upgrade between major
|
||||||
PostgreSQL releases?
|
PostgreSQL releases?
|
||||||
|
@ -649,8 +649,8 @@
|
||||||
|
|
||||||
4.4) How do you remove a column from a table?
|
4.4) How do you remove a column from a table?
|
||||||
|
|
||||||
Prior to version 7.3, ALTER TABLE DROP COLUMN is not supported. You
|
This functionality was added in release 7.3 with ALTER TABLE DROP
|
||||||
can do this instead:
|
COLUMN. In earlier versions, you can do this:
|
||||||
BEGIN;
|
BEGIN;
|
||||||
LOCK TABLE old_table;
|
LOCK TABLE old_table;
|
||||||
SELECT ... -- select all columns but the one you want to remove
|
SELECT ... -- select all columns but the one you want to remove
|
||||||
|
@ -815,11 +815,11 @@
|
||||||
Case-insensitive equality comparisons are normally expressed as:
|
Case-insensitive equality comparisons are normally expressed as:
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM tab
|
FROM tab
|
||||||
WHERE LOWER(col) = 'abc';
|
WHERE lower(col) = 'abc';
|
||||||
|
|
||||||
This will not use an standard index. However, if you create a
|
This will not use an standard index. However, if you create a
|
||||||
functional index, it will be used:
|
functional index, it will be used:
|
||||||
CREATE INDEX tabindex ON tab (LOWER(col));
|
CREATE INDEX tabindex ON tab (lower(col));
|
||||||
|
|
||||||
4.13) In a query, how do I detect if a field is NULL?
|
4.13) In a query, how do I detect if a field is NULL?
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
alink="#0000ff">
|
alink="#0000ff">
|
||||||
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
||||||
|
|
||||||
<P>Last updated: Sun Oct 13 22:49:56 EDT 2002</P>
|
<P>Last updated: Sun Oct 13 23:15:09 EDT 2002</P>
|
||||||
|
|
||||||
<P>Current maintainer: Bruce Momjian (<A href=
|
<P>Current maintainer: Bruce Momjian (<A href=
|
||||||
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
|
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
|
||||||
|
@ -78,8 +78,8 @@
|
||||||
<A href="#3.7">3.7</A>) What debugging features are available?<BR>
|
<A href="#3.7">3.7</A>) What debugging features are available?<BR>
|
||||||
<A href="#3.8">3.8</A>) Why do I get <I>"Sorry, too many
|
<A href="#3.8">3.8</A>) Why do I get <I>"Sorry, too many
|
||||||
clients"</I> when trying to connect?<BR>
|
clients"</I> when trying to connect?<BR>
|
||||||
<A href="#3.9">3.9</A>) What are the <I>pg_sorttempNNN.NN</I>
|
<A href="#3.9">3.9</A>) What is in the <I>pgsql_tmp</I>
|
||||||
files in my database directory?<BR>
|
directory?<BR>
|
||||||
<A href="#3.10">3.10</A>) Why do I need to do a dump and restore
|
<A href="#3.10">3.10</A>) Why do I need to do a dump and restore
|
||||||
to upgrade PostgreSQL releases?<BR>
|
to upgrade PostgreSQL releases?<BR>
|
||||||
|
|
||||||
|
@ -250,10 +250,11 @@
|
||||||
<P>The database server can run on Windows NT and Win2k using
|
<P>The database server can run on Windows NT and Win2k using
|
||||||
Cygwin, the Cygnus Unix/NT porting library. See
|
Cygwin, the Cygnus Unix/NT porting library. See
|
||||||
<I>pgsql/doc/FAQ_MSWIN</I> in the distribution or the MS Windows FAQ
|
<I>pgsql/doc/FAQ_MSWIN</I> in the distribution or the MS Windows FAQ
|
||||||
at <A href="http://www.PostgreSQL.org/docs/faq-mswin.html">http://www.PostgreSQL.org/docs/faq-mswin.html</A>.</P>
|
at <A href="http://www.PostgreSQL.org/docs/faq-mswin.html">
|
||||||
|
http://www.PostgreSQL.org/docs/faq-mswin.html</A>.</P>
|
||||||
|
|
||||||
<p>A native port to some Microsoft platforms is currently being worked
|
<p>A native port to MS Win NT/2000/XP is currently being worked
|
||||||
upon.</p>
|
on.</p>
|
||||||
|
|
||||||
<H4><A name="1.5">1.5</A>) Where can I get PostgreSQL?</H4>
|
<H4><A name="1.5">1.5</A>) Where can I get PostgreSQL?</H4>
|
||||||
|
|
||||||
|
@ -484,7 +485,7 @@
|
||||||
PostgreSQL?</H4>
|
PostgreSQL?</H4>
|
||||||
|
|
||||||
<P>PostgreSQL has had a first-class infrastructure since we started
|
<P>PostgreSQL has had a first-class infrastructure since we started
|
||||||
in 1994. This is all thanks to Marc Fournier, who has created
|
in 1996. This is all thanks to Marc Fournier, who has created
|
||||||
and managed this infrastructure over the years.</P>
|
and managed this infrastructure over the years.</P>
|
||||||
|
|
||||||
<P>Quality infrastructure is very important to an open-source
|
<P>Quality infrastructure is very important to an open-source
|
||||||
|
@ -545,9 +546,9 @@
|
||||||
interface? A report generator? An embedded query language
|
interface? A report generator? An embedded query language
|
||||||
interface?</H4>
|
interface?</H4>
|
||||||
|
|
||||||
<P>We have a nice graphical user interface called PgAccess, which is
|
<P>We have a nice graphical user interface called PgAccess which can
|
||||||
shipped as part of the distribution. PgAccess also has a report
|
also be used as a report generator. The Web page is
|
||||||
generator. The Web page is <A href="http://www.pgaccess.org/">http://www.pgaccess.org/</A>.</P>
|
<A href="http://www.pgaccess.org/">http://www.pgaccess.org/</A>.</P>
|
||||||
|
|
||||||
<P>We also include <I>ecpg</I>, which is an embedded SQL query
|
<P>We also include <I>ecpg</I>, which is an embedded SQL query
|
||||||
language interface for C.</P>
|
language interface for C.</P>
|
||||||
|
@ -565,7 +566,7 @@
|
||||||
|
|
||||||
<LI>Java (jdbc)</LI>
|
<LI>Java (jdbc)</LI>
|
||||||
|
|
||||||
<LI>Perl (DBD::Pg)</LI>
|
<LI>Perl (DBD::Pg and perl5)</LI>
|
||||||
|
|
||||||
<LI>ODBC (odbc)</LI>
|
<LI>ODBC (odbc)</LI>
|
||||||
|
|
||||||
|
@ -578,7 +579,9 @@
|
||||||
<LI>PHP ('pg_' functions, Pear::DB)</LI>
|
<LI>PHP ('pg_' functions, Pear::DB)</LI>
|
||||||
</UL>
|
</UL>
|
||||||
<P>Additional interfaces are available at
|
<P>Additional interfaces are available at
|
||||||
<a href="http://www.PostgreSQL.org/interfaces.html">http://www.PostgreSQL.org/interfaces.html</A>.
|
<a href="http://www.PostgreSQL.org/interfaces.html">http://www.PostgreSQL.org/interfaces.html</A>
|
||||||
|
and
|
||||||
|
<a href="http://gborg.PostgreSQL.org">http://gborg.PostgreSQL.org</A>.
|
||||||
</P>
|
</P>
|
||||||
<HR>
|
<HR>
|
||||||
|
|
||||||
|
@ -765,8 +768,8 @@
|
||||||
the MaxBackendId constant in
|
the MaxBackendId constant in
|
||||||
<I>include/storage/sinvaladt.h</I>.</P>
|
<I>include/storage/sinvaladt.h</I>.</P>
|
||||||
|
|
||||||
<H4><A name="3.9">3.9</A>) What are the <I>pg_tempNNN.NN</I>
|
<H4><A name="3.9">3.9</A>) What are the <I>pgsql_tmp</I>
|
||||||
files in my database directory?</H4>
|
directory?</H4>
|
||||||
|
|
||||||
<P>They are temporary files generated by the query executor. For
|
<P>They are temporary files generated by the query executor. For
|
||||||
example, if a sort needs to be done to satisfy an <SMALL>ORDER
|
example, if a sort needs to be done to satisfy an <SMALL>ORDER
|
||||||
|
@ -774,10 +777,9 @@
|
||||||
<I>-S</I> parameter allows, then temporary files are created to
|
<I>-S</I> parameter allows, then temporary files are created to
|
||||||
hold the extra data.</P>
|
hold the extra data.</P>
|
||||||
|
|
||||||
<P>The temporary files should be deleted automatically, but might
|
<P>The temporary files are usually deleted automatically, but might
|
||||||
not if a backend crashes during a sort. If you have no backends
|
remain if a backend crashes during a sort. A stop and restart of the
|
||||||
running at the time, it is safe to delete the pg_tempNNN.NN
|
<I>postmaster</I> will remove files from those directories.</P>
|
||||||
files.</P>
|
|
||||||
|
|
||||||
<H4><A name="3.10">3.10</A>) Why do I need to do a dump and restore
|
<H4><A name="3.10">3.10</A>) Why do I need to do a dump and restore
|
||||||
to upgrade between major PostgreSQL releases?</H4>
|
to upgrade between major PostgreSQL releases?</H4>
|
||||||
|
@ -790,10 +792,10 @@
|
||||||
data in a generic format that can then be loaded in using the new internal
|
data in a generic format that can then be loaded in using the new internal
|
||||||
format.</P>
|
format.</P>
|
||||||
|
|
||||||
<p>In releases where the on-disk format does not change, the
|
<P>In releases where the on-disk format does not change, the
|
||||||
<i>pg_upgrade</i> script can be used to upgrade without a dump/restore.
|
<I>pg_upgrade</I> script can be used to upgrade without a dump/restore.
|
||||||
The release notes mention whether <i>pg_upgrade</i> is available for the
|
The release notes mention whether <I>pg_upgrade</I> is available for the
|
||||||
release.</p>
|
release.</P>
|
||||||
|
|
||||||
<HR>
|
<HR>
|
||||||
|
|
||||||
|
@ -831,8 +833,9 @@
|
||||||
<H4><A name="4.4">4.4</A>) How do you remove a column from a
|
<H4><A name="4.4">4.4</A>) How do you remove a column from a
|
||||||
table?</H4>
|
table?</H4>
|
||||||
|
|
||||||
<P>Prior to version 7.3, <SMALL>ALTER TABLE DROP COLUMN</SMALL> is not supported.
|
<P>This functionality was added in release 7.3 with
|
||||||
You can do this instead:</P>
|
<SMALL>ALTER TABLE DROP COLUMN</SMALL>. In earlier versions,
|
||||||
|
you can do this:</P>
|
||||||
<PRE>
|
<PRE>
|
||||||
BEGIN;
|
BEGIN;
|
||||||
LOCK TABLE old_table;
|
LOCK TABLE old_table;
|
||||||
|
@ -1023,13 +1026,13 @@
|
||||||
<PRE>
|
<PRE>
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM tab
|
FROM tab
|
||||||
WHERE LOWER(col) = 'abc';
|
WHERE lower(col) = 'abc';
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
This will not use an standard index. However, if you create a
|
This will not use an standard index. However, if you create a
|
||||||
functional index, it will be used:
|
functional index, it will be used:
|
||||||
<PRE>
|
<PRE>
|
||||||
CREATE INDEX tabindex ON tab (LOWER(col));
|
CREATE INDEX tabindex ON tab (lower(col));
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
<H4><A name="4.13">4.13</A>) In a query, how do I detect if a field
|
<H4><A name="4.13">4.13</A>) In a query, how do I detect if a field
|
||||||
|
@ -1118,7 +1121,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
|
||||||
and your <SMALL>SERIAL</SMALL> column, respectively.
|
and your <SMALL>SERIAL</SMALL> column, respectively.
|
||||||
|
|
||||||
<P>Alternatively, you could retrieve the assigned
|
<P>Alternatively, you could retrieve the assigned
|
||||||
<SMALL>SERIAL</SMALL> value with the <I>currval</I>() function
|
<SMALL>SERIAL</SMALL> value with the <I>currval()</I> function
|
||||||
<I>after</I> it was inserted by default, e.g.,</P>
|
<I>after</I> it was inserted by default, e.g.,</P>
|
||||||
<PRE>
|
<PRE>
|
||||||
execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
|
execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
|
||||||
|
@ -1135,7 +1138,7 @@ BYTEA bytea variable-length byte array (null-byte safe)
|
||||||
<H4><A name="4.15.3">4.15.3</A>) Don't <I>currval()</I> and
|
<H4><A name="4.15.3">4.15.3</A>) Don't <I>currval()</I> and
|
||||||
<I>nextval()</I> lead to a race condition with other users?</H4>
|
<I>nextval()</I> lead to a race condition with other users?</H4>
|
||||||
|
|
||||||
<P>No. <i>currval</i>() returns the current value assigned by your
|
<P>No. <I>currval()</I> returns the current value assigned by your
|
||||||
backend, not by all users.</P>
|
backend, not by all users.</P>
|
||||||
|
|
||||||
<H4><A name="4.15.4">4.15.4</A>) Why aren't my sequence numbers
|
<H4><A name="4.15.4">4.15.4</A>) Why aren't my sequence numbers
|
||||||
|
|
Loading…
Reference in New Issue