mirror of
https://github.com/postgres/postgres.git
synced 2025-05-14 00:03:46 -04:00
Backpatch FAQ entry for null concatenation.
This commit is contained in:
parent
3647ff3b3a
commit
d94fa4183f
18
doc/FAQ
18
doc/FAQ
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL
|
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)
|
Current maintainer: Bruce Momjian (bruce@momjian.us)
|
||||||
|
|
||||||
@ -59,8 +59,9 @@
|
|||||||
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? How can I sort on
|
4.9) In a query, how do I detect if a field is NULL? How do I
|
||||||
whether a field is NULL or not?
|
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.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?
|
||||||
@ -631,15 +632,22 @@
|
|||||||
upper and lowercase characters, it can not have identical values that
|
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
|
differ only in case. To force a particular case to be stored in the
|
||||||
column, use a CHECK constraint or a trigger.
|
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
|
4.9) In a query, how do I detect if a field is NULL? How do I concatenate
|
||||||
whether a field is NULL or not?
|
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:
|
You test the column with IS NULL and IS NOT NULL, like this:
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM tab
|
FROM tab
|
||||||
WHERE col IS NULL;
|
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
|
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
|
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
|
things that are false, so the following will put NULL entries at the
|
||||||
|
19
doc/FAQ_AIX
19
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 <ZeugswetterA@spardat.at>
|
From: Zeugswetter Andreas <ZeugswetterA@spardat.at>
|
||||||
$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
|
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
|
(vac.C 5.0.1) passes all regression tests. Other versions of OS and
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
=======================================================
|
=======================================================
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL 7.3
|
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||||
HP-UX Specific
|
HP-UX Specific
|
||||||
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
|
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)
|
current maintainer: Tom Lane (tgl@sss.pgh.pa.us)
|
||||||
original author: 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?
|
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
|
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
|
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.
|
have reports of successful installations on HPUX 11.00 and 11.11.
|
||||||
|
@ -3,7 +3,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL
|
|||||||
IRIX Specific
|
IRIX Specific
|
||||||
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
|
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)
|
current maintainer: Luis Amigo (lamigo@atc.unican.es)
|
||||||
original author: Luis Amigo (lamigo@atc.unican.es)
|
original author: Luis Amigo (lamigo@atc.unican.es)
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
The most recent version of this document can be viewed at
|
The most recent version of this document can be viewed at
|
||||||
http://www.postgresql.org/docs/faqs.FAQ_MINGW.html.
|
http://www.postgresql.org/docs/faqs.FAQ_MINGW.html.
|
||||||
|
|
||||||
The FAQ for running PostgreSQL on native Win32 is at
|
The FAQ Running & Installing PostgreSQL On Native Windows is at
|
||||||
http://pginstaller.projects.postgresql.org/FAQ_windows.html.
|
http://pginstaller.projects.postgresql.org/faq/FAQ_windows.html.
|
||||||
|
|
||||||
The native Win32 port is built from source using MinGW tools. There
|
The native Win32 port is built from source using MinGW tools. There
|
||||||
is also a precompiled binary installer called pginstaller which you
|
is also a precompiled binary installer called pginstaller which you
|
||||||
can find at from http://pgfoundry.org/projects/pginstaller. It is a
|
can find at from http://pgfoundry.org/projects/pginstaller. It is a
|
||||||
fully native build and uses no additional software like MinGW. The
|
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.
|
servers in the binary/win32 directory.
|
||||||
|
|
||||||
Tools for Building Binaries
|
Tools for Building Binaries
|
||||||
|
14
doc/FAQ_SCO
14
doc/FAQ_SCO
@ -1,14 +1,16 @@
|
|||||||
============================================================
|
=======================================================
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL 7.3
|
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||||
SCO UnixWare and OpenServer specific
|
IRIX Specific
|
||||||
to be read in conjunction with the installation instructions
|
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
|
||||||
============================================================
|
=======================================================
|
||||||
last updated: $Date: 2004/08/04 21:33:39 $
|
last updated: $Date: 2006/12/11 22:48:07 $
|
||||||
|
|
||||||
current maintainer: Billy G. Allie (Bill.Allie@mug.org)
|
current maintainer: Billy G. Allie (Bill.Allie@mug.org)
|
||||||
original author: Andrew Merrill (andrew@compclass.com)
|
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.
|
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
|
On OpenServer, you can use either the OpenServer Development Kit or
|
||||||
the Universal Development Kit.
|
the Universal Development Kit.
|
||||||
|
@ -3,7 +3,7 @@ Frequently Asked Questions (FAQ) for PostgreSQL
|
|||||||
Sun Solaris specific
|
Sun Solaris specific
|
||||||
To be read in conjunction with the installation instructions.
|
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:
|
Contents:
|
||||||
|
@ -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: Sat Dec 2 07:15:34 EST 2006</P>
|
<P>Last updated: Mon Dec 11 17:45:54 EST 2006</P>
|
||||||
|
|
||||||
<P>Current maintainer: Bruce Momjian (<A href=
|
<P>Current maintainer: Bruce Momjian (<A href=
|
||||||
"mailto:bruce@momjian.us">bruce@momjian.us</A>)
|
"mailto:bruce@momjian.us">bruce@momjian.us</A>)
|
||||||
@ -86,8 +86,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="#item4.9">4.9</A>) In a query, how do I detect if a field
|
<A href="#item4.9">4.9</A>) In a query, how do I detect if a field
|
||||||
is <SMALL>NULL</SMALL>? How can I sort on whether a field is <SMALL>
|
is <SMALL>NULL</SMALL>? How do I concatenate possible <SMALL>NULL</SMALL>s?
|
||||||
NULL</SMALL> or not?<BR>
|
How can I sort on whether a field is <SMALL> NULL</SMALL> or not?<BR>
|
||||||
<A href="#item4.10">4.10</A>) What is the difference between the
|
<A href="#item4.10">4.10</A>) What is the difference between the
|
||||||
various character types?<BR>
|
various character types?<BR>
|
||||||
<A href="#item4.11.1">4.11.1</A>) How do I create a
|
<A href="#item4.11.1">4.11.1</A>) How do I create a
|
||||||
@ -824,9 +824,13 @@ table?</TD><TD>unlimited</TD></TR>
|
|||||||
case to be stored in the column, use a <SMALL>CHECK</SMALL>
|
case to be stored in the column, use a <SMALL>CHECK</SMALL>
|
||||||
constraint or a trigger.</P>
|
constraint or a trigger.</P>
|
||||||
|
|
||||||
|
<A href="#item4.9">4.9</A>) In a query, how do I detect if a field
|
||||||
|
is <SMALL>NULL</SMALL>? How do I concatenate possible <SMALL>NULL</SMALL>s?
|
||||||
|
How can I sort on whether a field is <SMALL> NULL</SMALL> or not?<BR>
|
||||||
|
|
||||||
<H3 id="item4.9">4.9) In a query, how do I detect if a field
|
<H3 id="item4.9">4.9) In a query, how do I detect if a field
|
||||||
is <SMALL>NULL</SMALL>? How can I sort on whether a field is <SMALL>
|
is <SMALL>NULL</SMALL>? How do I concatenate possible <SMALL>NULL</SMALL>s?
|
||||||
NULL</SMALL> or not?</H3>
|
How can I sort on whether a field is <SMALL> NULL</SMALL> or not?</H3>
|
||||||
|
|
||||||
<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>, like this:</P>
|
NOT NULL</SMALL>, like this:</P>
|
||||||
@ -837,6 +841,13 @@ table?</TD><TD>unlimited</TD></TR>
|
|||||||
WHERE col IS NULL;
|
WHERE col IS NULL;
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
|
<P>To concatentate with possible <SMALL>NULL</SMALL>s, use <I>COALESCE()</I>,
|
||||||
|
like this:</P>
|
||||||
|
<PRE>
|
||||||
|
SELECT COALESCE(col1, '') || COALESCE(col2, '')
|
||||||
|
FROM tab
|
||||||
|
</PRE>
|
||||||
|
|
||||||
<P>To sort by the <SMALL>NULL</SMALL> status, use the <SMALL>IS NULL</SMALL>
|
<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>ORDER BY</SMALL> clause.
|
and <SMALL>IS NOT NULL</SMALL> modifiers in your <SMALL>ORDER BY</SMALL> clause.
|
||||||
Things that are <I>true</I> will sort higher than things that are <I>false</I>,
|
Things that are <I>true</I> will sort higher than things that are <I>false</I>,
|
||||||
@ -1091,7 +1102,7 @@ length</TD></TR>
|
|||||||
double-quotes around table or column names during table creation.
|
double-quotes around table or column names during table creation.
|
||||||
When double-quotes are used, table and column names (called
|
When double-quotes are used, table and column names (called
|
||||||
identifiers) are stored <a
|
identifiers) are stored <a
|
||||||
href="http://www.postgresql.org/docs/8.2/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS">
|
href="http://www.postgresql.org/docs/current/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS">
|
||||||
case-sensitive</a>, meaning you must use double-quotes when
|
case-sensitive</a>, meaning you must use double-quotes when
|
||||||
referencing the names in a query. Some interfaces, like pgAdmin,
|
referencing the names in a query. Some interfaces, like pgAdmin,
|
||||||
automatically double-quote identifiers during table creation.
|
automatically double-quote identifiers during table creation.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.175.2.2 2006/12/06 15:40:32 momjian Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.175.2.3 2006/12/11 22:48:08 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ PostgreSQL documentation
|
|||||||
<acronym>SQL</acronym> and <application>psql</application>
|
<acronym>SQL</acronym> and <application>psql</application>
|
||||||
meta-commands with this option. To achieve that, you could
|
meta-commands with this option. To achieve that, you could
|
||||||
pipe the string into <application>psql</application>, like
|
pipe the string into <application>psql</application>, like
|
||||||
this: <literal>echo "\x \\ SELECT * FROM foo;" | psql</literal>.
|
this: <literal>echo '\x \\ SELECT * FROM foo;' | psql</literal>.
|
||||||
(<literal>\\</> is the separator meta-command.)
|
(<literal>\\</> is the separator meta-command.)
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user