alink="#0000ff">
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
- <P>Last updated: Tue Nov 22 10:12:24 EST 2005</P>
+ <P>Last updated: Tue Nov 22 10:16:48 EST 2005</P>
<P>Current maintainer: Bruce Momjian (<A href=
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)
<HR>
<H2 align="center">General Questions</H2>
- <A href="#1.1">1.1</A>) What is PostgreSQL? How is it pronounced?<BR>
- <A href="#1.2">1.2</A>) Who controls PostgreSQL?<BR>
- <A href="#1.3">1.3</A>) What is the copyright of PostgreSQL?<BR>
- <A href="#1.4">1.4</A>) What platforms does PostgreSQL support?<BR>
- <A href="#1.5">1.5</A>) Where can I get PostgreSQL?<BR>
- <A href="#1.6">1.6</A>) What is the latest release?<BR>
- <A href="#1.7">1.7</A>) Where can I get support?<BR>
- <A href="#1.8">1.8</A>) How do I submit a bug report?<BR>
- <A href="#1.9">1.9</A>) How do I find out about known bugs or
+ <A href="#item1.1">1.1</A>) What is PostgreSQL? How is it pronounced?<BR>
+ <A href="#item1.2">1.2</A>) Who controls PostgreSQL?<BR>
+ <A href="#item1.3">1.3</A>) What is the copyright of PostgreSQL?<BR>
+ <A href="#item1.4">1.4</A>) What platforms does PostgreSQL support?<BR>
+ <A href="#item1.5">1.5</A>) Where can I get PostgreSQL?<BR>
+ <A href="#item1.6">1.6</A>) What is the latest release?<BR>
+ <A href="#item1.7">1.7</A>) Where can I get support?<BR>
+ <A href="#item1.8">1.8</A>) How do I submit a bug report?<BR>
+ <A href="#item1.9">1.9</A>) How do I find out about known bugs or
missing features?<BR>
- <A href="#1.10">1.10</A>) What documentation is available?<BR>
- <A href="#1.11">1.11</A>) How can I learn <SMALL>SQL</SMALL>?<BR>
- <A href="#1.12">1.12</A>) How do I join the development team?<BR>
- <A href="#1.13">1.13</A>) How does PostgreSQL compare to other
+ <A href="#item1.10">1.10</A>) What documentation is available?<BR>
+ <A href="#item1.11">1.11</A>) How can I learn <SMALL>SQL</SMALL>?<BR>
+ <A href="#item1.12">1.12</A>) How do I join the development team?<BR>
+ <A href="#item1.13">1.13</A>) How does PostgreSQL compare to other
<SMALL>DBMS</SMALL>s?<BR>
<H2 align="center">User Client Questions</H2>
- <A href="#2.1">2.1</A>) What interfaces are available for
+ <A href="#item2.1">2.1</A>) What interfaces are available for
PostgreSQL?<BR>
- <A href="#2.2">2.2</A>) What tools are available for using
+ <A href="#item2.2">2.2</A>) What tools are available for using
PostgreSQL with Web pages?<BR>
- <A href="#2.3">2.3</A>) Does PostgreSQL have a graphical user
+ <A href="#item2.3">2.3</A>) Does PostgreSQL have a graphical user
interface?<BR>
<H2 align="center">Administrative Questions</H2>
- <A href="#3.1">3.1</A>) How do I install PostgreSQL somewhere other
+ <A href="#item3.1">3.1</A>) How do I install PostgreSQL somewhere other
than <I>/usr/local/pgsql</I>?<BR>
- <A href="#3.2">3.2</A>) How do I control connections from other
+ <A href="#item3.2">3.2</A>) How do I control connections from other
hosts?<BR>
- <A href="#3.3">3.3</A>) How do I tune the database engine for
+ <A href="#item3.3">3.3</A>) How do I tune the database engine for
better performance?<BR>
- <A href="#3.4">3.4</A>) What debugging features are available?<BR>
- <A href="#3.5">3.5</A>) Why do I get <I>"Sorry, too many
+ <A href="#item3.4">3.4</A>) What debugging features are available?<BR>
+ <A href="#item3.5">3.5</A>) Why do I get <I>"Sorry, too many
clients"</I> when trying to connect?<BR>
- <A href="#3.6">3.6</A>) Why do I need to do a dump and restore
+ <A href="#item3.6">3.6</A>) Why do I need to do a dump and restore
to upgrade PostgreSQL releases?<BR>
- <A href="#3.7">3.7</A>) What computer hardware should I use?<BR>
+ <A href="#item3.7">3.7</A>) What computer hardware should I use?<BR>
<H2 align="center">Operational Questions</H2>
- <A href="#4.1">4.1</A>) How do I <SMALL>SELECT</SMALL> only the
+ <A href="#item4.1">4.1</A>) How do I <SMALL>SELECT</SMALL> only the
first few rows of a query? A random row?<BR>
- <A href="#4.2">4.2</A>) How do I find out what tables, indexes,
+ <A href="#item4.2">4.2</A>) How do I find out what tables, indexes,
databases, and users are defined? How do I see the queries used
by <I>psql</I> to display them?<BR>
- <A href="#4.3">4.3</A>) How do you change a column's data type?<BR>
- <A href="#4.4">4.4</A>) What is the maximum size for a row, a
+ <A href="#item4.3">4.3</A>) How do you change a column's data type?<BR>
+ <A href="#item4.4">4.4</A>) What is the maximum size for a row, a
table, and a database?<BR>
- <A href="#4.5">4.5</A>) How much database disk space is required
+ <A href="#item4.5">4.5</A>) How much database disk space is required
to store data from a typical text file?<BR>
- <A href="#4.6">4.6</A>) Why are my queries slow? Why don't they
+ <A href="#item4.6">4.6</A>) Why are my queries slow? Why don't they
use my indexes?<BR>
- <A href="#4.7">4.7</A>) How do I see how the query optimizer is
+ <A href="#item4.7">4.7</A>) How do I see how the query optimizer is
evaluating my query?<BR>
- <A href="#4.8">4.8</A>) How do I perform regular expression
+ <A href="#item4.8">4.8</A>) How do I perform regular expression
searches and case-insensitive regular expression searches? How do I
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="#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>
NULL</SMALL> or not?<BR>
- <A href="#4.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>
- <A href="#4.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
serial/auto-incrementing field?<BR>
- <A href="#4.11.2">4.11.2</A>) How do I get the value of a
+ <A href="#item4.11.2">4.11.2</A>) How do I get the value of a
<SMALL>SERIAL</SMALL> insert?<BR>
- <A href="#4.11.3">4.11.3</A>) Doesn't <I>currval()</I>
+ <A href="#item4.11.3">4.11.3</A>) Doesn't <I>currval()</I>
lead to a race condition with other users?<BR>
- <A href="#4.11.4">4.11.4</A>) Why aren't my sequence numbers
+ <A href="#item4.11.4">4.11.4</A>) Why aren't my sequence numbers
reused on transaction abort? Why are there gaps in the numbering of
my sequence/SERIAL column?<BR>
- <A href="#4.12">4.12</A>) What is an <SMALL>OID</SMALL>? What is a
+ <A href="#item4.12">4.12</A>) What is an <SMALL>OID</SMALL>? What is a
<SMALL>CTID</SMALL>?<BR>
- <A href="#4.13">4.13</A>) Why do I get the error <I>"ERROR: Memory
+ <A href="#item4.13">4.13</A>) Why do I get the error <I>"ERROR: Memory
exhausted in AllocSetAlloc()"</I>?<BR>
- <A href="#4.14">4.14</A>) How do I tell what PostgreSQL version I
+ <A href="#item4.14">4.14</A>) How do I tell what PostgreSQL version I
am running?<BR>
- <A href="#4.15">4.15</A>) How do I create a column that will
+ <A href="#item4.15">4.15</A>) How do I create a column that will
default to the current time?<BR>
- <A href="#4.16">4.16</A>) How do I perform an outer join?<BR>
- <A href="#4.17">4.17</A>) How do I perform queries using multiple
+ <A href="#item4.16">4.16</A>) How do I perform an outer join?<BR>
+ <A href="#item4.17">4.17</A>) How do I perform queries using multiple
databases?<BR>
- <A href="#4.18">4.18</A>) How do I return multiple rows or columns
+ <A href="#item4.18">4.18</A>) How do I return multiple rows or columns
from a function?<BR>
- <A href="#4.19">4.19</A>) Why do I get "relation with OID #####
+ <A href="#item4.19">4.19</A>) Why do I get "relation with OID #####
does not exist" errors when accessing temporary tables in PL/PgSQL
functions?<BR>
- <A href="#4.20">4.20</A>) What replication solutions are available?<BR>
- <A href="#4.21">4.21</A>) Why are my table and column names not
+ <A href="#item4.20">4.20</A>) What replication solutions are available?<BR>
+ <A href="#item4.21">4.21</A>) Why are my table and column names not
recognized in my query?<BR>
<H2 align="center">General Questions</H2>
- <H3 ID="1.1">1.1) What is PostgreSQL? How is it pronounced?</H3>
+ <H3 id="item1.1">1.1) What is PostgreSQL? How is it pronounced?</H3>
<P>PostgreSQL is pronounced <I>Post-Gres-Q-L</I>, and is also sometimes
referred to as just <I>Postgres</I>. An audio file is available in
http://www.postgresql.org/files/documentation/faqs/FAQ_DEV.html</A>
</P>
- <H3 ID="1.2">1.2) Who controls PostgreSQL?<BR></H3>
+ <H3 id="item1.2">1.2) Who controls PostgreSQL?<BR></H3>
<P>If you are looking for a PostgreSQL gatekeeper, central committee,
or controlling company, give up --- there isn't one. We do have a
Developer's FAQ</A> for information on how to get involved in PostgreSQL
development.)</P>
- <H3 ID="1.3">1.3) What is the copyright of
+ <H3 id="item1.3">1.3) What is the copyright of
PostgreSQL?</H3>
<P>PostgreSQL is distributed under the classic BSD license. Basically,
UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</P>
- <H3 ID="1.4">1.4) What platforms does PostgreSQL support?</H3>
+ <H3 id="item1.4">1.4) What platforms does PostgreSQL support?</H3>
<P>In general, any modern Unix-compatible platform should be able to
run PostgreSQL. The platforms that had received explicit testing at
"http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgreSQL&stype=all&sort=type&dir=%2F">
http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgreSQL&stype=all&sort=type&dir=%2F</a>.</p>
- <H3 ID="1.5">1.5) Where can I get PostgreSQL?</H3>
+ <H3 id="item1.5">1.5) Where can I get PostgreSQL?</H3>
<P>Via web browser, use <a href="http://www.postgresql.org/ftp/">
http://www.postgresql.org/ftp/</a>, and via ftp, use
<A href="ftp://ftp.PostgreSQL.org/pub/">
ftp://ftp.PostgreSQL.org/pub/</A>.</P>
- <H3 ID="1.6">1.6) What is the latest release?</H3>
+ <H3 id="item1.6">1.6) What is the latest release?</H3>
<P>The latest release of PostgreSQL is version 8.1.1</P>
<P>We plan to have a major release every year, with minor releases
every few months.</P>
- <H3 ID="1.7">1.7) Where can I get support?</H3>
+ <H3 id="item1.7">1.7) Where can I get support?</H3>
<P>The PostgreSQL community provides assistance to many of its users
via email. The main web site to subscribe to the email lists is
"http://techdocs.postgresql.org/companies.php">
http://techdocs.postgresql.org/companies.php</A>.</P>
- <H3 ID="1.8">1.8) How do I submit a bug report?</H3>
+ <H3 id="item1.8">1.8) How do I submit a bug report?</H3>
<P>Visit the PostgreSQL bug form at <A href=
"http://www.postgresql.org/support/submitbug">
</li>
</ul>
- <H3 ID="1.9">1.9) How do I find out about known bugs or
+ <H3 id="item1.9">1.9) How do I find out about known bugs or
missing features?</H3>
<P>PostgreSQL supports an extended subset of <SMALL>SQL:2003</SMALL>.
Even the release notes do not contain every change made to the
software.</P>
- <H3 ID="1.10">1.10) What documentation is available?</H3>
+ <H3 id="item1.10">1.10) What documentation is available?</H3>
<P>PostgreSQL includes extensive documentation, including a large
manual, manual pages, and some test examples. See the <I>/doc</I>
<P>Our web site contains even more documentation.</P>
- <H3 ID="1.11">1.11) How can I learn
+ <H3 id="item1.11">1.11) How can I learn
<SMALL>SQL</SMALL>?</H3>
<P>First, consider the PostgreSQL-specific books mentioned above.
and at <A href=
"http://sqlcourse.com/">http://sqlcourse.com.</A></P>
- <H3 ID="1.12">1.12) How do I join the development
+ <H3 id="item1.12">1.12) How do I join the development
team?</H3>
<P>See the <a href="http://www.postgresql.org/docs/faqs.FAQ_DEV.html">
Developer's FAQ</A>.</P>
- <H3 ID="1.13">1.13) How does PostgreSQL compare to other
+ <H3 id="item1.13">1.13) How does PostgreSQL compare to other
<SMALL>DBMS</SMALL>s?</H3>
<P>There are several ways of measuring software: features,
community, manuals, and the source code often make PostgreSQL
support superior to other <SMALL>DBMS</SMALL>s. There is
commercial per-incident support available for those who need it.
- (See <A href="#1.7">FAQ section 1.7</A>.)<BR>
+ (See <A href="#item1.7">FAQ section 1.7</A>.)<BR>
<BR>
</DD>
<H2 align="center">User Client Questions</H2>
- <H3 ID="2.1">2.1) What interfaces are available for
+ <H3 id="item2.1">2.1) What interfaces are available for
PostgreSQL?</H3>
<P>The PostgreSQL install includes only the <SMALL>C</SMALL> and embedded
in the <I>Drivers/Interfaces</I> section and via Internet search.
</P>
- <H3 ID="2.2">2.2) What tools are available for using
+ <H3 id="item2.2">2.2) What tools are available for using
PostgreSQL with Web pages?</H3>
<P>A nice introduction to Database-backed Web pages can be seen at:
<P>For complex cases, many use the Perl and DBD::Pg with CGI.pm or
mod_perl.</P>
- <H3 ID="2.3">2.3) Does PostgreSQL have a graphical user
+ <H3 id="item2.3">2.3) Does PostgreSQL have a graphical user
interface?</H3>
<P>Yes, see <a href="http://techdocs.postgresql.org/guides/GUITools">
<H2 align="center">Administrative Questions</H2>
- <H3 ID="3.1">3.1) How do I install PostgreSQL somewhere
+ <H3 id="item3.1">3.1) How do I install PostgreSQL somewhere
other than <I>/usr/local/pgsql</I>?</H3>
<P>Specify the <I>--prefix</I> option when running
<I>configure</I>.</P>
- <H3 ID="3.2">3.2) How do I control connections from other
+ <H3 id="item3.2">3.2) How do I control connections from other
hosts?</H3>
<P>By default, PostgreSQL only allows connections from the local
host-based authentication by modifying the
<I>$PGDATA/pg_hba.conf</I> file, and restart the server.</P>
- <H3 ID="3.3">3.3) How do I tune the database engine for
+ <H3 id="item3.3">3.3) How do I tune the database engine for
better performance?</H3>
<P>There are three major areas for potential performance
</DD>
</DL>
- <H3 ID="3.4">3.4) What debugging features are
+ <H3 id="item3.4">3.4) What debugging features are
available?</H3>
<P>There are many <CODE>log_*</CODE> server configuration variables
that enable printing of query and process statistics which can be
very useful for debugging and performance measurements.</P>
- <H3 ID="3.5">3.5) Why do I get <I>"Sorry, too many
+ <H3 id="item3.5">3.5) Why do I get <I>"Sorry, too many
clients"</I> when trying to connect?</H3>
<P>You have reached the default limit is 100 database sessions. You
<I>max_connections</I> value in <I>postgresql.conf</I> and
restarting the <I>postmaster</I>.</P>
- <H3 ID="3.6">3.6) Why do I need to do a dump and restore
+ <H3 id="item3.6">3.6) Why do I need to do a dump and restore
to upgrade between major PostgreSQL releases?</H3>
<P>The PostgreSQL team makes only small changes between minor releases,
data in a generic format that can then be loaded in using the new internal
format.</P>
- <H3 ID="3.7">3.7) What computer hardware should I use?</H3>
+ <H3 id="item3.7">3.7) What computer hardware should I use?</H3>
<P>Because PC hardware is mostly compatible, people tend to believe that
all PC hardware is of equal quality. It is not. ECC RAM, SCSI, and
<H2 align="center">Operational Questions</H2>
- <H3 ID="4.1">4.1) How do I <SMALL>SELECT</SMALL> only the
+ <H3 id="item4.1">4.1) How do I <SMALL>SELECT</SMALL> only the
first few rows of a query? A random row?</H3>
<P>To retrieve only a few rows, if you know at the number of rows
LIMIT 1;
</PRE>
- <H3 ID="4.2">4.2) How do I find out what tables, indexes,
+ <H3 id="item4.2">4.2) How do I find out what tables, indexes,
databases, and users are defined? How do I see the queries used
by <I>psql</I> to display them?</H3>
illustrates many of the <SMALL>SELECT</SMALL>s needed to get
information from the database system tables.</P>
- <H3 ID="4.3">4.3) How do you change a column's data type?</H3>
+ <H3 id="item4.3">4.3) How do you change a column's data type?</H3>
<P>Changing the data type of a column can be done easily in 8.0
and later with <SMALL>ALTER TABLE ALTER COLUMN TYPE</SMALL>.</P>
<P>You might then want to do <I>VACUUM FULL tab</I> to reclaim the
disk space used by the expired rows.</P>
- <H3 ID="4.4">4.4) What is the maximum size for a row, a
+ <H3 id="item4.4">4.4) What is the maximum size for a row, a
table, and a database?</H3>
<P>These are the limits:</P>
of an MD5 hash of the long column, and full text indexing
allows for searching of words within the column.</P>
- <H3 ID="4.5">4.5) How much database disk space is required
+ <H3 id="item4.5">4.5) How much database disk space is required
to store data from a typical text file?</H3>
<P>A PostgreSQL database may require up to five times the disk
<P><SMALL>NULL</SMALL>s are stored as bitmaps, so they
use very little space.</P>
- <H3 ID="4.6">4.6) Why are my queries slow? Why don't they
+ <H3 id="item4.6">4.6) Why are my queries slow? Why don't they
use my indexes?</H3>
<P>Indexes are not used by every query. Indexes are used only if the
e.g. [a-e].</LI>
<LI>Case-insensitive searches such as <SMALL>ILIKE</SMALL> and
<I>~*</I> do not utilize indexes. Instead, use expression
- indexes, which are described in section <a href="#4.8">4.8</a>.</LI>
+ indexes, which are described in section <a href="#item4.8">4.8</a>.</LI>
<LI>The default <I>C</I> locale must be used during
<i>initdb</i> because it is not possible to know the next-greatest
character in a non-C locale. You can create a special
types exactly match the index's column types. This was particularly
true of int2, int8, and numeric column indexes.</P>
- <H3 ID="4.7">4.7) How do I see how the query optimizer is
+ <H3 id="item4.7">4.7) How do I see how the query optimizer is
evaluating my query?</H3>
<P>See the <SMALL>EXPLAIN</SMALL> manual page.</P>
- <H3 ID="4.8">4.8) How do I perform regular expression
+ <H3 id="item4.8">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?</H3>
case to be stored in the column, use a <SMALL>CHECK</SMALL>
constraint or a trigger.</P>
- <H3 ID="4.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>
NULL</SMALL> or not?</H3>
ORDER BY (col IS NOT NULL)
</PRE>
- <H3 ID="4.10">4.10) What is the difference between the
+ <H3 id="item4.10">4.10) What is the difference between the
various character types?</H3>
<BLOCKQUOTE>
<TABLE>
particularly values that include <SMALL>NULL</SMALL> bytes. All the
types described here have similar performance characteristics.</P>
- <H3 ID="4.11.1">4.11.1) How do I create a
+ <H3 id="item4.11.1">4.11.1) How do I create a
serial/auto-incrementing field?</H3>
<P>PostgreSQL supports a <SMALL>SERIAL</SMALL> data type. It
See the <I>create_sequence</I> manual page for more information
about sequences.
- <H3 ID="4.11.2">4.11.2) How do I get the value of a
+ <H3 id="item4.11.2">4.11.2) How do I get the value of a
<SMALL>SERIAL</SMALL> insert?</H3>
<P>One approach is to retrieve the next <SMALL>SERIAL</SMALL> value
from the sequence object with the <I>nextval()</I> function
<I>before</I> inserting and then insert it explicitly. Using the
- example table in <A href="#4.11.1">4.11.1</A>, an example in a
+ example table in <A href="#item4.11.1">4.11.1</A>, an example in a
pseudo-language would look like this:</P>
<PRE>
new_id = execute("SELECT nextval('person_id_seq')");
new_id = execute("SELECT currval('person_id_seq')");
</PRE>
- <H3 ID="4.11.3">4.11.3) Doesn't <I>currval()</I>
+ <H3 id="item4.11.3">4.11.3) Doesn't <I>currval()</I>
lead to a race condition with other users?</H3>
<P>No. <I>currval()</I> returns the current value assigned by your
session, not by all sessions.</P>
- <H3 ID="4.11.4">4.11.4) Why aren't my sequence numbers
+ <H3 id="item4.11.4">4.11.4) Why aren't my sequence numbers
reused on transaction abort? Why are there gaps in the numbering of
my sequence/SERIAL column?</H3>
completes. This causes gaps in numbering from aborted
transactions.</P>
- <H3 ID="4.12">4.12) What is an <SMALL>OID</SMALL>? What is
+ <H3 id="item4.12">4.12) What is an <SMALL>OID</SMALL>? What is
a <SMALL>CTID</SMALL>?</H3>
<P>Every row that is created in PostgreSQL gets a unique
are modified or reloaded. They are used by index entries to point
to physical rows.</P>
- <H3 ID="4.13">4.13) Why do I get the error <I>"ERROR:
+ <H3 id="item4.13">4.13) Why do I get the error <I>"ERROR:
Memory exhausted in AllocSetAlloc()"</I>?</H3>
<P>You probably have run out of virtual memory on your system,
backend is returning too much data, try it before starting the
client.
- <H3 ID="4.14">4.14) How do I tell what PostgreSQL version
+ <H3 id="item4.14">4.14) How do I tell what PostgreSQL version
I am running?</H3>
<P>From <I>psql</I>, type <CODE>SELECT version();</CODE></P>
- <H3 ID="4.15">4.15) How do I create a column that will
+ <H3 id="item4.15">4.15) How do I create a column that will
default to the current time?</H3>
<P>Use <I>CURRENT_TIMESTAMP</I>:</P>
CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
</PRE>
- <H3 ID="4.16">4.16) How do I perform an outer join?</H3>
+ <H3 id="item4.16">4.16) How do I perform an outer join?</H3>
<P>PostgreSQL supports outer joins using the SQL standard syntax.
Here are two examples:</P>
<SMALL>RIGHT</SMALL>, and <SMALL>FULL</SMALL> joins. Ordinary joins
are called <SMALL>INNER</SMALL> joins.</P>
- <H3 ID="4.17">4.17) How do I perform queries using
+ <H3 id="item4.17">4.17) How do I perform queries using
multiple databases?</H3>
<P>There is no way to query a database other than the current one.
connections to different databases and merge the results on the
client side.</P>
- <H3 ID="4.18">4.18) How do I return multiple rows or
+ <H3 id="item4.18">4.18) How do I return multiple rows or
columns from a function?</H3>
<P>It is easy using set-returning functions,
<a href="http://techdocs.postgresql.org/guides/SetReturningFunctions">
http://techdocs.postgresql.org/guides/SetReturningFunctions</a></P>.
- <H3 ID="4.19">4.19) Why do I get "relation with OID #####
+ <H3 id="item4.19">4.19) Why do I get "relation with OID #####
does not exist" errors when accessing temporary tables in PL/PgSQL
functions?</H3>
<SMALL>EXECUTE</SMALL> for temporary table access in PL/PgSQL. This
will cause the query to be reparsed every time.</P>
- <H3 ID="4.20">4.20) What replication solutions are available?
+ <H3 id="item4.20">4.20) What replication solutions are available?
</H3>
<P>Though "replication" is a single term, there are several technologies
<P>There are also commercial and hardware-based replication solutions
available supporting a variety of replication models.</P>
- <H3 ID="4.21">4.21) Why are my table and column names not
+ <H3 id="item4.21">4.21) Why are my table and column names not
recognized in my query?</H3>
<P>The most common cause is the use of double-quotes around table or
<H1>Developer's Frequently Asked Questions (FAQ) for
PostgreSQL</H1>
- <P>Last updated: Tue Nov 22 10:13:04 EST 2005</P>
+ <P>Last updated: Tue Nov 22 10:17:05 EST 2005</P>
<P>Current maintainer: Bruce Momjian (<A href=
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
<H2>General Questions</H2>
- <A href="#1.1">1.1</A>) How do I get involved in PostgreSQL
+ <A href="#item1.1">1.1</A>) How do I get involved in PostgreSQL
development?<BR>
- <A href="#1.2">1.2</A>) What development environment is required
+ <A href="#item1.2">1.2</A>) What development environment is required
to develop code?<BR>
- <A href="#1.3">1.3</A>) What areas need work?<BR>
- <A href="#1.4">1.4</A>) What do I do after choosing an item to
+ <A href="#item1.3">1.3</A>) What areas need work?<BR>
+ <A href="#item1.4">1.4</A>) What do I do after choosing an item to
work on?<BR>
- <A href="#1.5">1.5</A>) I've developed a patch, what next?<BR>
- <A href="#1.6">1.6</A>) Where can I learn more about the code?<BR>
- <A href="#1.7">1.7</A>) How do I download/update the current
+ <A href="#item1.5">1.5</A>) I've developed a patch, what next?<BR>
+ <A href="#item1.6">1.6</A>) Where can I learn more about the code?<BR>
+ <A href="#item1.7">1.7</A>) How do I download/update the current
source tree?<BR>
- <A href="#1.8">1.8</A>) How do I test my changes?<BR>
- <A href="#1.9">1.9</A>) What tools are available for
+ <A href="#item1.8">1.8</A>) How do I test my changes?<BR>
+ <A href="#item1.9">1.9</A>) What tools are available for
developers?<BR>
- <A href="#1.10">1.10</A>) What books are good for developers?<BR>
- <A href="#1.11">1.11</A>) What is configure all about?<BR>
- <A href="#1.12">1.12</A>) How do I add a new port?<BR>
- <A href="#1.13">1.13</A>) Why don't you use threads, raw
+ <A href="#item1.10">1.10</A>) What books are good for developers?<BR>
+ <A href="#item1.11">1.11</A>) What is configure all about?<BR>
+ <A href="#item1.12">1.12</A>) How do I add a new port?<BR>
+ <A href="#item1.13">1.13</A>) Why don't you use threads, raw
devices, async-I/O, <insert your favorite wizz-bang feature
here>?<BR>
- <A href="#1.14">1.14</A>) How are RPM's packaged?<BR>
- <A href="#1.15">1.15</A>) How are CVS branches handled?<BR>
- <A href="#1.16">1.16</A>) Where can I get a copy of the SQL
+ <A href="#item1.14">1.14</A>) How are RPM's packaged?<BR>
+ <A href="#item1.15">1.15</A>) How are CVS branches handled?<BR>
+ <A href="#item1.16">1.16</A>) Where can I get a copy of the SQL
standards?<BR>
- <A href="#1.17">1.17</A>) Where can I get technical
+ <A href="#item1.17">1.17</A>) Where can I get technical
assistance?<BR>
- <A href="#1.18">1.18</A>) How do I get involved in PostgreSQL web
+ <A href="#item1.18">1.18</A>) How do I get involved in PostgreSQL web
site development?<BR>
<H2>Technical Questions</H2>
- <A href="#2.1">2.1</A>) How do I efficiently access information in
+ <A href="#item2.1">2.1</A>) How do I efficiently access information in
tables from the backend code?<BR>
- <A href="#2.2">2.2</A>) Why are table, column, type, function,
+ <A href="#item2.2">2.2</A>) Why are table, column, type, function,
view names sometimes referenced as <I>Name</I> or <I>NameData,</I>
and sometimes as <I>char *?</I><BR>
- <A href="#2.3">2.3</A>) Why do we use <I>Node</I> and <I>List</I>
+ <A href="#item2.3">2.3</A>) Why do we use <I>Node</I> and <I>List</I>
to make data structures?<BR>
- <A href="#2.4">2.4</A>) I just added a field to a structure. What
+ <A href="#item2.4">2.4</A>) I just added a field to a structure. What
else should I do?<BR>
- <A href="#2.5">2.5</A>) Why do we use <I>palloc</I>() and
+ <A href="#item2.5">2.5</A>) Why do we use <I>palloc</I>() and
<I>pfree</I>() to allocate memory?<BR>
- <A href="#2.6">2.6</A>) What is ereport()?<BR>
- <A href="#2.7">2.7</A>) What is CommandCounterIncrement()?<BR>
- <A href="#2.8">2.8</A>) What debugging features are available?<BR>
+ <A href="#item2.6">2.6</A>) What is ereport()?<BR>
+ <A href="#item2.7">2.7</A>) What is CommandCounterIncrement()?<BR>
+ <A href="#item2.8">2.8</A>) What debugging features are available?<BR>
<BR>
<H2>General Questions</H2>
- <H3 ID="1.1">1.1) How do I get involved in PostgreSQL
+ <H3 id="item1.1">1.1) How do I get involved in PostgreSQL
development?</H3>
<P>Download the code and have a look around. See <A href=
contributors and core members of the project discuss
development.</P>
- <H3 ID="1.2">1.2) What development environment is required
+ <H3 id="item1.2">1.2) What development environment is required
to develop code?</H3>
<P>PostgreSQL is developed mostly in the C programming language. It
when you make a modification to a C header file, all files depend
upon that file are also rebuilt.</P>
- <H3 ID="1.3">1.3) What areas need work?</H3>
+ <H3 id="item1.3">1.3) What areas need work?</H3>
Outstanding features are detailed in the TODO list. This is located
in <I>doc/TODO</I> in the source distribution or at <A href=
"http://www.postgresql.org/docs/faqs.TODO.html">
archives, the SQL standards and the recommend texts (see <A href=
"#1.10">1.10</A>).</P>
- <H3 ID="1.4">1.4) What do I do after choosing an item to
+ <H3 id="item1.4">1.4) What do I do after choosing an item to
work on?</H3>
<P>Send an email to pgsql-hackers with a proposal for what you want
<a href="http://momjian.postgresql.org/cgi-bin/pgpatches_hold">
http://momjian.postgresql.org/cgi-bin/pgpatches2</a>.</P>
- <H3 ID="1.5">1.5) I've developed a patch, what next?</H3>
+ <H3 id="item1.5">1.5) I've developed a patch, what next?</H3>
<P>Generate the patch in contextual diff format. If you are
unfamiliar with this, you might find the script
that, let us know and we will manually update the documentation when
the patch is applied.</P>
- <H3 ID="1.6">1.6) Where can I learn more about the
+ <H3 id="item1.6">1.6) Where can I learn more about the
code?</H3>
<P>Other than documentation in the source tree itself, you can find
"http://www.postgresql.org/developer">
http://www.postgresql.org/developer</A>.</P>
- <H3 ID="1.7">1.7) How do I download/update the current
+ <H3 id="item1.7">1.7) How do I download/update the current
source tree?</H3>
<P>There are several ways to obtain the source tree. Occasional
"http://developer.postgresql.org/docs/postgres/cvs.html">
http://developer.postgresql.org/docs/postgres/cvs.html</A>.</P>
- <H3 ID="1.8">1.8) How do I test my changes?</H3>
+ <H3 id="item1.8">1.8) How do I test my changes?</H3>
<P><B>Basic system testing</B></P>
you can use the <I>--enable-depend</I> option of <I>configure</I>
to have the compiler compute the dependencies automatically.</P>
- <H3 ID="1.9">1.9) What tools are available for
+ <H3 id="item1.9">1.9) What tools are available for
developers?</H3>
<P>First, all the files in the <I>src/tools</I> directory are
There is also a script called <I>unused_oids</I> in
<I>pgsql/src/include/catalog</I> that shows the unused oids.</P>
- <H3 ID="1.10">1.10) What books are good for
+ <H3 id="item1.10">1.10) What books are good for
developers?</H3>
<P>I have four good books, <I>An Introduction to Database
on-line written by Jim Gray at <A href=
"http://www.benchmarkresources.com">http://www.benchmarkresources.com.</A>.</P>
- <H3 ID="1.11">1.11) What is configure all about?</H3>
+ <H3 id="item1.11">1.11) What is configure all about?</H3>
<P>The files <I>configure</I> and <I>configure.in</I> are part of
the GNU <I>autoconf</I> package. Configure allows us to test for
all files derived by configure are removed, so you see only the
file contained in the source distribution.</P>
- <H3 ID="1.12">1.12) How do I add a new port?</H3>
+ <H3 id="item1.12">1.12) How do I add a new port?</H3>
<P>There are a variety of places that need to be modified to add a
new port. First, start in the <I>src/template</I> directory. Add an
handling. There is a <I>backend/port</I> directory if you need
special files for your OS.</P>
- <H3 ID="1.13">1.13) Why don't you use threads, raw
+ <H3 id="item1.13">1.13) Why don't you use threads, raw
devices, async-I/O, <insert your favorite wizz-bang feature
here>?</H3>
cautious about their adoption. The TODO list often contains links
to discussions showing our reasoning in these areas.</P>
- <H3 ID="1.14">1.14) How are RPMs packaged?</H3>
+ <H3 id="item1.14">1.14) How are RPMs packaged?</H3>
<P>This was written by Lamar Owen:</P>
<P>Of course, there are many projects that DO include all the files
necessary to build RPMs from their Official Tarball (TM).</P>
- <H3 ID="1.15">1.15) How are CVS branches managed?</H3>
+ <H3 id="item1.15">1.15) How are CVS branches managed?</H3>
<P>This was written by Tom Lane:</P>
dot-release or two, so that we won't have to double-patch the first
wave of fixes.</P>
- <H3 ID="1.16">1.16) Where can I get a copy of the SQL
+ <H3 id="item1.16">1.16) Where can I get a copy of the SQL
standards?</H3>
<P>There are three versions of the SQL standard: SQL-92, SQL:1999,
(paper)</LI>
</UL>
- <H3 ID="1.17">1.17) Where can I get technical
+ <H3 id="item1.17">1.17) Where can I get technical
assistance?</H3>
<P>Many technical questions held by those new to the code have been
questions about development of new features, on IRC at
irc.freenode.net in the #postgresql channel.</P>
- <H3 ID="1.18">1.18) How do I get involved in PostgreSQL
+ <H3 id="item1.18">1.18) How do I get involved in PostgreSQL
web site development?</H3>
<P>PostgreSQL website development is discussed on the
<H2>Technical Questions</H2>
- <H3 ID="2.1">2.1) How do I efficiently access information
+ <H3 id="item2.1">2.1) How do I efficiently access information
in tables from the backend code?</H3>
<P>You first need to find the tuples(rows) you are interested in.
<I>ReleaseBuffer()</I>, in the <I>heap_fetch()</I> case. Or it may
be a palloc'ed tuple, that you must <I>pfree()</I> when finished.
- <H3 ID="2.2">2.2) Why are table, column, type, function,
+ <H3 id="item2.2">2.2) Why are table, column, type, function,
view names sometimes referenced as <I>Name</I> or <I>NameData,</I>
and sometimes as <I>char *?</I></H3>
names(char *), there are many cases where Name and char * are used
interchangeably.</P>
- <H3 ID="2.3">2.3) Why do we use <I>Node</I> and
+ <H3 id="item2.3">2.3) Why do we use <I>Node</I> and
<I>List</I> to make data structures?</H3>
<P>We do this because this allows a consistent way to pass data
The output appears in the postmaster log file, or on your screen if
you are running a backend directly without a postmaster.
- <H3 ID="2.4">2.4) I just added a field to a structure.
+ <H3 id="item2.4">2.4) I just added a field to a structure.
What else should I do?</H3>
<P>The structures passing around from the parser, rewrite,
the files <I>copyfuncs.c</I> and <I>equalfuncs.c</I>. Make sure you
add support for your new field to these files. Find any other
places the structure might need code for your new field. <I>mkid</I>
- is helpful with this (see <A href="#1.9">1.9</A>).</P>
+ is helpful with this (see <A href="#item1.9">1.9</A>).</P>
- <H3 ID="2.5">2.5) Why do we use <I>palloc</I>() and
+ <H3 id="item2.5">2.5) Why do we use <I>palloc</I>() and
<I>pfree</I>() to allocate memory?</H3>
<P><I>palloc()</I> and <I>pfree()</I> are used in place of malloc()
memory can be allocated in. These affect when the allocated memory
is freed by the backend.</P>
- <H3 ID="2.6">2.6) What is ereport()?</H3>
+ <H3 id="item2.6">2.6) What is ereport()?</H3>
<P><I>ereport()</I> is used to send messages to the front-end, and
optionally terminate the current query being processed. The first
descriptors so you don't need to clean these up before the
call.</P>
- <H3 ID="2.7">2.7) What is CommandCounterIncrement()?</H3>
+ <H3 id="item2.7">2.7) What is CommandCounterIncrement()?</H3>
<P>Normally, transactions can not see the rows they modify. This
allows <CODE>UPDATE foo SET x = x + 1</CODE> to work correctly.</P>
increments the Command Counter, creating a new part of the
transaction.</P>
- <H3 ID="2.8">2.8) What debugging features are
+ <H3 id="item2.8">2.8) What debugging features are
available?</H3>
<P>First, try running <I>configure</I> with the --enable-cassert