1010alink ="#0000ff ">
1111< H1 > Frequently Asked Questions (FAQ) for PostgreSQL</ H1 >
1212
13- < P > Last updated:Mon Feb14 23:35:09 EST 2005</ P >
13+ < P > Last updated:Thu Feb24 19:32:04 EST 2005</ P >
1414
1515< P > Current maintainer: Bruce Momjian (< A href =
1616 "mailto:pgman@candle.pha.pa.us "> pgman@candle.pha.pa.us</ A > )
@@ -85,7 +85,8 @@ <H2 align="center">Operational Questions</H2>
8585 searches and case-insensitive regular expression searches? How do I
8686 use an index for case-insensitive searches?< BR >
8787< A href ="#4.9 "> 4.9</ A > ) In a query, how do I detect if a field
88- is< SMALL > NULL</ SMALL > ?< BR >
88+ is< SMALL > NULL</ SMALL > ? How can I sort on whether a field is< SMALL >
89+ NULL</ SMALL > or not?< BR >
8990< A href ="#4.10 "> 4.10</ A > ) What is the difference between the
9091 various character types?< BR >
9192< A href ="#4.11.1 "> 4.11.1</ A > ) How do I create a
@@ -162,7 +163,7 @@ <H4><A name="1.2">1.2</A>) What is the copyright of
162163< P > PostgreSQL Data Base Management System</ P >
163164
164165< P > Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
165- Portions Copyright (c) 1994-6 Regents of the University of California</ P >
166+ Portions Copyright (c) 1994-1996 Regents of the University of California</ P >
166167
167168< P > Permission to use, copy, modify, and distribute this software
168169 and its documentation for any purpose, without fee, and without a
@@ -206,7 +207,7 @@ <H4><A name="1.3">1.3</A>) What platforms does PostgreSQL support?</H4>
206207< H4 > < A name ="1.4 "> 1.4</ A > ) Where can I get PostgreSQL?</ H4 >
207208
208209< P > The primary anonymous ftp site for PostgreSQL is< A href =
209- "ftp://ftp.PostgreSQL.org/pub "> ftp://ftp.PostgreSQL.org/pub</ A > .
210+ "ftp://ftp.PostgreSQL.org/pub/ "> ftp://ftp.PostgreSQL.org/pub/ </ A > .
210211 For mirror sites, see our main web site.</ P >
211212
212213< H4 > < A name ="1.5 "> 1.5</ A > ) Where can I get support?</ H4 >
@@ -225,8 +226,8 @@ <H4><A name="1.5">1.5</A>) Where can I get support?</H4>
225226 (< I > #postgresqlfr</ I > ). There is also a PostgreSQL channel on EFNet.
226227
227228< P > A list of commercial support companies is available at< A href =
228- "http://techdocs.postgresql.org/companies.php "> http://techdocs.postg
229- resql .org/companies.php</ A > .</ P >
229+ "http://techdocs.postgresql.org/companies.php ">
230+ http://techdocs.postgresql .org/companies.php</ A > .</ P >
230231
231232< H4 > < A name ="1.6 "> 1.6</ A > ) How do I submit a bug report?</ H4 >
232233
@@ -235,7 +236,7 @@ <H4><A name="1.6">1.6</A>) How do I submit a bug report?</H4>
235236 http://www.postgresql.org/support/submitbug</ A > .</ P >
236237
237238< P > Also check out our ftp site< A href =
238- "ftp://ftp.PostgreSQL.org/pub "> ftp://ftp.PostgreSQL.org/pub</ A > to
239+ "ftp://ftp.PostgreSQL.org/pub/ "> ftp://ftp.PostgreSQL.org/pub/ </ A > to
239240 see if there is a more recent PostgreSQL version.</ P >
240241
241242< H4 > < A name ="1.7 "> 1.7</ A > ) What is the latest release?</ H4 >
@@ -411,7 +412,8 @@ <H4><A name="2.2">2.2</A>) What tools are available for using
411412href ="http://www.php.net "> http://www.php.net</ A > ) is an excellent
412413 interface.</ P >
413414
414- < P > For complex cases, many use the Perl and CGI.pm or mod_perl.</ P >
415+ < P > For complex cases, many use the Perl DBD::Pg with CGI.pm or
416+ mod_perl.</ P >
415417
416418< H4 > < A name ="2.3 "> 2.3</ A > ) Does PostgreSQL have a graphical user
417419 interface?</ H4 >
@@ -421,10 +423,9 @@ <H4><A name="2.3">2.3</A>) Does PostgreSQL have a graphical user
421423href ="http://www.pgadmin.org "> http://www.pgadmin.org</ a > , PgAccess
422424< a href ="http://www.pgaccess.org "> http://www.pgaccess.org</ a > ),
423425 RHDB Admin (< a
424- href ="http://sources.redhat.com/rhdb/ "> http://sources.redhat.com/rhd
425- b/</ a > ), TORA (< a
426- href ="http://www.globecom.net/tora/ "> http://www.globecom.net/tora/</ a > ,
427- partly commercial), and Rekall (< a
426+ href ="http://sources.redhat.com/rhdb/ "> http://sources.redhat.com/rhdb/
427+ </ a > ), TORA (< a href ="http://www.globecom.net/tora/ ">
428+ http://www.globecom.net/tora/</ a > , partly commercial), and Rekall (< a
428429href ="http://www.rekallrevealed.org/ ">
429430 http://www.rekallrevealed.org/</ a > ). There is also PhpPgAdmin (< a
430431href ="http://phppgadmin.sourceforge.net/ ">
@@ -815,11 +816,29 @@ <H4><A name="4.8">4.8</A>) How do I perform regular expression
815816</ PRE >
816817
817818< H4 > < A name ="4.9 "> 4.9</ A > ) In a query, how do I detect if a field
818- is< SMALL > NULL</ SMALL > ?</ H4 >
819+ is< SMALL > NULL</ SMALL > ? How can I sort on whether a field is< SMALL >
820+ NULL</ SMALL > or not?</ H4 >
819821
820822< P > You test the column with< SMALL > IS NULL</ SMALL > and< SMALL > IS
821823 NOT NULL</ SMALL > .</ P >
822824
825+ < PRE >
826+ SELECT *
827+ FROM tab
828+ WHERE col IS NULL;
829+ </ PRE >
830+
831+ < P > To sort by the< SMALL > NULL</ SMALL status, use the< SMALL> IS NULL</ SMALL >
832+ and< SMALL > IS NOT NULL</ SMALL > modifiers in your< SMALL > WHERE</ SMALL > clause.
833+ Things that are< I > true</ I > will sort higher than things that are< I > false</ I > ,
834+ so the following will put NULL entries at the top of the resulting list:</ P >
835+
836+ < PRE >
837+ SELECT *
838+ FROM tab
839+ ORDER BY (col IS NOT NULL)
840+ </ PRE >
841+
823842< H4 > < A name ="4.10 "> 4.10</ A > ) What is the difference between the
824843 various character types?</ H4 >
825844< BLOCKQUOTE >