From d94fa4183f9bf24078b59df2e6b255e511e601e9 Mon Sep 17 00:00:00 2001
From: Bruce Momjian
Date: Mon, 11 Dec 2006 22:48:08 +0000
Subject: [PATCH] Backpatch FAQ entry for null concatenation.
---
doc/FAQ | 18 ++++++++----
doc/FAQ_AIX | 19 ++++++++++++-
doc/FAQ_HPUX | 6 ++--
doc/FAQ_IRIX | 2 +-
doc/FAQ_MINGW | 6 ++--
doc/FAQ_SCO | 14 ++++++----
doc/FAQ_Solaris | 2 +-
doc/src/FAQ/FAQ.html | 51 +++++++++++++++++++++-------------
doc/src/sgml/ref/psql-ref.sgml | 4 +--
9 files changed, 80 insertions(+), 42 deletions(-)
diff --git a/doc/FAQ b/doc/FAQ
index 701e7603fd8..f539aa3d031 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,7 +1,7 @@
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Sat Dec 2 07:15:34 EST 2006
+ Last updated: Mon Dec 11 17:45:54 EST 2006
Current maintainer: Bruce Momjian (bruce@momjian.us)
@@ -59,8 +59,9 @@
4.8) How do I perform regular expression searches and case-insensitive
regular expression searches? How do I use an index for
case-insensitive searches?
- 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.9) In a query, how do I detect if a field is NULL? How do I
+ concatenate possible NULLs? How can I sort on whether a field is NULL
+ or not?
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.2) How do I get the value of a SERIAL insert?
@@ -631,15 +632,22 @@
upper and lowercase characters, it can not have identical values that
differ only in case. To force a particular case to be stored in the
column, use a CHECK constraint or a trigger.
+ 4.9) In a query, how do I detect if a field is NULL? How do I
+ concatenate possible NULLs? How can I sort on whether a field is NULL
+ or not?
- 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.9) In a query, how do I detect if a field is NULL? How do I concatenate
+ possible NULLs? How can I sort on whether a field is NULL or not?
You test the column with IS NULL and IS NOT NULL, like this:
SELECT *
FROM tab
WHERE col IS NULL;
+ To concatentate with possible NULLs, use COALESCE(), like this:
+ SELECT COALESCE(col1, '') || COALESCE(col2, '')
+ FROM tab
+
To sort by the NULL status, use the IS NULL and IS NOT NULL modifiers
in your ORDER BY clause. Things that are true will sort higher than
things that are false, so the following will put NULL entries at the
diff --git a/doc/FAQ_AIX b/doc/FAQ_AIX
index c4211cbb1fc..35183a0fee9 100644
--- a/doc/FAQ_AIX
+++ b/doc/FAQ_AIX
@@ -1,5 +1,22 @@
+=======================================================
+Frequently Asked Questions (FAQ) for PostgreSQL
+AIX Specific
+TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
+=======================================================
+Last updated: $Date: 2006/12/11 22:48:07 $
+
+Topics
+
+- AIX 4.3.2 Port Report
+- AIX 5.3 Additional Information
+- AIX, readline, and postgres 8.1.x:
+- AIX Memory Management: An Overview
+- Statistics Collector Fun on AIX
+
+-----
+
From: Zeugswetter Andreas
-$Date: 2006/09/20 02:10:11 $
+$Date: 2006/12/11 22:48:07 $
On AIX 4.3.2 PostgreSQL compiled with the native IBM compiler xlc
(vac.C 5.0.1) passes all regression tests. Other versions of OS and
diff --git a/doc/FAQ_HPUX b/doc/FAQ_HPUX
index 227adbefd59..3df23654e37 100644
--- a/doc/FAQ_HPUX
+++ b/doc/FAQ_HPUX
@@ -1,9 +1,9 @@
=======================================================
-Frequently Asked Questions (FAQ) for PostgreSQL 7.3
+Frequently Asked Questions (FAQ) for PostgreSQL
HP-UX Specific
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
=======================================================
-last updated: $Date: 2006/07/19 02:37:00 $
+last updated: $Date: 2006/12/11 22:48:07 $
current maintainer: Tom Lane (tgl@sss.pgh.pa.us)
original author: Tom Lane (tgl@sss.pgh.pa.us)
@@ -21,7 +21,7 @@ Section 1: Installing PostgreSQL
1.1) What do I need to install PostgreSQL on HP-UX?
-PostgreSQL 7.3 should work on Series 700/800 PA-RISC machines running
+PostgreSQL 7.3+ should work on Series 700/800 PA-RISC machines running
HP-UX 10.X or 11.X, given appropriate system patch levels and build
tools. At least one developer routinely tests on HPUX 10.20 and we
have reports of successful installations on HPUX 11.00 and 11.11.
diff --git a/doc/FAQ_IRIX b/doc/FAQ_IRIX
index ad2fef58722..98a473f34ae 100644
--- a/doc/FAQ_IRIX
+++ b/doc/FAQ_IRIX
@@ -3,7 +3,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL
IRIX Specific
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
=======================================================
-last updated: $Date: 2002/11/11 20:04:05 $
+last updated: $Date: 2006/12/11 22:48:07 $
current maintainer: Luis Amigo (lamigo@atc.unican.es)
original author: Luis Amigo (lamigo@atc.unican.es)
diff --git a/doc/FAQ_MINGW b/doc/FAQ_MINGW
index 88e6d90850d..6a227978b79 100644
--- a/doc/FAQ_MINGW
+++ b/doc/FAQ_MINGW
@@ -8,14 +8,14 @@
The most recent version of this document can be viewed at
http://www.postgresql.org/docs/faqs.FAQ_MINGW.html.
- The FAQ for running PostgreSQL on native Win32 is at
- http://pginstaller.projects.postgresql.org/FAQ_windows.html.
+ The FAQ Running & Installing PostgreSQL On Native Windows is at
+ http://pginstaller.projects.postgresql.org/faq/FAQ_windows.html.
The native Win32 port is built from source using MinGW tools. There
is also a precompiled binary installer called pginstaller which you
can find at from http://pgfoundry.org/projects/pginstaller. It is a
fully native build and uses no additional software like MinGW. The
- ready-made instlaler files are available on the main PostgreSQL ftp
+ ready-made installer files are available on the main PostgreSQL ftp
servers in the binary/win32 directory.
Tools for Building Binaries
diff --git a/doc/FAQ_SCO b/doc/FAQ_SCO
index 02da4506d4c..ce2cbea3638 100644
--- a/doc/FAQ_SCO
+++ b/doc/FAQ_SCO
@@ -1,14 +1,16 @@
-============================================================
-Frequently Asked Questions (FAQ) for PostgreSQL 7.3
-SCO UnixWare and OpenServer specific
-to be read in conjunction with the installation instructions
-============================================================
-last updated: $Date: 2004/08/04 21:33:39 $
+=======================================================
+Frequently Asked Questions (FAQ) for PostgreSQL
+IRIX Specific
+TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
+=======================================================
+last updated: $Date: 2006/12/11 22:48:07 $
current maintainer: Billy G. Allie (Bill.Allie@mug.org)
original author: Andrew Merrill (andrew@compclass.com)
+Consult http://buildfarm.postgresql.org/ for latest information.
+
PostgreSQL 8.0 can be built on SCO UnixWare 7 and SCO OpenServer 5.
On OpenServer, you can use either the OpenServer Development Kit or
the Universal Development Kit.
diff --git a/doc/FAQ_Solaris b/doc/FAQ_Solaris
index 8db10a614ba..e44ffa05135 100644
--- a/doc/FAQ_Solaris
+++ b/doc/FAQ_Solaris
@@ -3,7 +3,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL
Sun Solaris specific
To be read in conjunction with the installation instructions.
============================================================
-Last updated: $Date: 2006/12/03 16:43:05 $
+Last updated: $Date: 2006/12/11 22:48:07 $
Contents:
diff --git a/doc/src/FAQ/FAQ.html b/doc/src/FAQ/FAQ.html
index 301903a5114..b04db6b4748 100644
--- a/doc/src/FAQ/FAQ.html
+++ b/doc/src/FAQ/FAQ.html
@@ -10,7 +10,7 @@
alink="#0000ff">
Frequently Asked Questions (FAQ) for PostgreSQL
- Last updated: Sat Dec 2 07:15:34 EST 2006
+ Last updated: Mon Dec 11 17:45:54 EST 2006
Current maintainer: Bruce Momjian (bruce@momjian.us)
@@ -42,7 +42,7 @@
development team?
1.13) How does PostgreSQL compare to other
DBMSs?
-
+
User Client Questions
2.1) What interfaces are available for
@@ -51,7 +51,7 @@
PostgreSQL with Web pages?
2.3) Does PostgreSQL have a graphical user
interface?
-
+
Administrative Questions
3.1) How do I install PostgreSQL somewhere other
@@ -86,8 +86,8 @@
searches and case-insensitive regular expression searches? How do I
use an index for case-insensitive searches?
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?
+ is NULL? How do I concatenate possible NULLs?
+ How can I sort on whether a field is NULL or not?
4.10) What is the difference between the
various character types?
4.11.1) How do I create a
@@ -281,7 +281,7 @@
-
+
1.9) How do I find out about known bugs or
missing features?
@@ -307,7 +307,7 @@
The new feature is added to the
TODO list
-
+
PostgreSQL does not use a bug tracking system because we find
it more efficient to respond directly to email and keep the
TODO
@@ -318,7 +318,7 @@
CVS
log messages. Even the release notes do not list every change
made to the software.
-
+
1.10) What documentation is available?
PostgreSQL includes extensive documentation, including a large
@@ -370,7 +370,7 @@
"http://mysite.verizon.net/Graeme_Birchall/id1.html">http://mysite.verizon.net/Graeme_Birchall/id1.html
-
+
1.12) How do I submit a patch or join the development
team?
@@ -503,7 +503,7 @@
There are three major areas for potential performance
improvement:
-
+
- Query Changes
@@ -583,7 +583,7 @@
PostgreSQL minor releases are designed to fix only common bugs
with the least risk. The community considers not upgrading
more risky that upgrading.
-
+
Major releases (e.g. from 7.3 to 7.4) often change the internal
format of system tables and data files. These changes are often complex,
so we don't maintain backward compatibility for data files. A dump/reload
@@ -638,7 +638,7 @@
There are also system tables beginning with pg_ that describe
these too.
-
+
Use psql -l will list all databases.
Also try the file pgsql/src/tutorial/syscat.source. It
@@ -660,7 +660,7 @@
You might then want to do VACUUM FULL tab to reclaim the
disk space used by the expired rows.
-
+
4.4) What is the maximum size for a row, a
table, and a database?
@@ -735,7 +735,7 @@ table?unlimited |
NULLs are stored as bitmaps, so they
use very little space.
-
+
4.6) Why are my queries slow? Why don't they
use my indexes?
@@ -760,7 +760,7 @@ table?unlimited |
However, LIMIT combined with ORDER BY
often will use an index because only a small portion of the table
is returned.
-
+
If you believe the optimizer is incorrect in choosing a
sequential scan, use SET enable_seqscan TO 'off'
and
run query again to see if an index scan is indeed faster.
@@ -823,10 +823,14 @@ table?unlimited |
identical values that differ only in case. To force a particular
case to be stored in the column, use a CHECK
constraint or a trigger.
-
+
+ 4.9) In a query, how do I detect if a field
+ is NULL? How do I concatenate possible NULLs?
+ How can I sort on whether a field is NULL or not?
+
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?
+ is NULL? How do I concatenate possible NULLs?
+ How can I sort on whether a field is NULL or not?
You test the column with IS NULL and IS
NOT NULL, like this:
@@ -837,6 +841,13 @@ table?unlimited |
WHERE col IS NULL;
+ To concatentate with possible NULLs, use COALESCE(),
+ like this:
+
+ SELECT COALESCE(col1, '') || COALESCE(col2, '')
+ FROM tab
+
+
To sort by the NULL status, use the IS NULL
and IS NOT NULL modifiers in your ORDER BY clause.
Things that are true will sort higher than things that are false,
@@ -937,7 +948,7 @@ length
execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
new_id = execute("SELECT currval('person_id_seq')");
-
+
4.11.3) Doesn't currval()
lead to a race condition with other users?
@@ -1091,7 +1102,7 @@ length
double-quotes around table or column names during table creation.
When double-quotes are used, table and column names (called
identifiers) are stored
+ href="http://www.postgresql.org/docs/current/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS">
case-sensitive, meaning you must use double-quotes when
referencing the names in a query. Some interfaces, like pgAdmin,
automatically double-quote identifiers during table creation.
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 0cba5772dcf..100a3d00a4b 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1,5 +1,5 @@
@@ -89,7 +89,7 @@ PostgreSQL documentation
SQL and psql
meta-commands with this option. To achieve that, you could
pipe the string into psql, like
- this: echo "\x \\ SELECT * FROM foo;" | psql.
+ this: echo '\x \\ SELECT * FROM foo;' | psql.
(\\> is the separator meta-command.)