mirror of
https://github.com/postgres/postgres.git
synced 2025-08-08 06:02:22 +03:00
Backpatch FAQ to 8.0.X.
This commit is contained in:
54
doc/FAQ
54
doc/FAQ
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL
|
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||||
|
|
||||||
Last updated: Wed Feb 2 12:44:03 EST 2005
|
Last updated: Thu Feb 24 19:33:07 EST 2005
|
||||||
|
|
||||||
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
||||||
|
|
||||||
@@ -59,7 +59,8 @@
|
|||||||
4.8) How do I perform regular expression searches and case-insensitive
|
4.8) How do I perform regular expression searches and case-insensitive
|
||||||
regular expression searches? How do I use an index for
|
regular expression searches? How do I use an index for
|
||||||
case-insensitive searches?
|
case-insensitive searches?
|
||||||
4.9) In a query, how do I detect if a field is NULL?
|
4.9) In a query, how do I detect if a field is NULL? How can I sort on
|
||||||
|
whether a field is NULL or not?
|
||||||
4.10) What is the difference between the various character types?
|
4.10) What is the difference between the various character types?
|
||||||
4.11.1) How do I create a serial/auto-incrementing field?
|
4.11.1) How do I create a serial/auto-incrementing field?
|
||||||
4.11.2) How do I get the value of a SERIAL insert?
|
4.11.2) How do I get the value of a SERIAL insert?
|
||||||
@@ -76,8 +77,8 @@
|
|||||||
4.17) How do I perform an outer join?
|
4.17) How do I perform an outer join?
|
||||||
4.18) How do I perform queries using multiple databases?
|
4.18) How do I perform queries using multiple databases?
|
||||||
4.19) How do I return multiple rows or columns from a function?
|
4.19) How do I return multiple rows or columns from a function?
|
||||||
4.20) Why can't I reliably create/drop temporary tables in PL/PgSQL
|
4.20) Why do I get "missing oid" errors when accessing temporary
|
||||||
functions?
|
tables in PL/PgSQL functions?
|
||||||
4.21) What encryption options are available?
|
4.21) What encryption options are available?
|
||||||
|
|
||||||
Extending PostgreSQL
|
Extending PostgreSQL
|
||||||
@@ -119,7 +120,8 @@
|
|||||||
PostgreSQL Data Base Management System
|
PostgreSQL Data Base Management System
|
||||||
|
|
||||||
Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
Portions Copyright (c) 1994-6 Regents of the University of California
|
Portions Copyright (c) 1994-1996 Regents of the University of
|
||||||
|
California
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software and its
|
Permission to use, copy, modify, and distribute this software and its
|
||||||
documentation for any purpose, without fee, and without a written
|
documentation for any purpose, without fee, and without a written
|
||||||
@@ -160,7 +162,8 @@
|
|||||||
1.4) Where can I get PostgreSQL?
|
1.4) Where can I get PostgreSQL?
|
||||||
|
|
||||||
The primary anonymous ftp site for PostgreSQL is
|
The primary anonymous ftp site for PostgreSQL is
|
||||||
ftp://ftp.PostgreSQL.org/pub. For mirror sites, see our main web site.
|
ftp://ftp.PostgreSQL.org/pub/. For mirror sites, see our main web
|
||||||
|
site.
|
||||||
|
|
||||||
1.5) Where can I get support?
|
1.5) Where can I get support?
|
||||||
|
|
||||||
@@ -177,14 +180,14 @@
|
|||||||
EFNet.
|
EFNet.
|
||||||
|
|
||||||
A list of commercial support companies is available at
|
A list of commercial support companies is available at
|
||||||
http://techdocs.postg resql.org/companies.php.
|
http://techdocs.postgresql.org/companies.php.
|
||||||
|
|
||||||
1.6) How do I submit a bug report?
|
1.6) How do I submit a bug report?
|
||||||
|
|
||||||
Visit the PostgreSQL bug form at
|
Visit the PostgreSQL bug form at
|
||||||
http://www.postgresql.org/support/submitbug.
|
http://www.postgresql.org/support/submitbug.
|
||||||
|
|
||||||
Also check out our ftp site ftp://ftp.PostgreSQL.org/pub to see if
|
Also check out our ftp site ftp://ftp.PostgreSQL.org/pub/ to see if
|
||||||
there is a more recent PostgreSQL version.
|
there is a more recent PostgreSQL version.
|
||||||
|
|
||||||
1.7) What is the latest release?
|
1.7) What is the latest release?
|
||||||
@@ -200,7 +203,7 @@
|
|||||||
also browse the manuals online at http://www.PostgreSQL.org/docs.
|
also browse the manuals online at http://www.PostgreSQL.org/docs.
|
||||||
|
|
||||||
There are two PostgreSQL books available online at
|
There are two PostgreSQL books available online at
|
||||||
http://www.PostgreSQL.org/docs/awbook.html and
|
http://www.postgresql.org/docs/books/awbook.html and
|
||||||
http://www.commandprompt.com/ppbook/. There is a list of PostgreSQL
|
http://www.commandprompt.com/ppbook/. There is a list of PostgreSQL
|
||||||
books available for purchase at
|
books available for purchase at
|
||||||
http://techdocs.PostgreSQL.org/techdocs/bookreviews.php. There is also
|
http://techdocs.PostgreSQL.org/techdocs/bookreviews.php. There is also
|
||||||
@@ -220,9 +223,10 @@
|
|||||||
|
|
||||||
1.10) How can I learn SQL?
|
1.10) How can I learn SQL?
|
||||||
|
|
||||||
The PostgreSQL book at http://www.PostgreSQL.org/docs/awbook.html
|
The PostgreSQL book at
|
||||||
teaches SQL. There is another PostgreSQL book at
|
http://www.postgresql.org/docs/books/awbook.html teaches SQL. There is
|
||||||
http://www.commandprompt.com/ppbook. There is a nice tutorial at
|
another PostgreSQL book at http://www.commandprompt.com/ppbook. There
|
||||||
|
is a nice tutorial at
|
||||||
http://www.intermedia.net/support/sql/sqltut.shtm, at
|
http://www.intermedia.net/support/sql/sqltut.shtm, at
|
||||||
http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM,
|
http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM,
|
||||||
and at http://sqlcourse.com.
|
and at http://sqlcourse.com.
|
||||||
@@ -317,15 +321,15 @@
|
|||||||
For Web integration, PHP (http://www.php.net) is an excellent
|
For Web integration, PHP (http://www.php.net) is an excellent
|
||||||
interface.
|
interface.
|
||||||
|
|
||||||
For complex cases, many use the Perl and CGI.pm or mod_perl.
|
For complex cases, many use the Perl DBD::Pg with CGI.pm or mod_perl.
|
||||||
|
|
||||||
2.3) Does PostgreSQL have a graphical user interface?
|
2.3) Does PostgreSQL have a graphical user interface?
|
||||||
|
|
||||||
Yes, there are several graphical interfaces to PostgreSQL available.
|
Yes, there are several graphical interfaces to PostgreSQL available.
|
||||||
These include pgAdmin III (http://www.pgadmin.org, PgAccess
|
These include pgAdmin III (http://www.pgadmin.org, PgAccess
|
||||||
http://www.pgaccess.org), RHDB Admin (http://sources.redhat.com/rhd b/
|
http://www.pgaccess.org), RHDB Admin (http://sources.redhat.com/rhdb/
|
||||||
), TORA (http://www.globecom.net/tora/, partly commercial), and Rekall
|
), TORA ( http://www.globecom.net/tora/, partly commercial), and
|
||||||
( http://www.rekallrevealed.org/). There is also PhpPgAdmin (
|
Rekall ( http://www.rekallrevealed.org/). There is also PhpPgAdmin (
|
||||||
http://phppgadmin.sourceforge.net/ ), a web-based interface to
|
http://phppgadmin.sourceforge.net/ ), a web-based interface to
|
||||||
PostgreSQL.
|
PostgreSQL.
|
||||||
|
|
||||||
@@ -633,9 +637,21 @@
|
|||||||
expresssion index, it will be used:
|
expresssion index, it will be used:
|
||||||
CREATE INDEX tabindex ON tab (lower(col));
|
CREATE INDEX tabindex ON tab (lower(col));
|
||||||
|
|
||||||
4.9) In a query, how do I detect if a field is NULL?
|
4.9) In a query, how do I detect if a field is NULL? How can I sort on
|
||||||
|
whether a field is NULL or not?
|
||||||
|
|
||||||
You test the column with IS NULL and IS NOT NULL.
|
You test the column with IS NULL and IS NOT NULL.
|
||||||
|
SELECT *
|
||||||
|
FROM tab
|
||||||
|
WHERE col IS NULL;
|
||||||
|
|
||||||
|
To sort by the NULL status, use the IS NULL and IS NOT NULL modifiers
|
||||||
|
in your WHERE clause. Things that are true will sort higher than
|
||||||
|
things that are false, so the following will put NULL entries at the
|
||||||
|
top of the resulting list:
|
||||||
|
SELECT *
|
||||||
|
FROM tab
|
||||||
|
ORDER BY (col IS NOT NULL)
|
||||||
|
|
||||||
4.10) What is the difference between the various character types?
|
4.10) What is the difference between the various character types?
|
||||||
|
|
||||||
@@ -804,8 +820,8 @@
|
|||||||
It is easy using set-returning functions,
|
It is easy using set-returning functions,
|
||||||
http://techdocs.postgresql.org/guides/SetReturningFunctions.
|
http://techdocs.postgresql.org/guides/SetReturningFunctions.
|
||||||
|
|
||||||
4.20) Why can't I reliably create/drop temporary tables in PL/PgSQL
|
4.20) Why do I get "missing oid" errors when accessing temporary tables in
|
||||||
functions?
|
PL/PgSQL functions?
|
||||||
|
|
||||||
PL/PgSQL caches function scripts, and an unfortunate side effect is
|
PL/PgSQL caches function scripts, and an unfortunate side effect is
|
||||||
that if a PL/PgSQL function accesses a temporary table, and that table
|
that if a PL/PgSQL function accesses a temporary table, and that table
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
alink="#0000ff">
|
alink="#0000ff">
|
||||||
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
||||||
|
|
||||||
<P>Last updated: Wed Feb 2 12:44:03 EST 2005</P>
|
<P>Last updated: Thu Feb 24 19:33:07 EST 2005</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>)
|
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)
|
||||||
@@ -85,7 +85,8 @@
|
|||||||
searches and case-insensitive regular expression searches? How do I
|
searches and case-insensitive regular expression searches? How do I
|
||||||
use an index for case-insensitive searches?<BR>
|
use an index for case-insensitive searches?<BR>
|
||||||
<A href="#4.9">4.9</A>) In a query, how do I detect if a field
|
<A href="#4.9">4.9</A>) In a query, how do I detect if a field
|
||||||
is <SMALL>NULL</SMALL>?<BR>
|
is <SMALL>NULL</SMALL>? How can I sort on whether a field is <SMALL>
|
||||||
|
NULL</SMALL> or not?<BR>
|
||||||
<A href="#4.10">4.10</A>) What is the difference between the
|
<A href="#4.10">4.10</A>) What is the difference between the
|
||||||
various character types?<BR>
|
various character types?<BR>
|
||||||
<A href="#4.11.1">4.11.1</A>) How do I create a
|
<A href="#4.11.1">4.11.1</A>) How do I create a
|
||||||
@@ -112,8 +113,8 @@
|
|||||||
databases?<BR>
|
databases?<BR>
|
||||||
<A href="#4.19">4.19</A>) How do I return multiple rows or columns
|
<A href="#4.19">4.19</A>) How do I return multiple rows or columns
|
||||||
from a function?<BR>
|
from a function?<BR>
|
||||||
<A href="#4.20">4.20</A>) Why can't I reliably create/drop
|
<A href="#4.20">4.20</A>) Why do I get "missing oid" errors when
|
||||||
temporary tables in PL/PgSQL functions?<BR>
|
accessing temporary tables in PL/PgSQL functions?<BR>
|
||||||
<A href="#4.21">4.21</A>) What encryption options are available?<BR>
|
<A href="#4.21">4.21</A>) What encryption options are available?<BR>
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +163,7 @@
|
|||||||
<P>PostgreSQL Data Base Management System</P>
|
<P>PostgreSQL Data Base Management System</P>
|
||||||
|
|
||||||
<P>Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
<P>Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
Portions Copyright (c) 1994-6 Regents of the University of California</P>
|
Portions Copyright (c) 1994-1996 Regents of the University of California</P>
|
||||||
|
|
||||||
<P>Permission to use, copy, modify, and distribute this software
|
<P>Permission to use, copy, modify, and distribute this software
|
||||||
and its documentation for any purpose, without fee, and without a
|
and its documentation for any purpose, without fee, and without a
|
||||||
@@ -206,7 +207,7 @@
|
|||||||
<H4><A name="1.4">1.4</A>) Where can I get PostgreSQL?</H4>
|
<H4><A name="1.4">1.4</A>) Where can I get PostgreSQL?</H4>
|
||||||
|
|
||||||
<P>The primary anonymous ftp site for PostgreSQL is <A href=
|
<P>The primary anonymous ftp site for PostgreSQL is <A href=
|
||||||
"ftp://ftp.PostgreSQL.org/pub">ftp://ftp.PostgreSQL.org/pub</A>.
|
"ftp://ftp.PostgreSQL.org/pub/">ftp://ftp.PostgreSQL.org/pub/</A>.
|
||||||
For mirror sites, see our main web site.</P>
|
For mirror sites, see our main web site.</P>
|
||||||
|
|
||||||
<H4><A name="1.5">1.5</A>) Where can I get support?</H4>
|
<H4><A name="1.5">1.5</A>) Where can I get support?</H4>
|
||||||
@@ -225,8 +226,8 @@
|
|||||||
(<I>#postgresqlfr</I>). There is also a PostgreSQL channel on EFNet.
|
(<I>#postgresqlfr</I>). There is also a PostgreSQL channel on EFNet.
|
||||||
|
|
||||||
<P>A list of commercial support companies is available at <A href=
|
<P>A list of commercial support companies is available at <A href=
|
||||||
"http://techdocs.postgresql.org/companies.php">http://techdocs.postg
|
"http://techdocs.postgresql.org/companies.php">
|
||||||
resql.org/companies.php</A>.</P>
|
http://techdocs.postgresql.org/companies.php</A>.</P>
|
||||||
|
|
||||||
<H4><A name="1.6">1.6</A>) How do I submit a bug report?</H4>
|
<H4><A name="1.6">1.6</A>) How do I submit a bug report?</H4>
|
||||||
|
|
||||||
@@ -235,7 +236,7 @@
|
|||||||
http://www.postgresql.org/support/submitbug</A>.</P>
|
http://www.postgresql.org/support/submitbug</A>.</P>
|
||||||
|
|
||||||
<P>Also check out our ftp site <A href=
|
<P>Also check out our ftp site <A href=
|
||||||
"ftp://ftp.PostgreSQL.org/pub">ftp://ftp.PostgreSQL.org/pub</A> to
|
"ftp://ftp.PostgreSQL.org/pub/">ftp://ftp.PostgreSQL.org/pub/</A> to
|
||||||
see if there is a more recent PostgreSQL version.</P>
|
see if there is a more recent PostgreSQL version.</P>
|
||||||
|
|
||||||
<H4><A name="1.7">1.7</A>) What is the latest release?</H4>
|
<H4><A name="1.7">1.7</A>) What is the latest release?</H4>
|
||||||
@@ -253,7 +254,7 @@
|
|||||||
</P>
|
</P>
|
||||||
|
|
||||||
<P>There are two PostgreSQL books available online at <A href=
|
<P>There are two PostgreSQL books available online at <A href=
|
||||||
"http://www.PostgreSQL.org/docs/awbook.html">http://www.PostgreSQL.org/docs/awbook.html</A>
|
"http://www.postgresql.org/docs/books/awbook.html">http://www.postgresql.org/docs/books/awbook.html</A>
|
||||||
and <A href=
|
and <A href=
|
||||||
"http://www.commandprompt.com/ppbook/">http://www.commandprompt.com/ppbook/</A>.
|
"http://www.commandprompt.com/ppbook/">http://www.commandprompt.com/ppbook/</A>.
|
||||||
There is a list of PostgreSQL books available for purchase at <A
|
There is a list of PostgreSQL books available for purchase at <A
|
||||||
@@ -280,7 +281,7 @@
|
|||||||
<SMALL>SQL</SMALL>?</H4>
|
<SMALL>SQL</SMALL>?</H4>
|
||||||
|
|
||||||
<P>The PostgreSQL book at <A href=
|
<P>The PostgreSQL book at <A href=
|
||||||
"http://www.PostgreSQL.org/docs/awbook.html">http://www.PostgreSQL.org/docs/awbook.html</A>
|
"http://www.postgresql.org/docs/books/awbook.html">http://www.postgresql.org/docs/books/awbook.html</A>
|
||||||
teaches <SMALL>SQL</SMALL>. There is another PostgreSQL book at <A
|
teaches <SMALL>SQL</SMALL>. There is another PostgreSQL book at <A
|
||||||
href=
|
href=
|
||||||
"http://www.commandprompt.com/ppbook/">http://www.commandprompt.com/ppbook.</A>
|
"http://www.commandprompt.com/ppbook/">http://www.commandprompt.com/ppbook.</A>
|
||||||
@@ -411,7 +412,8 @@
|
|||||||
href="http://www.php.net">http://www.php.net</A>) is an excellent
|
href="http://www.php.net">http://www.php.net</A>) is an excellent
|
||||||
interface.</P>
|
interface.</P>
|
||||||
|
|
||||||
<P>For complex cases, many use the Perl and CGI.pm or mod_perl.</P>
|
<P>For complex cases, many use the Perl DBD::Pg with CGI.pm or
|
||||||
|
mod_perl.</P>
|
||||||
|
|
||||||
<H4><A name="2.3">2.3</A>) Does PostgreSQL have a graphical user
|
<H4><A name="2.3">2.3</A>) Does PostgreSQL have a graphical user
|
||||||
interface?</H4>
|
interface?</H4>
|
||||||
@@ -421,10 +423,9 @@
|
|||||||
href="http://www.pgadmin.org">http://www.pgadmin.org</a>, PgAccess
|
href="http://www.pgadmin.org">http://www.pgadmin.org</a>, PgAccess
|
||||||
<a href="http://www.pgaccess.org"> http://www.pgaccess.org</a>),
|
<a href="http://www.pgaccess.org"> http://www.pgaccess.org</a>),
|
||||||
RHDB Admin (<a
|
RHDB Admin (<a
|
||||||
href="http://sources.redhat.com/rhdb/">http://sources.redhat.com/rhd
|
href="http://sources.redhat.com/rhdb/">http://sources.redhat.com/rhdb/
|
||||||
b/ </a>), TORA (<a
|
</a>), TORA (<a href="http://www.globecom.net/tora/">
|
||||||
href="http://www.globecom.net/tora/">http://www.globecom.net/tora/</a>,
|
http://www.globecom.net/tora/</a>, partly commercial), and Rekall (<a
|
||||||
partly commercial), and Rekall (<a
|
|
||||||
href="http://www.rekallrevealed.org/">
|
href="http://www.rekallrevealed.org/">
|
||||||
http://www.rekallrevealed.org/</a>). There is also PhpPgAdmin (<a
|
http://www.rekallrevealed.org/</a>). There is also PhpPgAdmin (<a
|
||||||
href="http://phppgadmin.sourceforge.net/">
|
href="http://phppgadmin.sourceforge.net/">
|
||||||
@@ -815,11 +816,29 @@ table?</TD><TD>unlimited</TD></TR>
|
|||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
<H4><A name="4.9">4.9</A>) In a query, how do I detect if a field
|
<H4><A name="4.9">4.9</A>) In a query, how do I detect if a field
|
||||||
is <SMALL>NULL</SMALL>?</H4>
|
is <SMALL>NULL</SMALL>? How can I sort on whether a field is <SMALL>
|
||||||
|
NULL</SMALL> or not?</H4>
|
||||||
|
|
||||||
<P>You test the column with <SMALL>IS NULL</SMALL> and <SMALL>IS
|
<P>You test the column with <SMALL>IS NULL</SMALL> and <SMALL>IS
|
||||||
NOT NULL</SMALL>.</P>
|
NOT NULL</SMALL>.</P>
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
SELECT *
|
||||||
|
FROM tab
|
||||||
|
WHERE col IS NULL;
|
||||||
|
</PRE>
|
||||||
|
|
||||||
|
<P>To sort by the <SMALL>NULL</SMALL> status, use the <SMALL>IS NULL</SMALL>
|
||||||
|
and <SMALL>IS NOT NULL</SMALL> modifiers in your <SMALL>WHERE</SMALL> clause.
|
||||||
|
Things that are <I>true</I> will sort higher than things that are <I>false</I>,
|
||||||
|
so the following will put NULL entries at the top of the resulting list:</P>
|
||||||
|
|
||||||
|
<PRE>
|
||||||
|
SELECT *
|
||||||
|
FROM tab
|
||||||
|
ORDER BY (col IS NOT NULL)
|
||||||
|
</PRE>
|
||||||
|
|
||||||
<H4><A name="4.10">4.10</A>) What is the difference between the
|
<H4><A name="4.10">4.10</A>) What is the difference between the
|
||||||
various character types?</H4>
|
various character types?</H4>
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
@@ -1039,8 +1058,8 @@ length</TD></TR>
|
|||||||
<a href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
|
<a href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
|
||||||
http://techdocs.postgresql.org/guides/SetReturningFunctions</a>.
|
http://techdocs.postgresql.org/guides/SetReturningFunctions</a>.
|
||||||
|
|
||||||
<H4><A name="4.20">4.20</A>) Why can't I reliably create/drop
|
<H4><A name="4.20">4.20</A>) Why do I get "missing oid" errors when
|
||||||
temporary tables in PL/PgSQL functions?</H4>
|
accessing temporary tables in PL/PgSQL functions?</H4>
|
||||||
|
|
||||||
<P>PL/PgSQL caches function scripts, and an unfortunate side effect
|
<P>PL/PgSQL caches function scripts, and an unfortunate side effect
|
||||||
is that if a PL/PgSQL function accesses a temporary table, and that
|
is that if a PL/PgSQL function accesses a temporary table, and that
|
||||||
|
Reference in New Issue
Block a user