Commit d8005325 authored by Bruce Momjian's avatar Bruce Momjian

Move FAQ source into main cvs tree.

parent 9f442cbf
<HTML>
<HEAD>
<TITLE>PostgreSQL FAQ</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#A00000" ALINK="#0000FF">
<H1>
Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<P>
Last updated: Fri Jun 2 11:32:13 EDT 2000
<P>
Current maintainer: Bruce Momjian (<A
HREF="mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR><P>
The most recent version of this document can be viewed at the postgreSQL
Web site, <A HREF="http://www.Postgresql.org">http://www.PostgreSQL.org</A>.<P>
Linux-specific questions are answered in <A
HREF="http://www.PostgreSQL.org/docs/faq-linux.html">http://www.PostgreSQL.org/docs/faq-linux.html</A>.<P>
HPUX-specific questions are answered in <A
HREF="http://www.PostgreSQL.org/docs/faq-hpux.html">http://www.PostgreSQL.org/docs/faq-hpux.html</A>.<P>
Solaris-specific questions are answered in <A
HREF="http://www.postgresql.org/docs/faq-solaris.html">http://www.postgresql.org/docs/faq-solaris.html</A>.<P>
Irix-specific questions are answered in <A
HREF="http://www.PostgreSQL.org/docs/faq-irix.html">http://www.PostgreSQL.org/docs/faq-irix.html</A>.<P>
<HR><P>
<H2><CENTER>General Questions</CENTER></H2>
<A HREF="#1.1">1.1</A>) What is PostgreSQL?<BR>
<A HREF="#1.2">1.2</A>) What's the copyright on PostgreSQL?<BR>
<A HREF="#1.3">1.3</A>) What Unix platforms does PostgreSQL run on?<BR>
<A HREF="#1.4">1.4</A>) What non-unix ports are available?<BR>
<A HREF="#1.5">1.5</A>) Where can I get PostgreSQL?<BR>
<A HREF="#1.6">1.6</A>) Where can I get support for PostgreSQL?<BR>
<A HREF="#1.7">1.7</A>) What is the latest release of PostgreSQL?<BR>
<A HREF="#1.8">1.8</A>) What documentation is available for PostgreSQL?<BR>
<A HREF="#1.9">1.9</A>) How do I find out about known bugs or missing features?<BR>
<A HREF="#1.10">1.10</A>) How can I learn SQL?<BR>
<A HREF="#1.11">1.11</A>) Is PostgreSQL Y2K compliant?<BR>
<A HREF="#1.12">1.12</A>) How do I join the development team?<BR>
<A HREF="#1.13">1.13</A>) How do I submit a bug report?<BR>
<A HREF="#1.14">1.14</A>) How does PostgreSQL compare to other DBMS's?<BR>
<H2><CENTER>User Client Questions</CENTER></H2>
<A HREF="#2.1">2.1</A>) Are there ODBC drivers for
PostgreSQL?<BR>
<A HREF="#2.2">2.2</A>) What tools are available for hooking
PostgreSQL to Web pages?<BR>
<A HREF="#2.3">2.3</A>) Does PostgreSQL have a graphical user interface?
A report generator? An embedded query language interface?<BR>
<A HREF="#2.4">2.4</A>) What languages are available to communicate
with PostgreSQL?<BR>
<H2><CENTER>Administrative Questions</CENTER></H2>
<A HREF="#3.1">3.1</A>) Why does initdb fail?<BR>
<A HREF="#3.2">3.2</A>) How do I install PostgreSQL somewhere other than
/usr/local/pgsql?<BR>
<A HREF="#3.3">3.3</A>) When I start the postmaster, I get a
<I>Bad System Call</I> or core dumped message. Why?<BR>
<A HREF="#3.4">3.4</A>) When I try to start the postmaster, I get
<I>IpcMemoryCreate</I> errors3. Why?<BR>
<A HREF="#3.5">3.5</A>) When I try to start the postmaster, I get
<I>IpcSemaphoreCreate</I> errors. Why?<BR>
<A HREF="#3.6">3.6</A>) How do I prevent other hosts from accessing my
PostgreSQL database?<BR>
<A HREF="#3.7">3.7</A>) Why can't I connect to my database from
another machine?<BR>
<A HREF="#3.8">3.8</A>) Why can't I access the database as the
<I>root</I> user?<BR>
<A HREF="#3.9">3.9</A>) All my servers crash under concurrent
table access. Why?<BR>
<A HREF="#3.10">3.10</A>) How do I tune the database engine for
better performance?<BR>
<A HREF="#3.11">3.11</A>) What debugging features are available in
PostgreSQL?<BR>
<A HREF="#3.12">3.12</A>) I get 'Sorry, too many clients' when trying to
connect. Why?<BR>
<A HREF="#3.13">3.13</A>) What are the pg_psort.XXX files in my
database directory?<BR>
<H2><CENTER>Operational Questions</CENTER></H2>
<A HREF="#4.1">4.1</A>) The system seems to be confused about commas,
decimal points, and date formats.<BR>
<A HREF="#4.2">4.2</A>) What is the exact difference between
binary cursors and normal cursors?<BR>
<A HREF="#4.3">4.3</A>) How do I <I>select</I> only the first few rows of
a query?<BR>
<A HREF="#4.4">4.4</A>) How do I get a list of tables, or other
things I can see in <I>psql?</I><BR>
<A HREF="#4.5">4.5</A>) How do you remove a column from a table?<BR>
<A HREF="#4.6">4.6</A>) What is the maximum size for a
row, table, database?<BR>
<A HREF="#4.7">4.7</A>) How much database disk space is required
to store data from a typical flat file?<BR>
<A HREF="#4.8">4.8</A>) How do I find out what indices or
operations are defined in the database?<BR>
<A HREF="#4.9">4.9</A>) My queries are slow or don't make use of the
indexes. Why?<BR>
<A HREF="#4.10">4.10</A>) How do I see how the query optimizer is
evaluating my query?<BR>
<A HREF="#4.11">4.11</A>) What is an R-tree index?<BR>
<A HREF="#4.12">4.12</A>) What is Genetic Query Optimization?<BR>
<A HREF="#4.13">4.13</A>) How do I do regular expression searches
and case-insensitive regexp searching?<BR>
<A HREF="#4.14">4.14</A>) In a query, how do I detect if a field
is NULL?<BR>
<A HREF="#4.15">4.15</A>) What is the difference between the
various character types?<BR>
<A HREF="#4.16.1">4.16.1</A>) How do I create a serial/auto-incrementing field?<BR>
<A HREF="#4.16.2">4.16.2</A>) How do I get the value of a serial insert?<BR>
<A HREF="#4.16.3">4.16.3</A>) Don't currval() and nextval() lead to a
race condition with other concurrent backend processes?<BR>
<A HREF="#4.17">4.17</A>) What is an oid? What is a tid?<BR>
<A HREF="#4.18">4.18</A>) What is the meaning of some of the terms
used in PostgreSQL?<BR>
<A HREF="#4.19">4.19</A>) Why do I get the error "FATAL: palloc
failure: memory exhausted?"<BR>
<A HREF="#4.20">4.20</A>) How do I tell what PostgreSQL version I
am running? <BR>
<A HREF="#4.21">4.21</A>) My large-object operations get <I>invalid
large obj descriptor.</I> Why?<BR>
<A HREF="#4.22">4.22</A>) How do I create a column that will default to the
current time?<BR>
<A HREF="#4.23">4.23</A>) Why are my subqueries using <CODE>IN</CODE> so
slow?<BR>
<A HREF="#4.24">4.24</A>) How do I do an <i>outer</i> join?<BR>
<H2><CENTER>Extending PostgreSQL</CENTER></H2>
<A HREF="#5.1">5.1</A>) I wrote a user-defined function. When I run
it in <I>psql,</I> why does it dump core?<BR>
<A HREF="#5.2">5.2</A>) What does the message:
<I>NOTICE:PortalHeapMemoryFree: 0x402251d0 not in alloc set!</I> mean?<BR>
<A HREF="#5.3">5.3</A>) How can I contribute some nifty new types and functions
for PostgreSQL?<BR>
<A HREF="#5.4">5.4</A>) How do I write a C function to return a
tuple?<BR>
<A HREF="#5.5">5.5</A>) I have changed a source file. Why does the
recompile does not see the change?<BR>
<HR>
<H2><CENTER>General Questions</CENTER></H2>
<H4><A
NAME="1.1">1.1</A>) What is PostgreSQL?</H4><P>
PostgreSQL is an enhancement of the POSTGRES database management system,
a next-generation DBMS research prototype. While PostgreSQL retains the
powerful data model and rich data types of POSTGRES, it replaces the
PostQuel query language with an extended subset of SQL. PostgreSQL is
free and the complete source is available.<P>
PostgreSQL development is being performed by a team of Internet
developers who all subscribe to the PostgreSQL development mailing list.
The current coordinator is Marc G. Fournier (<A
HREF="mailto:scrappy@postgreSQL.org">scrappy@postgreSQL.org</A>). (See
below on how to join). This team is now responsible for all current and
future development of PostgreSQL.<P>
The authors of PostgreSQL 1.01 were Andrew Yu and Jolly Chen. Many
others have contributed to the porting, testing, debugging and
enhancement of the code. The original Postgres code, from which
PostgreSQL is derived, was the effort of many graduate students,
undergraduate students, and staff programmers working under the
direction of Professor Michael Stonebraker at the University of
California, Berkeley.<P>
The original name of the software at Berkeley was Postgres. When SQL
functionality was added in 1995, its name was changed to Postgres95. The
name was changed at the end of 1996 to PostgreSQL.<P>
It is pronounced <I>Post-Gres-Q-L.</I>
<H4><A NAME="1.2">1.2</A>) What's the copyright on
PostgreSQL?</H4><P>
PostgreSQL is subject to the following COPYRIGHT.<P>
PostgreSQL Data Base Management System<P>
Portions copyright (c) 1996-2000, PostgreSQL, Inc
Portions Copyright (c) 1994-6 Regents of the University of California<P>
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written
agreement is hereby granted, provided that the above copyright notice
and this paragraph and the following two paragraphs appear in all
copies.<P>
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.<P>
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER
IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO
OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.<P>
<H4><A NAME="1.3">1.3</A>) What Unix platforms does PostgreSQL run
on?</H4><P>
The authors have compiled and tested PostgreSQL on the following
platforms (some of these compiles require gcc):
<UL>
<LI> aix - IBM on AIX 3.2.5 or 4.x
<LI> alpha - DEC Alpha AXP on Digital Unix 2.0, 3.2, 4.0
<LI> BSD44_derived - OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)
<LI> bsdi - BSD/OS 2.x, 3.x, 4.x
<LI> dgux - DG/UX 5.4R4.11
<LI> hpux - HP PA-RISC on HP-UX 9.*, 10.*
<LI> i386_solaris - i386 Solaris
<LI> irix5 - SGI MIPS on IRIX 5.3
<LI> linux - Intel i86
Alpha
SPARC
PPC
M68k
<LI> sco - SCO 3.2v5
Unixware
<LI> sparc_solaris - SUN SPARC on Solaris 2.4, 2.5, 2.5.1
<LI> sunos4 - SUN SPARC on SunOS 4.1.3
<LI> svr4 - Intel x86 on Intel SVR4 and MIPS
<LI> ultrix4 - DEC MIPS on Ultrix 4.4
</UL>
<P>
<H4><A NAME="1.4">1.4</A>) What non-unix ports are available?</H4><P>
It is possible to compile the libpq C library, psql, and other
interfaces and binaries to run on MS Windows platforms. In this case,
the client is running on MS Windows, and communicates via TCP/IP to a
server running on one of our supported Unix platforms.<P>
A file <I>win31.mak</I> is included in the distribution for making a
Win32 libpq library and psql.<P>
The database server is now working on Windows NT using the Cygnus
Unix/NT porting library. See pgsql/doc/README.NT in the distribution.<P>
There is also a web page at <A HREF=
"http://www.freebsd.org/~kevlo/postgres/portNT.html">
http://www.freebsd.org/~kevlo/postgres/portNT.html.</A>
There is another port using U/Win at <A HREF=
"http://surya.wipro.com/uwin/ported.html">http://surya.wipro.com/uwin/ported.html.</A>
<H4><A NAME="1.5">1.5</A>) Where can I get PostgreSQL?</H4><P>
The primary anonymous ftp site for PostgreSQL is
<A
HREF="ftp://ftp.postgreSQL.org/pub">ftp://ftp.postgreSQL.org/pub</A>
<P>
For mirror sites, see our main web site.
<H4><A NAME="1.6">1.6</A>) Where can I get support for PostgreSQL?</H4><P>
There is no official support for PostgreSQL from the University of
California, Berkeley. It is maintained through volunteer effort.<P>
The main mailing list is: <A
HREF="mailto:pgsql-general@postgreSQL.org">pgsql-general@postgreSQL.org</A>.
It is available for discussion of matters pertaining to PostgreSQL.
To subscribe, send a mail with the lines in the body (not
the subject line)
<PRE>
subscribe
end
</PRE><P>
to <A
HREF="mailto:pgsql-general-request@postgreSQL.org">pgsql-general-request@postgreSQL.org</A>.<P>
There is also a digest list available. To subscribe to this list, send
email to: <A HREF="mailto:pgsql-general-digest-request@postgreSQL.org">
pgsql-general-digest-request@postgreSQL.org</A> with a BODY of:
<PRE>
subscribe
end
</PRE>
Digests are sent out to members of this list whenever the main list has
received around 30k of messages.<P>
The bugs mailing list is available. To subscribe to this list, send email
to <A
HREF="mailto:bugs-request@postgreSQL.org">bugs-request@postgreSQL.org</A>
with a BODY of:<P>
<PRE>
subscribe
end
</PRE>
There is also a developers discussion mailing list available. To
subscribe to this list, send email to <A
HREF="mailto:hackers-request@postgreSQL.org">hackers-request@postgreSQL.org</A>
with a BODY of:<P>
<PRE>
subscribe
end
</PRE><P>
Additional mailing lists and information about PostgreSQL can be found
via the PostgreSQL WWW home page at:
<BLOCKQUOTE>
<A HREF="http://postgreSQL.org">http://postgreSQL.org</A>
</BLOCKQUOTE><P>
There is also an IRC channel on EFNet, channel #PostgreSQL.
I use the unix command <CODE>irc -c '#PostgreSQL' "$USER"
irc.phoenix.net</CODE><P>
Commercial support for PostgreSQL is available at <A
HREF="http://www.pgsql.com">http://www.pgsql.com/</A><P>
<H4><A NAME="1.7">1.7</A>) What is the latest release of PostgreSQL?</H4><P>
The latest release of PostgreSQL is version 7.0.2.<P>
We plan to have major releases every four months.<P>
<H4><A NAME="1.8">1.8</A>) What documentation is available for PostgreSQL?</H4><P>
Several manuals, manual pages, and some small test examples are
included in the distribution. See the /doc directory. You can also
browse the manual on-line at <A
HREF="http://www.postgresql.org/docs/postgres">
http://www.postgresql.org/docs/postgres.</A>
in the distribution.
<P>
There is a PostgreSQL book availiable at <A
HREF="http://www.postgresql.org/docs/awbook.html">
http://www.postgresql.org/docs/awbook.html</A><P>
<I>psql</I> has some nice \d commands to show information about types,
operators, functions, aggregates, etc.<P>
The web site contains even more documentation.<P>
<H4><A NAME="1.9">1.9</A>) How do I find out about known bugs or missing features?
</H4><P>
PostgreSQL supports an extended subset of SQL-92. See our
<A HREF="http://www.postgreSQL.org/docs/todo.html">
TODO</A> for a list of known bugs, missing features, and future plans.<P>
<H4><A NAME="1.10">1.10</A>) How can I learn SQL?</H4><P>
The PostgreSQL book at <A
HREF="http://www.postgresql.org/docs/awbook.html">
http://www.postgresql.org/docs/awbook.html</A> teaches SQL.
There is a nice tutorial at <A
HREF="http://w3.one.net/~jhoffman/sqltut.htm">
http://w3.one.net/~jhoffman/sqltut.htm</A> and at <A
HREF="http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM">
http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM.</A><P>
Another one is "Teach Yourself SQL in 21 Days, Second Edition" at <A
HREF="http://members.tripod.com/er4ebus/sql/index.htm">
http://members.tripod.com/er4ebus/sql/index.htm </A><P>
Many of our users like <I>The Practical SQL Handbook</I>, Bowman et al.,
Addison Wesley. Others like <I>The Complete Reference SQL</I>, Groff et al.,
McGraw-Hill.<P>
<H4><A NAME="1.11">1.11</A>) Is PostgreSQL Y2K compliant?</H4><P>
Yes, we easily handle dates past the year 2000AD, and before 2000BC.<P>
<H4><A NAME="1.12">1.12</A>) How do I join the development team?</H4><P>
First, download the latest sources and read the PostgreSQL Developers
documentation on our web site, or in the distribution.
Second, subscribe to the pgsql-hackers and pgsql-patches mailing lists.
Third, submit high-quality patches to pgsql-patches.<P>
There are about a dozen people who have <SMALL>COMMIT</SMALL> privileges to
the PostgreSQL CVS archive. All of them have submitted so many
high-quality patches that it was a pain for the existing
committers to keep up, and we had confidence that patches they
committed were likely to be of high quality.
<H4><A NAME="1.13">1.13</A>) How do I submit a bug report?</H4><P>
Fill out the "bug-template" file and send it to: <A
HREF="mailto:bugs@postgreSQL.org">bugs@postgreSQL.org</A><P>
Also check out our ftp site <A
HREF="ftp://ftp.postgreSQL.org/pub">ftp://ftp.postgreSQL.org/pub</A> to
see if there is a more recent PostgreSQL version or patches.<P>
<H4><A NAME="1.14">1.14</A>) How does PostgreSQL compare to other
DBMS's?</H4><P>
There are several ways of measuring software: features, performance,
reliability, support, and price.<P>
<DL>
<DT> <B>Features</B>
<DD>
PostgreSQL has most features present in large commercial DBMS's, like
transactions, subselects, triggers, views, foreign key referential
integrity, and sophisticated locking. We have some features they don't
have, like user-defined types, inheritance, rules, and multi-version
concurrency control to reduce lock contention. We don't have outer
joins, but are working on them for our next release.<BR><BR>
<DT> <B>Performance</B>
<DD>
PostgreSQL runs in two modes. Normal <I>fsync</I> mode flushes every
completed transaction to disk, guaranteeing that if the OS crashes or
loses power in the next few seconds, all your data is safely stored on
disk. In this mode, we are slower than most commercial databases, partly
because few of them do such conservative flushing to disk in their
default modes. In <I>no-fsync</I> mode, we are usually faster than
commercial databases, though in this mode, an OS crash could cause data
corruption. We are working to provide an intermediate mode that suffers
less performance overhead than full fsync mode, and will allow data
integrity within 30 seconds of an OS crash. The mode is select-able by
the database administrator.<BR><BR>
In comparison to MySQL or leaner database systems, we are slower on
inserts/updates because we have transaction overhead. Of course, MySQL
doesn't have any of the features mentioned in the <I>Features</I>
section above. We are built for flexibility and features, though we
continue to improve performance through profiling and source code
analysis. There is an interesting web page comparing PostgreSQL to MySQL
at <a href="http://openacs.org/why-not-mysql.html">
http://openacs.org/why-not-mysql.html</a><BR><BR>
We handle each user connection by creating a Unix process. Backend
processes share data buffers and locking information. With multiple
CPU's, multiple backends can easily run on different CPU's.<BR><BR>
<DT> <B>Reliability</B>
<DD>
We realize that a DBMS must be reliable, or it is worthless. We strive
to release well-tested, stable code that has a minimum of bugs. Each
release has at least one month of beta testing, and our release history
shows that we can provide stable, solid releases that are ready for
production use. We believe we compare favorably to other database
software in this area.<BR><BR>
<DT> <B>Support</B>
<DD>
Our mailing list provides a large group of developers and users to help
resolve any problems encountered. While we can not guarantee a fix,
commercial DBMS's don't always supply a fix either. Direct access to
developers, the user community, manuals, and the source code often make
PostgreSQL support superior to other DBMS's.
There is commercial per-incident support available for those who need
it. (See support FAQ item.)<BR><BR>
<DT> <B>Price</B>
<DD>
We are free for all use, both commercial and non-commercial. You can
add our code to your product with no limitations, except those outlined
in our BSD-style license stated above.<BR><BR>
</DL>
<HR>
<H2><CENTER>User Client Questions</CENTER></H2>
<P>
<H4><A NAME="2.1">2.1</A>) Are there ODBC drivers for PostgreSQL?</H4><P>
There are two ODBC drivers available, PsqlODBC and OpenLink ODBC.<P>
PsqlODBC is included in the distribution. More information about it can
be gotten from: <A HREF="ftp://ftp.postgresql.org/pub/odbc/index.html">
ftp://ftp.postgresql.org/pub/odbc/index.html</A><P>
OpenLink ODBC can be gotten from <A HREF="http://www.openlinksw.com/">
http://www.openlinksw.com</A>. It works with their standard ODBC client
software so you'll have PostgreSQL ODBC available on every client
platform they support (Win, Mac, Unix, VMS).<P>
They will probably be selling this product to people who need
commercial-quality support, but a freeware version will always be
available. Questions to <A
HREF="mailto:postgres95@openlink.co.uk">postgres95@openlink.co.uk</A>.<P>
See also the <A HREF="http://www.postgresql.org/docs/programmer/odbc.htm">
ODBC chapter of the Programmer's Guide</A>.<P>
<H4><A NAME="2.2">2.2</A>) What tools are available for hooking
PostgreSQL to Web pages?</H4><P>
A nice introduction to Database-backed Web pages can be seen at: <A
HREF="http://www.webtools.com">http://www.webtools.com</A><P>
There is also one at <A HREF="http://www.phone.net/home/mwm/hotlist/">
http://www.phone.net/home/mwm/hotlist/.</A><P>
For web integration, PHP is an excellent interface. It is at:
<A HREF="http://www.php.net">http://www.php.net</A><P>
PHP is great for simple stuff, but for more complex cases, many
use the perl interface and CGI.pm.<P>
A WWW gateway based on WDB using perl can be downloaded from <A
HREF="http://www.eol.ists.ca/~dunlop/wdb-p95">http://www.eol.ists.ca/~dunlop/wdb-p95</A>
<H4><A NAME="2.3">2.3</A>) Does PostgreSQL have a graphical user interface?
A report generator? An embedded query language interface?</H4><P>
We have a nice graphical user interface called <I>pgaccess,</I> which is
shipped as part of the distribution. <I>Pgaccess</I> also has a report
generator. The web page is <A HREF=
"http://www.flex.ro/pgaccess">http://www.flex.ro/pgaccess</A><P>
We also include <I>ecpg,</I> which is an embedded SQL query language interface for
C.
<H4><A NAME="2.4">2.4</A>) What languages are available to
communicate with PostgreSQL?</H4><P>
We have:
<UL>
<LI>C(libpq)
<LI>C++(libpq++)
<LI>Embedded C(ecpg)
<LI>Java(jdbc)
<LI>Perl(perl5)
<LI>ODBC(odbc)
<LI>Python(PyGreSQL)
<LI>TCL(libpgtcl)
<LI>C Easy API(libpgeasy)
<LI>Embedded HTML(<A HREF="http://www.php.net">PHP from http://www.php.net</A>)
</UL><P>
<HR>
<H2><CENTER>Administrative Questions</CENTER></H2><P>
<H4><A NAME="3.1">3.1</A>) Why does initdb fail?</H4><P>
<UL>
<LI> check that you don't have any of the previous version's binaries in
your path
<LI> check to see that you have the proper paths set
<LI> check that the <I>postgres</I> user owns the proper files
</UL><P>
<H4><A NAME="3.2">3.2</A>) How do I install PostgreSQL somewhere
other than /usr/local/pgsql?</H4><P>
The simplest way is to specify the --prefix option when running configure.
If you forgot to do that, you can edit Makefile.global and change POSTGRESDIR
accordingly, or create a Makefile.custom and define POSTGRESDIR there.<P>
<H4><A NAME="3.3">3.3</A>) When I start the postmaster, I get a <I>Bad
System Call</I> or core dumped message. Why?</H4><P>
It could be a variety of problems, but first check to see that you
have system V extensions installed in your kernel. PostgreSQL requires
kernel support for shared memory and semaphores.<P>
<H4><A NAME="3.4">3.4</A>) When I try to start the postmaster, I
get <I>IpcMemoryCreate</I> errors. Why?</H4><P>
You either do not have shared memory configured properly in kernel or
you need to enlarge the shared memory available in the kernel. The
exact amount you need depends on your architecture and how many buffers
and backend processes you configure postmaster to run with.
For most systems, with default numbers of buffers and processes, you
need a minimum of ~1MB.<P>
<H4><A NAME="3.5">3.5</A>) When I try to start the postmaster, I
get <I>IpcSemaphoreCreate</I> errors. Why?</H4><P>
If the error message is <I>IpcSemaphoreCreate: semget failed (No space
left on device)</I> then your kernel is not configured with enough
semaphores. Postgres needs one semaphore per potential backend process.
A temporary solution is to start the postmaster with a smaller limit on
the number of backend processes. Use <I>-N</I> with a parameter less
than the default of 32. A more permanent solution is to increase your
kernel's <SMALL>SEMMNS</SMALL> and <SMALL>SEMMNI</SMALL> parameters.<P>
If the error message is something else, you might not have semaphore
support configured in your kernel at all.<P>
<H4><A NAME="3.6">3.6</A>) How do I prevent other hosts from
accessing my PostgreSQL database?</H4><P>
By default, PostgreSQL only allows connections from the local machine
using Unix domain sockets. Other machines will not be able to connect
unless you add the <I>-i</I> flag to the <I>postmaster,</I>
<B>and</B> enable host-based authentication by modifying the file
<I>$PGDATA/pg_hba.conf</I> accordingly. This will allow TCP/IP connections.
<P>
<H4><A NAME="3.7">3.7</A>) Why can't I connect to my database from
another machine?</H4><P>
The default configuration allows only unix domain socket connections
from the local machine. To enable TCP/IP connections, make sure the
postmaster has been started with the <I>-i</I> option, and add an
appropriate host entry to the file
<I>pgsql/data/pg_hba.conf</I>. See the <I>pg_hba.conf</I> manual page.<P>
<H4><A NAME="3.8">3.8</A>) Why can't I access the database as the <I>root</I>
user?</H4><P>
You should not create database users with user id 0 (root). They will be
unable to access the database. This is a security precaution because
of the ability of any user to dynamically link object modules into the
database engine.<P>
<H4><A NAME="3.9">3.9</A>) All my servers crash under concurrent
table access. Why?</H4><P>
This problem can be caused by a kernel that is not configured to support
semaphores.<P>
<H4><A NAME="3.10">3.10</A>) How do I tune the database engine for
better performance?</H4><P>
Certainly, indices can speed up queries. The <SMALL>EXPLAIN</SMALL> command
allows you to see how PostgreSQL is interpreting your query, and which
indices are being used.<P>
If you are doing a lot of <SMALL>INSERTs</SMALL>, consider doing them in a large
batch using the <SMALL>COPY</SMALL> command. This is much faster than single
individual <SMALL>INSERTS.</SMALL> Second, statements not in a <SMALL>BEGIN
WORK/COMMIT</SMALL> transaction block are considered to be in their
own transaction. Consider performing several statements in a single
transaction block. This reduces the transaction overhead. Also
consider dropping and recreating indices when making large data
changes.<P>
There are several tuning things that can be done. You can disable
fsync() by starting the postmaster with a <I>-o -F</I> option. This will
prevent <I>fsync()'s</I> from flushing to disk after every transaction.<P>
You can also use the postmaster -B option to increase the number of
shared memory buffers used by the backend processes. If you make this
parameter too high, the postmaster may not start up because you've exceeded
your kernel's limit on shared memory space.
Each buffer is 8K and the default is 64 buffers.<P>
You can also use the backend -S option to increase the maximum amount
of memory used by the backend process for temporary sorts. The -S value
is measured in kilobytes, and the default is 512 (ie, 512K).<P>
You can also use the <SMALL>CLUSTER</SMALL> command to group data in base tables to
match an index. See the cluster(l) manual page for more details.<P>
<H4><A NAME="3.11">3.11</A>) What debugging features are available in
PostgreSQL?</H4><P>
PostgreSQL has several features that report status information that can
be valuable for debugging purposes.<P>
First, by running configure with the --enable-cassert option, many
<I>assert()'s</I> monitor the progress of the backend and halt the program when
something unexpected occurs.<P>
Both postmaster and postgres have several debug options available.
First, whenever you start the postmaster, make sure you send the
standard output and error to a log file, like:
<PRE>
cd /usr/local/pgsql
./bin/postmaster &gt;server.log 2&gt;&1 &
</PRE><P>
This will put a server.log file in the top-level PostgreSQL directory.
This file contains useful information about problems or errors
encountered by the server. Postmaster has a -d option that allows even
more detailed information to be reported. The -d option takes a number
that specifies the debug level. Be warned that high debug level values
generate large log files.<P>
If the <i>postmaster</i> is not running, you can actually run the
postgres backend from the command line, and type your SQL statement
directly. This is recommended <B>only</B> for debugging purposes. Note
that a newline terminates the query, not a semicolon. If you have
compiled with debugging symbols, you can use a debugger to see what is
happening. Because the backend was not started from the postmaster, it
is not running in an identical environment and locking/backend
interaction problems may not be duplicated.<P>
If the <i>postmaster</i> is running, start <I>psql</I> in one window,
then find the <small>PID</small> of the <i>postgres</i> process used by
<i>psql.</i> Use a debugger to attach to the <i>postgres</i>
<small>PID.</small> You can set breakpoints in the debugger and issue
queries from <i>psql.</i> If you are debugging <i>postgres</i> startup,
you can set PGOPTIONS="-W n", then start <i>psql.</i> This will cause
startup to delay for <i>n</i> seconds so you can attach with the
debugger and trace through the startup sequence.<P>
The postgres program has -s, -A, and -t options that can be very useful
for debugging and performance measurements.<P>
You can also compile with profiling to see what functions are taking
execution time. The backend profile files will be deposited in the
pgsql/data/base/dbname directory. The client profile file will be put
in the client's current directory.<P>
<H4><A NAME="3.12">3.12</A>) I get 'Sorry, too many clients' when trying
to connect. Why?</H4><P>
You need to increase the postmaster's limit on how many concurrent backend
processes it can start.<P>
In Postgres 6.5 and up, the default limit is 32 processes. You can
increase it by restarting the postmaster with a suitable <I>-N</I>
value. With the default configuration you can set <I>-N</I> as large as
1024; if you need more, increase <SMALL>MAXBACKENDS</SMALL> in
<I>include/config.h</I> and rebuild. You can set the default value of
<I>-N</I> at configuration time, if you like, using configure's
<I>--with-maxbackends</I> switch.<P>
Note that if you make <I>-N</I> larger than 32, you must also increase
<I>-B</I> beyond its default of 64; -B must be at least twice -N, and
probably should be more than that for best performance. For large
numbers of backend processes, you are also likely to find that you need
to increase various Unix kernel configuration parameters. Things to
check include the maximum size of shared memory blocks,
<SMALL>SHMMAX,</SMALL> the maximum number of semaphores,
<SMALL>SEMMNS</SMALL> and <SMALL>SEMMNI,</SMALL> the maximum number of
processes, <SMALL>NPROC,</SMALL> the maximum number of processes per
user, <SMALL>MAXUPRC,</SMALL> and the maximum number of open files,
<SMALL>NFILE</SMALL> and <SMALL>NINODE.</SMALL> The reason that Postgres
has a limit on the number of allowed backend processes is so that you
can ensure that your system won't run out of resources.<P>
In Postgres versions prior to 6.5, the maximum number of backends was
64, and changing it required a rebuild after altering the MaxBackendId
constant in <I>include/storage/sinvaladt.h.</I><P>
<H4><A NAME="3.13">3.13</A>) What are the pg_tempNNN.NN files in my
database directory?</H4><P>
They are temporary files generated by the query executor. For
example, if a sort needs to be done to satisfy an <SMALL>ORDER BY,</SMALL> and
the sort requires more space than the backend's -S parameter allows,
then temp files are created to hold the extra data.<P>
The temp files should go away automatically, but might not if a backend
crashes during a sort. If you have no transactions running at the time,
it is safe to delete the pg_tempNNN.NN files.<P>
<HR>
<H2><CENTER>Operational Questions</CENTER></H2><P>
<H4><A NAME="4.1">4.1</A>) The system seems to be confused about
commas, decimal points, and date formats.</H4><P>
Check your locale configuration. PostgreSQL uses the locale settings of
the user that ran the postmaster process. There are postgres and psql
SET commands to control the date format. Set those accordingly for
your operating environment.<P>
<H4><A NAME="4.2">4.2</A>) What is the exact difference between
binary cursors and normal cursors?</H4><P>
See the <SMALL>DECLARE</SMALL> manual page for a description.<P>
<H4><A NAME="4.3">4.3</A>) How do I <SMALL>SELECT</SMALL> only the first few
rows of a query?</H4><P>
See the <SMALL>FETCH</SMALL> manual page, or use SELECT ... LIMIT....<P>
The entire query may have to be evaluated, even if you only want the
first few rows. Consider a query that has an <SMALL>ORDER BY.</SMALL>
If there is an index that matches the <SMALL>ORDER BY</SMALL>,
PostgreSQL may be able to evaluate only the first few records requested,
or the entire query may have to be evaluated until the desired rows have
been generated.<P>
<H4><A NAME="4.4">4.4</A>) How do I get a list of tables, or other
information I see in <I>psql?</I><BR></H4><P>
You can read the source code for <I>psql,</I> file
pgsql/src/bin/psql/psql.c. It contains SQL commands that generate the
output for psql's backslash commands. You can also start <I>psql</I>
with the <I>-E</I> option so that it will print out the queries it uses
to execute the commands you give.<P>
<H4><A NAME="4.5">4.5</A>) How do you remove a column from a
table?</H4><P>
We do not support <SMALL>ALTER TABLE DROP COLUMN,</SMALL> but do
this:
<PRE>
SELECT ... -- select all columns but the one you want to remove
INTO TABLE new_table
FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
</PRE><P>
<H4><A NAME="4.6">4.6</A>) What is the maximum size for a
row, table, database?</H4><P>
These are the limits:
<PRE>
Maximum size for a database? unlimited (60GB databases exist)
Maximum size for a table? unlimited on all operating systems
Maximum size for a row? 8k, configurable to 32k
Maximum number of rows in a table? unlimited
Maximum number of columns table? unlimited
Maximum number of indexes on a table? unlimited
</PRE>
Of course, these are not actually unlimited, but limited to available
disk space.<P>
To change the maximum row size, edit <I>include/config.h</I> and change
<SMALL>BLCKSZ.</SMALL> To use attributes larger than 8K, you can also
use the large object interface.<P>
Row length limit will be removed in 7.1.<P>
<H4><A NAME="4.7">4.7</A>)How much database disk space is required to
store data from a typical flat file?<BR></H4><P>
A Postgres database can require about six and a half times the disk space
required to store the data in a flat file.<P>
Consider a file of 300,000 lines with two integers on each line. The
flat file is 2.4MB. The size of the PostgreSQL database file containing
this data can be estimated at 14MB:
<PRE>
36 bytes: each row header (approximate)
+ 8 bytes: two int fields @ 4 bytes each
+ 4 bytes: pointer on page to tuple
----------------------------------------
48 bytes per row
The data page size in PostgreSQL is 8192 bytes (8 KB), so:
8192 bytes per page
------------------- = 171 rows per database page (rounded up)
48 bytes per row
300000 data rows
-------------------- = 1755 database pages
171 rows per page
1755 database pages * 8192 bytes per page = 14,376,960 bytes (14MB)
</PRE></P>
Indexes do not contain as much overhead, but do contain the data that is
being indexed, so they can be large also.<P>
<H4><A NAME="4.8">4.8</A>) How do I find out what indices or
operations are defined in the database?</H4><P>
<I>psql</I> has a variety of backslash commands to show such information. Use
\? to see them.<P>
Also try the file <I>pgsql/src/tutorial/syscat.source.</I> It
illustrates many of the <SMALL>SELECT</SMALL>s needed to get information from
the database system tables.<P>
<H4><A NAME="4.9">4.9</A>) My queries are slow or don't make
use of the indexes. Why?</H4><P>
PostgreSQL does not automatically maintain statistics. One has to make
an explicit <SMALL>VACUUM</SMALL> call to update the statistics. After
statistics are updated, the optimizer knows how many rows in the table,
and can better decide if it should use indices. Note that the optimizer
does not use indices in cases when the table is small because a
sequential scan would be faster.<P>
For column-specific optimization statistics, use <SMALL>VACUUM
ANALYZE.</SMALL> <SMALL>VACUUM ANALYZE</SMALL> is important for complex
multi-join queries, so the optimizer can estimate the number of rows
returned from each table, and choose the proper join order. The backend
does not keep track of column statistics on its own, so <SMALL>VACUUM
ANALYZE</SMALL> must be run to collect them periodically.<P>
Indexes are usually not used for <SMALL>ORDER BY</SMALL> operations: a
sequential scan followed by an explicit sort is faster than an indexscan
of all tuples of a large table, because it takes fewer disk accesses.
<P>
When using wild-card operators such as <SMALL>LIKE</SMALL> or <I>~,</I> indices can
only be used if the beginning of the search is anchored to the start of
the string. So, to use indices, <SMALL>LIKE</SMALL> searches should not
begin with <I>%,</I> and <I>~</I>(regular expression searches) should
start with <I>^.</I>
<H4><A NAME="4.10">4.10</A>) How do I see how the query optimizer is
evaluating my query?</H4><P>
See the <SMALL>EXPLAIN</SMALL> manual page.<P>
<H4><A NAME="4.11">4.11</A>) What is an R-tree index?</H4><P>
An r-tree index is used for indexing spatial data. A hash index can't
handle range searches. A B-tree index only handles range searches in a
single dimension. R-tree's can handle multi-dimensional data. For
example, if an R-tree index can be built on an attribute of type <I>point,</I>
the system can more efficient answer queries like select all points
within a bounding rectangle.<P>
The canonical paper that describes the original R-Tree design is:<P>
Guttman, A. "R-Trees: A Dynamic Index Structure for Spatial Searching."
Proc of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, 45-57.<P>
You can also find this paper in Stonebraker's "Readings in Database
Systems"<P>
Builtin R-Trees can handle polygons and boxes. In theory, R-trees can
be extended to handle higher number of dimensions. In practice,
extending R-trees require a bit of work and we don't currently have any
documentation on how to do it.<P>
<H4><A NAME="4.12">4.12</A>) What is Genetic Query
Optimization?</H4><P>
The GEQO module in PostgreSQL is intended to solve the query
optimization problem of joining many tables by means of a Genetic
Algorithm (GA). It allows the handling of large join queries through
non-exhaustive search.<P>
For further information see the documentation.
<H4><A NAME="4.13">4.13</A>) How do I do regular expression searches and
case-insensitive regexp searching?</H4><P>
The <I>~</I> operator does regular-expression matching, and <I>~*</I>
does case-insensitive regular-expression matching. There is no
case-insensitive variant of the LIKE operator, but you can get the
effect of case-insensitive <SMALL>LIKE</SMALL> with this:
<PRE>
WHERE lower(textfield) LIKE lower(pattern)
</PRE>
<H4><A NAME="4.14">4.14</A>) In a query, how do I detect if a field
is NULL?</H4><P>
You test the column with IS NULL and IS NOT NULL.<P>
<H4><A NAME="4.15">4.15</A>) What is the difference between the
various character types?</H4>
<PRE>
Type Internal Name Notes
--------------------------------------------------
"char" char 1 character
CHAR(#) bpchar blank padded to the specified fixed length
VARCHAR(#) varchar size specifies maximum length, no padding
TEXT text length limited only by maximum row length
BYTEA bytea variable-length array of bytes
</PRE><P>
You will see the internal name when examining system catalogs
and in some error messages.<P>
The last four types above are "varlena" types (i.e. the first four bytes
are the length, followed by the data). <I>char(#)</I> allocates the
maximum number of bytes no matter how much data is stored in the field.
<I>text, varchar(#),</I> and <I>bytea</I> all have variable length on the disk,
and because of this, there is a small performance penalty for using
them. Specifically, the penalty is for access to all columns after the
first column of this type.<P>
<H4><A NAME="4.16.1">4.16.1</A>) How do I create a
serial/auto-incrementing field?</H4><P>
PostgreSQL supports <SMALL>SERIAL</SMALL> data type. It auto-creates a
sequence and index on the column. For example, this...
<PRE>
CREATE TABLE person (
id SERIAL,
name TEXT
);
</PRE>
...is automatically translated into this...
<PRE>
CREATE SEQUENCE person_id_seq;
CREATE TABLE person (
id INT4 NOT NULL DEFAULT nextval('person_id_seq'),
name TEXT
);
CREATE UNIQUE INDEX person_id_key ON person ( id );
</PRE>
See the <I>create_sequence</I> manual page for more information about sequences.
You can also use each row's <I>oid</I> field as a unique value. However, if
you need to dump and reload the database, you need to use <I>pg_dump's -o</I>
option or <SMALL>COPY WITH OIDS</SMALL> option to preserve the oids.<P>
For more details, see Bruce Momjian's chapter on
<A HREF="http://www.postgresql.org/docs/aw_pgsql_book">Numbering Rows.</A>
<H4><A NAME="4.16.2">4.16.2</A>) How do I get the back the generated SERIAL value after an insert?</H4><P>
Probably the simplest approach is to to retrieve the next SERIAL 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.16.1">4.16.1</A>, that might look like this:
<PRE>
$newSerialID = nextval('person_id_seq');
INSERT INTO person (id, name) VALUES ($newSerialID, 'Blaise Pascal');
</PRE>
You would then also have the new value stored in <CODE>$newSerialID</CODE> for use in other queries (e.g., as a foreign key to the <CODE>person</CODE> table). Note that the name of the automatically-created SEQUENCE object will be named &lt<I>table</I>&gt_&lt<I>serialcolumn</I>&gt_<I>seq</I>, where <I>table</I> and <I>serialcolumn</I> are the names of your table and your SERIAL column, respectively.
<P>
Similarly, you could retrieve the just-assigned SERIAL value with the <I>currval</I>() function <I>after</I> it was inserted by default, e.g.,
<PRE>
INSERT INTO person (name) VALUES ('Blaise Pascal');
$newID = currval('person_id_seq');
</PRE>
Finally, you could use the <A HREF="#4.17">oid</A> returned from the
INSERT statement to lookup the default value, though this is probably
the least portable approach. In perl, using DBI with Edmund Mergl's
DBD::Pg module, the oid value is made available via
$sth-&gt;{pg_oid_status} after $sth-&gt;execute().
<H4><A NAME="4.16.3">4.16.3</A>) Don't currval() and nextval() lead to a race condition with other
concurrent backend processes?</H4><P>
No. That has been handled by the backends.
<H4><A NAME="4.17">4.17</A>) What is an oid? What is a tid?</H4><P>
Oids are PostgreSQL's answer to unique row ids. Every row that is
created in PostgreSQL gets a unique oid. All oids generated during
initdb are less than 16384 (from <I>backend/access/transam.h</I>). All
user-created oids are equal or greater that this. By default, all these
oids are unique not only within a table, or database, but unique within
the entire PostgreSQL installation.<P>
PostgreSQL uses oids in its internal system tables to link rows between
tables. These oids can be used to identify specific user rows and used
in joins. It is recommended you use column type oid to store oid
values. See the <I>sql(l)</I> manual page to see the other internal columns.
You can create an index on the oid field for faster access.<P>
Oids are assigned to all new rows from a central area that is used by
all databases. If you want to change the oid to something else, or if
you want to make a copy of the table, with the original oid's, there is
no reason you can't do it:
<PRE>
CREATE TABLE new_table(old_oid oid, mycol int);
SELECT INTO new SELECT old_oid, mycol FROM old;
COPY new TO '/tmp/pgtable';
DELETE FROM new;
COPY new WITH OIDS FROM '/tmp/pgtable';
<!--
CREATE TABLE new_table (mycol int);
INSERT INTO new_table (oid, mycol) SELECT oid, mycol FROM old_table;
-->
</PRE><P>
Tids are used to identify specific physical rows with block and offset
values. Tids change after rows are modified or reloaded. They are used
by index entries to point to physical rows.<P>
<H4><A NAME="4.18">4.18</A>) What is the meaning of some of the terms
used in PostgreSQL?</H4><P>
Some of the source code and older documentation use terms that have more
common usage. Here are some:
<UL>
<LI> table, relation, class
<LI> row, record, tuple
<LI> column, field, attribute
<LI> retrieve, select
<LI> replace, update
<LI> append, insert
<LI> oid, serial value
<LI> portal, cursor
<LI> range variable, table name, table alias
</UL><P>
<H4><A NAME="4.19">4.19</A>) Why do I get the error "FATAL: palloc
failure: memory exhausted?"<BR></H4><P>
It is possible you have run out of virtual memory on your system, or
your kernel has a low limit for certain resources. Try this before
starting the postmaster:
<PRE>
ulimit -d 65536
limit datasize 64m
</PRE>
Depending on your shell, only one of these may succeed, but it will set
your process data segment limit much higher and perhaps allow the query
to complete. This command applies to the current process, and all
subprocesses created after the command is run. If you are having a problem
with the SQL client because the backend is returning too much data, try
it before starting the client.<P>
<H4><A NAME="4.20">4.20</A>) How do I tell what PostgreSQL version I
am running? <BR></H4><P>
From <I>psql,</I> type <CODE>select version();</CODE><P>
<H4><A NAME="4.21">4.21</A>) My large-object operations get <I>invalid
large obj descriptor.</I> Why? <BR></H4><P>
You need to put <CODE>BEGIN WORK</CODE> and <CODE>COMMIT
</CODE> around any use of a large object handle, that is,
surrounding <CODE>lo_open</CODE> ... <CODE>lo_close.</CODE><P>
Current PostgreSQL enforces the rule by closing large object handles at
transaction commit, which will be instantly upon completion of the
<I>lo_open</I> command if you are not inside a transaction. So the
first attempt to do anything with the handle will draw <I>invalid large
obj descriptor.</I> So code that used to work (at least most of the
time) will now generate that error message if you fail to use a
transaction.<P>
If you are using a client interface like ODBC you may need to set
<CODE>auto-commit off.</CODE><P>
<H4><A NAME="4.22">4.22</A>) How do I create a column that will default to the
current time?<BR></H4><P>
Use <i>now()</i>:
<CODE><PRE>
CREATE TABLE test (x int, modtime timestamp default now() );
</PRE></CODE>
<P>
<H4><A NAME="4.23">4.23</A>) Why are my subqueries using <CODE>IN</CODE> so
slow?<BR></H4><P>
Currently, we join subqueries to outer queries by sequential scanning
the result of the subquery for each row of the outer query. A workaround
is to replace <CODE>IN</CODE> with <CODE>EXISTS</CODE>. For example,
change:
<CODE><PRE>
SELECT *
FROM tab
WHERE col1 IN (SELECT col2 FROM TAB2)
</PRE></CODE>
to:
<CODE><PRE>
SELECT *
FROM tab
WHERE EXISTS (SELECT col2 FROM TAB2 WHERE col1 = col2)
</PRE></CODE>
We hope to fix this limitation in a future release.
<H4><A NAME="4.24">4.24</A>) How do I do an <i>outer</i> join?<BR></H4><P>
PostgreSQL does not support outer joins in the current release. They can
be simulated using <small>UNION</small> and <small>NOT IN</small>. For
example, when joining <i>tab1</i> and <i>tab2,</i> the following query
does an <i>outer</i> join of the two tables:
<PRE>
SELECT tab1.col1, tab2.col2
FROM tab1, tab2
WHERE tab1.col1 = tab2.col1
UNION ALL
SELECT tab1.col1, NULL
FROM tab1
WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
ORDER BY tab1.col1
</PRE>
<HR>
<H2><CENTER>Extending PostgreSQL</CENTER></H2><P>
<H4><A NAME="5.1">5.1</A>) I wrote a user-defined function. When
I run it in <I>psql,</I> why does it dump core?</H4><P>
The problem could be a number of things. Try testing your user-defined
function in a stand alone test program first.
<H4><A NAME="5.2">5.2</A>) What does the message:
<I>NOTICE:PortalHeapMemoryFree: 0x402251d0 not in alloc set!</I> mean?</H4><P>
You are <I>pfree'ing</I> something that was not <I>palloc'ed.</I>
Beware of mixing <I>malloc/free</I> and <I>palloc/pfree.</I>
<H4><A NAME="5.3">5.3</A>) How can I contribute some nifty new types and
functions for PostgreSQL?</H4><P>
Send your extensions to the pgsql-hackers mailing list, and they will
eventually end up in the <I>contrib/</I> subdirectory.<P>
<H4><A NAME="5.4">5.4</A>) How do I write a C function to return a
tuple?</H4><P>
This requires wizardry so extreme that the authors have never
tried it, though in principle it can be done.<P>
<H4><A NAME="5.5">5.5</A>) I have changed a source file. Why does the
recompile does not see the change?</H4><P>
The Makefiles do not have the proper dependencies for include files. You
have to do a <I>make clean</I> and then another <I>make</I>.
You
have to do a <I>make clean</I> and then another <I>make.</I><P>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>PostgreSQL Developers FAQ</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#A00000" ALINK="#0000FF">
<H1>
Developer's Frequently Asked Questions (FAQ) for PostgreSQL
</H1>
<P>
Last updated: Fri Jun 9 21:54:54 EDT 2000
<P>
Current maintainer: Bruce Momjian (<a
href="mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</a>)<BR>
<P>
The most recent version of this document can be viewed at
the postgreSQL Web site, <a
href="http://PostgreSQL.org">http://PostgreSQL.org</a>.
<P>
<HR>
<P>
<CENTER><H2>Questions</H2></CENTER>
<a href="#1">1</a>) What tools are available for developers?<BR>
<a href="#2">2</a>) What books are good for developers?<BR>
<a href="#3">3</a>) Why do we use <I>palloc</I>() and <I>pfree</I>() to allocate memory?<BR>
<a href="#4">4</a>) Why do we use <I>Node</I> and <I>List</I> to
make data structures?<BR>
<a href="#5">5</a>) How do I add a feature or fix a bug?<BR>
<a href="#6">6</a>) How do I download/update the current source tree?<BR>
<a href="#7">7</a>) How do I test my changes?<BR>
<a href="#7">7</a>) I just added a field to a structure. What else
should I do?<BR>
<a href="#8">8</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="#9">9</a>) How do I efficiently access information in
tables from the backend code?<BR>
<a href="#10">10</a>) What is elog()?<BR>
<a href="#11">11</a>) What is configure all about?<BR>
<a href="#12">12</a>) How do I add a new port?<BR>
<BR>
<HR>
<H3><a
name="1">1</a>) What tools are available for developers?</H3><P>
Aside from the User documentation mentioned in the regular FAQ, there
are several development tools available. First, all the files in the
<I>/tools</I> directory are designed for developers.
<PRE>
RELEASE_CHANGES changes we have to make for each release
SQL_keywords standard SQL'92 keywords
backend description/flowchart of the backend directories
ccsym find standard defines made by your compiler
entab converts tabs to spaces, used by pgindent
find_static finds functions that could be made static
find_typedef get a list of typedefs in the source code
make_ctags make vi 'tags' file in each directory
make_diff make *.orig and diffs of source
make_etags make emacs 'etags' files
make_keywords.README make comparison of our keywords and SQL'92
make_mkid make mkid ID files
mkldexport create AIX exports file
pgindent indents C source files
pginclude scripts for adding/removing include files
unused_oids in pgsql/src/include/catalog
</PRE>
Let me note some of these. If you point your browser at the
<I>file:/usr/local/src/pgsql/src/tools/backend/index.html</I> directory,
you will see few paragraphs describing the data flow, the backend
components in a flow chart, and a description of the shared memory area.
You can click on any flowchart box to see a description. If you then
click on the directory name, you will be taken to the source directory,
to browse the actual source code behind it. We also have several README
files in some source directories to describe the function of the module.
The browser will display these when you enter the directory also. The
<I>tools/backend</I> directory is also contained on our web page under
the title <I>How PostgreSQL Processes a Query.</I><P>
Second, you really should have an editor that can handle tags, so you
can tag a function call to see the function definition, and then tag
inside that function to see an even lower-level function, and then back
out twice to return to the original function. Most editors support this
via <I>tags</I> or <I>etags</I> files.<P>
Third, you need to get <I>id-utils</I> from:
<pre>
<a href="ftp://alpha.gnu.org/gnu/id-utils-3.2d.tar.gz">ftp://alpha.gnu.org/gnu/id-utils-3.2d.tar.gz</a>
<a href="ftp://tug.org/gnu/id-utils-3.2d.tar.gz">ftp://tug.org/gnu/id-utils-3.2d.tar.gz</a>
<a href="ftp://ftp.enst.fr/pub/gnu/gnits/id-utils-3.2d.tar.gz">ftp://ftp.enst.fr/pub/gnu/gnits/id-utils-3.2d.tar.gz</a>
</pre>
By running <I>tools/make_mkid</I>, an archive of source symbols can be
created that can be rapidly queried like <I>grep</I> or edited. Others
prefer <I>glimpse.</I><P>
<I>make_diff</I> has tools to create patch diff files that can be
applied to the distribution.<P>
Our standard format is to indent each code level with one tab, where
each tab is four spaces. You will need to set your editor to display
tabs as four spaces:
<BR>
<PRE>
vi in ~/.exrc:
set tabstop=4
set sw=4
more:
more -x4
less:
less -x4
emacs:
M-x set-variable tab-width
or
; Cmd to set tab stops &etc for working with PostgreSQL code
(c-add-style "pgsql"
'("bsd"
(indent-tabs-mode . t)
(c-basic-offset . 4)
(tab-width . 4)
(c-offsets-alist .
((case-label . +))))
t) ; t = set this mode on
and add this to your autoload list (modify file path in macro):
(setq auto-mode-alist
(cons '("\\`/usr/local/src/pgsql/.*\\.[chyl]\\'" . pgsql-c-mode)
auto-mode-alist))
or
/*
* Local variables:
* tab-width: 4
* c-indent-level: 4
* c-basic-offset: 4
* End:
*/
</PRE>
<BR>
<I>pgindent</I> will the format code by specifying
flags to your operating system's utility <I>indent.</I><P>
<I>pgindent</I> is run on all source files just before each beta test
period. It auto-formats all source files to make them consistent.
Comment blocks that need specific line breaks should be formatted as
<I>block comments,</I> where the comment starts as
<CODE>/*------</CODE>. These comments will not be reformatted in any
way.
<I>pginclude</I> contains scripts used to add needed #include's to
include files, and removed unneeded #include's.
When adding system types, you will need to assign oids to them.
There is also a script called <I>unused_oids</I> in
<I>pgsql/src/include/catalog</I> that shows the unused oids.
<H3><a name="2">2</a>) What books are good for developers?</H3><P>
I have four good books, <I>An Introduction to Database Systems,</I> by
C.J. Date, Addison, Wesley, <I>A Guide to the SQL Standard,</I> by C.J.
Date, et. al, Addison, Wesley, <I>Fundamentals of Database Systems,</I>
by Elmasri and Navathe, and <I>Transaction Processing,</I> by Jim Gray,
Morgan, Kaufmann<P>
There is also a database performance site, with a handbook on-line
written by Jim Gray at <A
HREF="http://www.benchmarkresources.com">http://www.benchmarkresources.com.</A>
<H3><a name="3">3</a>) 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() and
free() because we automatically free all memory allocated when a
transaction completes. This makes it easier to make sure we free memory
that gets allocated in one place, but only freed much later. There are
several contexts that memory can be allocated in, and this controls when
the allocated memory is automatically freed by the backend.<P>
<H3><a name="4">4</a>) 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 inside the
backend in a flexible way. Every node has a <I>NodeTag</I> which
specifies what type of data is inside the Node. <I>Lists</I> are groups
of <I>Nodes chained together as a forward-linked list.</I><P>
Here are some of the <I>List</I> manipulation commands:
<BLOCKQUOTE>
<DL>
<DT>lfirst(i)
<DD>return the data at list element <I>i.</I>
<DT>lnext(i)
<DD>return the next list element after <I>i.</I>
<DT>foreach(i, list)
<DD>loop through <I>list,</I> assigning each list element to <I>i.</I>
It is important to note that <I>i</I> is a List *, not the data in the
<I>List</I> element. You need to use <I>lfirst(i)</I> to get at the data.
Here is a typical code snipped that loops through a List containing
<I>Var *'s</I> and processes each one:
<PRE>
<CODE>
List *i, *list;
foreach(i, list)
{
Var *var = lfirst(i);
/* process var here */
}
</CODE>
</PRE>
<DT>lcons(node, list)
<DD>add <I>node</I> to the front of <I>list,</I> or create a new list with
<I>node</I> if <I>list</I> is <I>NIL.</I>
<DT>lappend(list, node)
<DD>add <I>node</I> to the end of <I>list.</I> This is more expensive
that lcons.
<DT>nconc(list1, list2)
<DD>Concat <I>list2</I> on to the end of <I>list1.</I>
<DT>length(list)
<DD>return the length of the <I>list.</I>
<DT>nth(i, list)
<DD>return the <I>i</I>'th element in <I>list.</I>
<DT>lconsi, ...
<DD>There are integer versions of these: <I>lconsi, lappendi, nthi.</I>
<I>List's</I> containing integers instead of Node pointers are used to
hold list of relation object id's and other integer quantities.
</DL>
</BLOCKQUOTE>
You can print nodes easily inside <I>gdb.</I> First, to disable
output truncation when you use the gdb <I>print</I> command:
<PRE>
<CODE>
(gdb) set print elements 0
</CODE>
</PRE>
Instead of printing values in gdb format, you can use the next two
commands to print out List, Node, and structure contents in a verbose
format that is easier to understand. List's are unrolled into nodes,
and nodes are printed in detail. The first prints in a short format,
and the second in a long format:
<PRE>
<CODE>
(gdb) call print(any_pointer)
(gdb) call pprint(any_pointer)
</CODE>
</PRE>
The output appears in the postmaster log file, or on your screen if you
are running a backend directly without a postmaster.
<P>
<H3><a name="5">5</a>) How do I add a feature or fix a bug?</H3><P>
The source code is over 250,000 lines. Many problems/features are
isolated to one specific area of the code. Others require knowledge of
much of the source. If you are confused about where to start, ask the
hackers list, and they will be glad to assess the complexity and give
pointers on where to start.<P>
Another thing to keep in mind is that many fixes and features can be
added with surprisingly little code. I often start by adding code, then
looking at other areas in the code where similar things are done, and by
the time I am finished, the patch is quite small and compact.<P>
When adding code, keep in mind that it should use the existing
facilities in the source, for performance reasons and for simplicity.
Often a review of existing code doing similar things is helpful.<P>
<H3><a name="6">6</a>) How do I download/update the current source
tree?</H3><P>
There are several ways to obtain the source tree. Occasional developers
can just get the most recent source tree snapshot from
ftp.postgresql.org. For regular developers, you can use CVS. CVS
allows you to download the source tree, then occasionally update your
copy of the source tree with any new changes. Using CVS, you don't have
to download the entire source each time, only the changed files.
Anonymous CVS does not allows developers to update the remote source
tree, though privileged developers can do this. There is a CVS FAQ on
our web site that describes how to use remote CVS. You can also use
CVSup, which has similarly functionality, and is available from
ftp.postgresql.org.<P>
To update the source tree, there are two ways. You can generate a patch
against your current source tree, perhaps using the make_diff tools
mentioned above, and send them to the patches list. They will be
reviewed, and applied in a timely manner. If the patch is major, and we
are in beta testing, the developers may wait for the final release
before applying your patches.<P>
For hard-core developers, Marc(scrappy@postgresql.org) will give you a
Unix shell account on postgresql.org, so you can use CVS to update the
main source tree, or you can ftp your files into your account, patch,
and cvs install the changes directly into the source tree. <P>
<H3><a name="6">6</a>) How do I test my changes?</H3><P>
First, use <I>psql</I> to make sure it is working as you expect. Then
run <I>src/test/regress</I> and get the output of
<I>src/test/regress/checkresults</I> with and without your changes, to
see that your patch does not change the regression test in unexpected
ways. This practice has saved me many times. The regression tests test
the code in ways I would never do, and has caught many bugs in my
patches. By finding the problems now, you save yourself a lot of
debugging later when things are broken, and you can't figure out when it
happened.<P>
<H3><a name="7">7</a>) I just added a field to a structure. What else
should I do?</H3><P>
The structures passing around from the parser, rewrite, optimizer, and
executor require quite a bit of support. Most structures have support
routines in <I>src/backend/nodes</I> used to create, copy, read, and output
those structures. Make sure you add support for your new field to these
files. Find any other places the structure may need code for your new
field. <I>mkid</I> is helpful with this (see above).<P>
<H3><a name="8">8</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></H3><P>
Table, column, type, function, and view names are stored in system
tables in columns of type <I>Name.</I> Name is a fixed-length,
null-terminated type of <I>NAMEDATALEN</I> bytes. (The default value
for NAMEDATALEN is 32 bytes.)
<PRE><CODE>
typedef struct nameData
{
char data[NAMEDATALEN];
} NameData;
typedef NameData *Name;
</CODE></PRE>
Table, column, type, function, and view names that come into the
backend via user queries are stored as variable-length, null-terminated
character strings.<P>
Many functions are called with both types of names, ie. <I>heap_open().</I>
Because the Name type is null-terminated, it is safe to pass it to a
function expecting a char *. Because there are many cases where on-disk
names(Name) are compared to user-supplied names(char *), there are many
cases where Name and char * are used interchangeably.<P>
<H3><a name="9">9</a>) 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. There
are two ways. First, <I>SearchSysCacheTuple()</I> and related functions
allow you to query the system catalogs. This is the preferred way to
access system tables, because the first call to the cache loads the
needed rows, and future requests can return the results without
accessing the base table. The caches use system table indexes
to look up tuples. A list of available caches is located in
<I>src/backend/utils/cache/syscache.c.</I>
<I>src/backend/utils/cache/lsyscache.c</I> contains many column-specific
cache lookup functions.<P>
The rows returned are cached-owned versions of the heap rows. They are
invalidated when the base table changes. Because the cache is local to
each backend, you may use the pointer returned from the cache for short
periods without making a copy of the tuple. If you send the pointer
into a large function that will be doing its own cache lookups, it is
possible the cache entry may be flushed, so you should use
<I>SearchSysCacheTupleCopy()</I> in these cases, and <I>pfree()</I> the
tuple when you are done.<P>
If you can't use the system cache, you will need to retrieve the data
directly from the heap table, using the buffer cache that is shared by
all backends. The backend automatically takes care of loading the rows
into the buffer cache.<P>
Open the table with <I>heap_open().</I> You can then start a table scan
with <I>heap_beginscan(),</I> then use <I>heap_getnext()</I> and
continue as long as <I>HeapTupleIsValid()</I> returns true. Then do a
<I>heap_endscan().</I> <I>Keys</I> can be assigned to the <I>scan.</I>
No indexes are used, so all rows are going to be compared to the keys,
and only the valid rows returned.<P>
You can also use <I>heap_fetch()</I> to fetch rows by block
number/offset. While scans automatically lock/unlock rows from the
buffer cache, with <I>heap_fetch(),</I> you must pass a <I>Buffer</I>
pointer, and <I>ReleaseBuffer()</I> it when completed.
Once you have the row, you can get data that is common to all tuples,
like <I>t_self</I> and <I>t_oid,</I> by merely accessing the
<I>HeapTuple</I> structure entries.
If you need a table-specific column, you should take the HeapTuple
pointer, and use the <I>GETSTRUCT()</I> macro to access the
table-specific start of the tuple. You then cast the pointer as a
<I>Form_pg_proc</I> pointer if you are accessing the pg_proc table, or
<I>Form_pg_type</I> if you are accessing pg_type. You can then access
the columns by using a structure pointer:
<PRE>
<CODE>
((Form_pg_class) GETSTRUCT(tuple))-&gt;relnatts
</CODE>
</PRE>
You should not directly change <I>live</I> tuples in this way. The best
way is to use <I>heap_tuplemodify()</I> and pass it your palloc'ed
tuple, and the values you want changed. It returns another palloc'ed
tuple, which you pass to <I>heap_replace().</I>
You can delete tuples by passing the tuple's <I>t_self</I> to
<I>heap_destroy().</I> You can use it for <I>heap_update()</I> too.
Remember, tuples can be either system cache versions, which may go away
soon after you get them, buffer cache versions, which go away when
you <I>heap_getnext(),</I> <I>heap_endscan,</I> or
<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><a name="10">10</a>) What is elog()?</H3><P>
<I>elog()</I> is used to send messages to the front-end, and optionally
terminate the current query being processed. The first parameter is an
elog level of <I>NOTICE,</I> <I>DEBUG,</I> <I>ERROR,</I> or
<I>FATAL.</I>
<I>NOTICE</I> prints on the user's terminal and the postmaster logs.
<I>DEBUG</I> prints only in the postmaster logs. <I>ERROR</I> prints in
both places, and terminates the current query, never returning from the call.
<I>FATAL</I> terminates the backend process.
The remaining parameters of <I>elog</I> are a <I>printf</I>-style set of
parameters to print.
<H3><a name="11">11</a>) 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 various
capabilities of the OS, and to set variables that can then be tested in
C programs and Makefiles. Autoconf is installed on the PostgreSQL main
server. To add options to configure, edit <I>configure.in,</I> and then
run <I>autoconf</I> to generate <I>configure.</I><P>
When <I>configure</I> is run by the user, it tests various OS
capabilities, stores those in <I>config.status</I> and
<I>config.cache,</I> and modifies a list of <I>*.in</I> files. For
example, if there exists a <I>Makefile.in,</I> configure generates a
<I>Makefile</I> that contains substitutions for all @var@ parameters
found by configure.<P>
When you need to edit files, make sure you don't waste time modifying
files generated by <I>configure.</I> Edit the <I>*.in</I> file, and
re-run <I>configure</I> to recreate the needed file. If you run <I>make
distclean</I> from the top-level source directory, all files derived by
configure are removed, so you see only the file contained in the source
distribution.<P>
<H3><a name="12">12</a>) 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
appropriate entry for your OS. Also, use <I>src/config.guess</I> to add
your OS to <I>src/template/.similar.</I> You shouldn't match the OS
version exactly. The <I>configure</I> test will look for an exact OS
version number, and if not found, find a match without version number.
Edit <I>src/configure.in</I> to add your new OS. (See configure item
above.) You will need to run autoconf, or patch <I>src/configure</I>
too.<P>
Then, check <I>src/include/port</I> and add your new OS file, with
appropriate values. Hopefully, there is already locking code in
<I>src/include/storage/s_lock.h</I> for your CPU. There is also a
<I>src/makefiles</I> directory for port-specific Makefile handling.
There is a <I>backend/port</I> directory if you need special files for
your OS.<P>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>PostgreSQL FAQ</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#A00000" ALINK="#0000FF">
<H1>
H&auml;ufig gestellte Fragen (FAQ) zu PostgreSQL
</H1>
<P>
Last updated: Sat Jul 10 00:37:57 EDT 1999
<P>
Current maintainer: Bruce Momjian (<a
href="mailto:maillist@candle.pha.pa.us">maillist@candle.pha.pa.us</a>) <BR>
<P>
Deutsche &Uuml;bersetzung von Karsten Schulz (<A HREF="mailto:schulz@linux-systemhaus.de">schulz@linux-systemhaus.de</a>) <BR>
<P>
Letzte Aktualisierung der deutschen &Uuml;bersetzung: Don, den 05.08.1999, 09:00 CET
<P>
Die aktuellste Version dieses Dokuments kann auf der PostgreSQL Website <A HREF="http://www.Postgresql.org">http://www.PostgreSQL.org</A> angesehen werden.
<P>
Linux-spezifische Fragen werden in <a href="http://www.PostgreSQL.org/docs/faq-linux.html">http://www.PostgreSQL.org/docs/faq-linux.html</a>
beantwortet (deutsche &Uuml;bersetzung in Arbeit!).<P>
Irix-spezifische Fragen werden in <a
href="http://www.PostgreSQL.org/docs/faq-irix.html">http://www.PostgreSQL.org/docs/faq-irix.html</a> beantwortet.
<P>
HPUX-spezifische Fragen werden in <a
href="http://www.PostgreSQL.org/docs/faq-hpux.shtml">http://www.PostgreSQL.org/docs/faq-hpux.shtml</a> beantwortet.
<P>
<HR><P>
<H2><CENTER>Allgemeine Fragen</CENTER></H2>
<a href="#1.1">1.1</a>) Was ist PostgreSQL?<BR>
<a href="#1.2">1.2</a>) Welches Copyright liegt auf PostgreSQL?<BR>
<a href="#1.3">1.3</a>) Auf welchen Unix-Plattformen l&auml;uft PostgreSQL?<BR>
<a href="#1.4">1.4</a>) Welche Nicht-Unix-Versionen sind verf&uuml;gbar?<BR>
<a href="#1.5">1.5</a>) Woher bekomme ich PostgreSQL?<BR>
<a href="#1.6">1.6</a>) Wo bekomme ich Support f&uuml;r PostgreSQL?<BR>
<a href="#1.7">1.7</a>) Was ist die neueste Version von PostgreSQL?<BR>
<a href="#1.8">1.8</a>) Welche Dokumente sind f&uuml;r PostgreSQL verf&uuml;gbar?<BR>
<a href="#1.9">1.9</a>) Wie erfahre ich etwas &uuml;ber bekannte Fehler oder fehlende Eigenschaften von PostgreSQL?<BR>
<a href="#1.10">1.10</a>) Wie kann ich SQL lernen?<BR>
<a href="#1.11">1.11</a>) Ist PostgreSQL Y2K (Jahr 2000) f&auml;hig?<BR>
<a href="#1.12">1.12</a>) Wie kann ich am Entwicklerteam teilnehmen?<BR>
<a href="#1.13">1.13</a>) Wie sende ich einen Fehler-Bericht?<BR>
<a href="#1.14">1.14</a>) Wie l&auml;uft PostgreSQL im Vergleich zu anderen Datenbanksystemen?<BR>
<H2><CENTER>Fragen zu Benutzerprogrammen</CENTER></H2>
<a href="#2.1">2.1</a>) Gibt es ODBC-Treiber f&uuml;r PostgreSQL?<BR>
<a href="#2.2">2.2</a>) Welche Werkzeuge gibt es, um PostgreSQL-Datenbanken &uuml;ber Webseiten
verf&uuml;gbar zu machen?<BR>
<a href="#2.3">2.3</a>) Hat PostgreSQL eine grafische Benutzerschnittstelle?
Einen Report-Generator? Eine eingebaute Query-Schnittstelle?<BR>
<a href="#2.4">2.4</a>) Welche Sprachen sind f&uuml;r die Kommunikation mit PostgreSQL verf&uuml;gbar?<BR>
<H2><CENTER>Administrative Fragen</CENTER></H2>
<a href="#3.1">3.1</a>) Warum schl&auml;gt initdb fehl?<BR>
<a href="#3.2">3.2</a>) Wie installiere ich PostgreSQL woanders als in /usr/local/pgsql?<BR>
<a href="#3.3">3.3</a>) Wenn ich den postmaster starte, bekomme ich einen <I>Bad System Call</I> oder eine <I>core dumped</I> Meldung. Warum?<BR>
<a href="#3.4">3.4</a>) Wenn ich versuche, den postmaster zu starten, bekomme ich eine <I>IpcMemoryCreate</I> Fehlermeldungen. Warum?<BR>
<a href="#3.5">3.5</a>) Wenn ich versuche, den postmaster zu starten, bekomme ich eine <I>IpcSemaphoreCreate</I> Fehlermeldungen. Warum?<BR>
<a href="#3.6">3.6</a>) Wie verhindere ich, da&szlig; andere Hosts auf meine PostgreSQL Datenbanken zugreifen?<BR>
<a href="#3.7">3.7</a>) Warum kann ich mich nicht von einer anderen Maschine mit meiner Datenbank verbinden?<BR>
<a href="#3.8">3.8</a>) Warum kann ich nicht als <I>root</I> auf die Datenbank zugreifen?<BR>
<a href="#3.9">3.9</a>) Alle meine Server st&uuml;rzen bei gleichzeitigem Tabellenzugriff ab. Warum?<BR>
<a href="#3.10">3.10</a>) Wie optimiere ich die Datenbankmaschine f&uuml;r bessere Leistung?<BR>
<a href="#3.11">3.11</a>) Welche Debugging/Fehlersuch-Hilfsmittel sind f&uuml;r PostgreSQL verf&uuml;gbar?<BR>
<a href="#3.12">3.12</a>) Ich bekomme die Meldung "Sorry, too many clients", wenn ich eine Verbindung versuche. Warum?<BR>
<a href="#3.13">3.13</a>) Was sind die pg_psort.XXX Dateien in meinem Datenbank-Verzeichnis?<BR>
<a href="#3.14">3.14</a>) Wie richte ich eine Benutzergruppe (pg_group) ein?<BR>
<H2><CENTER>Fragen zum Betrieb</CENTER></H2>
<a href="#4.1">4.1</a>) Das System scheint Kommata, Dezimalpunkte und Datumsformate durcheinanderzubringen.<BR>
<a href="#4.2">4.2</a>) Was ist der genauer Unterschied zwischen Binary Cursors und Normal Cursors?<BR>
<a href="#4.3">4.3</a>) Wie w&auml;hle ich per <I>SELECT</I> nur die ersten paar Zeilen in einem Query aus?<BR>
<a href="#4.4">4.4</a>) Wie bekomme ich eine Liste der Tabellen oder anderen Dingen, die ich in <I>psql</I> sehen kann<BR>
<a href="#4.5">4.5</a>) Wie entferne ich eine Spalte von einer Tabelle?<BR>
<a href="#4.6">4.6</a>) Was ist die Maximalgr&ouml;&szlig;e f&uuml;r eine Zeile, eine Tabelle, eine Datenbank?<BR>
<a href="#4.7">4.7</a>) Wieviel Plattenplatz ben&ouml;tigt eine Datenbank zur Speicherung einer Datendatei mit zeilenweisen Datens&auml;tzen?<BR>
<a href="#4.8">4.8</a>) Wie finde ich heraus, welche Indizes oder Operationen in der Datenbank definiert sind?<BR>
<a href="#4.9">4.9</a>) Meine Queries sind langsam oder nutzen die Indizes nicht. Warum?<BR>
<a href="#4.10">4.10</a>) Auf welche Weise kann ich sehen, wie der Query-Optimierer meine Abfrage auswertet?<BR>
<a href="#4.11">4.11</a>) Was ist ein R-Tree Index?<BR>
<a href="#4.12">4.12</a>) Was ist "Genetic Query Optimization"?<BR>
<a href="#4.13">4.13</a>) Wie verfahre ich bei der Suche mit regul&auml;ren Ausdr&uuml;cken und bei
einer Suche mit Ignorierung der Gro&szlig;- und Kleinschreibweisen?<BR>
<a href="#4.14">4.14</a>) Wie ermittle ich in einem Query, da&szlig; ein Feld NULL ist?<BR>
<a href="#4.15">4.15</a>) Was ist der Unterschied zwischen den verschiedenen CHAR-Typen?<BR>
<a href="#4.16">4.16</a>) Wie erzeuge ich ein serielles Feld mit automatischer Erh&ouml;hung des Inhalts?<BR>
<a href="#4.17">4.17</a>) Was ist ein Oid? Was ist ein Tid?<BR>
<a href="#4.18">4.18</a>) Was ist die Bedeutung der verschiedenen Ausdr&uuml;cke, die in PostgreSQL benutzt werden (z.B. attribute, class,...)?<BR>
<a href="#4.19">4.19</a>) Wieso bekomme ich einen Fehler: "FATAL: palloc failure: memory exhausted?"<BR>
<a href="#4.20">4.20</a>) Wie kann ich feststellen, welche PostgreSQL-Version ich laufen habe?<BR>
<a href="#4.21">4.21</a>) Beim Arbeiten mit "Large-Objects" kommt die Fehlermeldung: <I>invalid large obj descriptor.</I> Warum?<BR>
<H2><CENTER>PostgreSQL erweitern</CENTER></H2>
<a href="#5.1">5.1</a>) Ich habe eine benutzerdefinierte Funktion geschrieben. Wenn ich sie in <I>psql</I> aufrufe, kommt ein <I>core dump</I>. Warum?<BR>
<a href="#5.2">5.2</a>) Was bedeutet die Meldung: <I>NOTICE:PortalHeapMemoryFree: 0x402251d0 not in alloc set!</I>?<BR>
<a href="#5.3">5.3</a>) Wie kann ich ein paar elegante neue Feldtypen und Funktionen zu PostgreSQL beitragen?<BR>
<a href="#5.4">5.4</a>) Wie schreibe ich eine Funktion in C, die ein Tuple zur&uuml;ckliefert?<BR>
<a href="#5.5">5.5</a>) Ich habe eine der Quellendateien ge&auml;ndert. Warum macht sich die &Auml;nderung beim erneuten Compilerlauf nicht bemerkbar?<BR>
<HR>
<H2><CENTER>Allgemeine Fragen</CENTER></H2>
<H4><a
name="1.1">1.1</a>) Was ist PostgreSQL?</H4><P>
PostgreSQL ist eine Verbesserung des POSTGRES-Datenbank-Managementsystems, ein
"Next-Generation" DBMS-Forschungsprototyp. W&auml;hrend PostgreSQL das leistungsf&auml;hige Datenmodell und
die reichhaltigen Datentypen von POSTGRES beibeh&auml;lt, ersetzt es die PostQuel-Abfragesprache durch
eine ausgedehnte Teilmenge von SQL. PostgreSQL ist frei und der komplette Quellcode ist verf&uuml;gbar.
<P>
Die PostgreSQL-Entwicklung wird von einem Team von Internet-Entwickler durchgef&uuml;hrt, die alle an
der PostgreSQL-Entwicklungs-Mailingliste teilnehmen. Der aktuelle Koordinator ist Marc G. Fournier
(<a href="mailto:scrappy@postgreSQL.org">scrappy@postgreSQL.org</a>) (siehe unten, wie
man sich anmelden kann). Dieses Team ist jetzt f&uuml;r alle aktuellen und zuk&uuml;nftigen Entwicklungen von PostgreSQL
verantwortlich.
<P>
Die Autoren von PostgreSQL 1.01 waren Andrew Yu und Jolly Chen. Viele andere haben zur Portierung,
zu den Tests, zur Fehlersuche und zur Verbesserung des Codes beigetragen.
Der urspr&uuml;ngliche Postgres-Code, von dem PostgreSQL abstammt, ist auf die Bem&uuml;hungen von
vielen Studierenden und Diplomanden, sowie Programmierern, die unter
der Weisung des Professors Michael Stonebraker an der Universit&auml;t von Kalifornien, Berkeley
arbeiteteten, zur&uuml;ckzuf&uuml;hren.
<P>
Der urspr&uuml;ngliche Name der Software bei Berkeley war Postgres. Als die SQL-Funktionalit&auml;t 1995
hinzugef&uuml;gt wurde, wurde sein Name zu Postgres95 ge&auml;ndert. Der Name wurde Ende 1996 zu
PostgreSQL ge&auml;ndert.
<P>
<H4><a name="1.2">1.2</a>) Welches Copyright liegt auf PostgreSQL?</H4><P>
PostgreSQL steht unter folgendem COPYRIGHT (Originaltext):<P>
PostgreSQL Data Base Management System<P>
Copyright (c) 1994-6 Regents of the University of California<P>
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written
agreement is hereby granted, provided that the above copyright notice
and this paragraph and the following two paragraphs appear in all
copies.<P>
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.<P>
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER
IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO
OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.<P>
Es gilt die Copyright-Klausel im Original! Informativ folgt hier eine
&Uuml;bersetzung. Die &Uuml;bersetzung besitzt keinerlei rechtlichen Status.
Insbesondere kann sich niemand auf diese &Uuml;bersetzung berufen:
<BR><P>
PostgreSQL Datenbank Management System<P>
Copyright (c) 1994-6 Regents of the University of California<P>
Die Erlaubnis, diese Software und seine Unterlagen f&uuml;r jeden m&ouml;glichen Zweck, ohne Geb&uuml;hr und ohne
eine schriftliche Vereinbarung zu benutzen, zu kopieren, zu &auml;ndern und zu verteilen wird hiermit
bewilligt, vorausgesetzt da&szlig; der oben genannte Urheberrechtsvermerk und dieser Paragraph und die
folgenden zwei Paragraphen in allen Kopien erscheinen. <P>
IN KEINEM FALL IST DIE UNIVERSIT&Auml;T VON KALIFORNIEN GEGEN&Uuml;BER JEDEM M&Ouml;GLICHEN BETEILIGTEN F&Uuml;R DIE DIREKTEN,
INDIREKTEN, SPEZIELLEN, BEIL&Auml;UFIGEN ODER FOLGESCH&Auml;DEN, EINSCHLIE&szlig;LICH DER VERLORENEN PROFITE
VERANTWORTLICH, DIE AUS DEM GEBRAUCH VON DIESER SOFTWARE UND SEINEN UNTERLAGEN
HERAUS ENTSTEHEN, SELBST WENN DIE UNIVERSIT&Auml;T VON KALIFORNIEN VON DER M&Ouml;GLICHKEIT SOLCHEN SCHADENS
BENACHRICHTIGT WORDEN IST. <P>
DIE UNIVERSIT&Auml;T VON KALIFORNIEN LEHNT SPEZIELL ALLE M&Ouml;GLICHE GARANTIEN AB,
EINSCHLIESSLICH, ABER NICHT BEGRENZT AUF, DIE IMPLIZIERTEN GARANTIEN VON
GESCH&Auml;FTSNUTZEN UND EIGNUNG ZU EINEM BESTIMMTEN ZWECK. DIE SOFTWARE, DIE
NACHSTEHEND BEREITGESTELLT WIRD, BASIERT AUF EINER "SO WIE SIE IST"-GRUNDLAGE, UND DIE UNIVERSIT&Auml;T
VON KALIFORNIEN HAT KEINE VERPFLICHTUNGEN, WARTUNG, SUPPORT,
AKTUALISIERUNGSVORG&Auml;NGE, VERBESSERUNGEN ODER &Auml;NDERUNGEN ZUR VERF&Uuml;GUNG
ZU STELLEN.
<H4><a name="1.3">1.3</a>) Auf welchen Unix-Plattformen l&auml;uft PostgreSQL?</H4><P>
Die Autoren haben PostgreSQL auf folgenden Plattformen kompiliert und getestet
(einige dieser Kompilierungen ben&ouml;tigen den C-Compiler gcc):
<UL>
<LI> aix - IBM auf AIX 3.2.5 or 4.x
<LI> alpha - DEC Alpha AXP auf Digital Unix 2.0, 3.2, 4.0
<LI> BSD44_derived - OS abgeleitet von 4.4-lite BSD (NetBSD, FreeBSD)
<LI> bsdi - BSD/OS 2.x, 3.x, 4.x
<LI> dgux - DG/UX 5.4R4.11
<LI> hpux - HP PA-RISC auf HP-UX 9.*, 10.*
<LI> i386_solaris - i386 Solaris
<LI> irix5 - SGI MIPS auf IRIX 5.3
<LI> linux - Intel i86
Alpha
SPARC
PPC
M68k
<LI> sco - SCO 3.2v5
Unixware
<LI> sparc_solaris - SUN SPARC auf Solaris 2.4, 2.5, 2.5.1
<LI> sunos4 - SUN SPARC auf SunOS 4.1.3
<LI> svr4 - Intel x86 auf Intel SVR4 and MIPS
<LI> ultrix4 - DEC MIPS auf Ultrix 4.4
</UL>
<P>
<H4><a name="1.4">1.4</a>) Welche Nicht-Unix-Versionen sind verf&uuml;gbar?</H4><P>
Es ist m&ouml;glich, die libpq C-Bibliothek, psql und andere Schnittstellen und Binaries zu
kompilieren, um sie auf der MS-Windows-Plattform laufen zu lassen.
In diesem Fall l&auml;uft der Client auf MS-Windows und steht &uuml;ber TCP/IP mit einem
Server in Verbindung, der auf einer unserer unterst&uuml;tzten Unixplattformen l&auml;uft.
Es gibt die Datei <I>win31.mak</I> in der Distribution, um die Win32 libpq-Bibliothek und psql
zu erzeugen.<P>
Der Datenbankserver arbeitet jetzt auch unter Benutzung der Cygnus Unix/NT-Porting-Bibliotheken
auf Windows NT. Siehe auch pgsql/doc/README.NT in der Distribution.<P>
Es gibt eine weitere Portierung, die U/Win benutzt bei <A HREF="http://surya.wipro.com/uwin/ported.html">http://surya.wipro.com/uwin/ported.html.</A>
<H4><a name="1.5">1.5</a>) Woher bekomme ich PostgreSQL?</H4><P>
Die erste Anlaufadresse f&uuml;r PostgreSQL ist der ftp-Server <a href="ftp://ftp.postgreSQL.org/pub">ftp://ftp.postgreSQL.org/pub</a>
<P>
Die entsprechenden Spiegelserver sind auf der Hauptwebseite aufgelistet.
<H4><a name="1.6">1.6</a>) Wo bekomme ich Support f&uuml;r PostgreSQL?</H4><P>
Es gibt keinen offiziellen Support f&uuml;r PostgreSQL von der Universit&auml;t von Kalifornien, Berkeley. Der
Support wird durch freiwilligen Einsatz geleistet.
<P>
Die Mailing-Liste ist: <a href="mailto:pgsql-general@postgreSQL.org">pgsql-general@postgreSQL.org</a>.
Die Liste ist f&uuml;r PostgreSQL betreffende Themen vorbehalten. Um sich anzumelden, sende eine
Email mit folgenden Zeilen im Text (nicht in der Betreffzeile):
<PRE>
<CODE>
subscribe
end
</CODE>
</PRE><P>
an <a href="mailto:pgsql-general-request@postgreSQL.org">pgsql-general-request@postgreSQL.org</a>.<P>
Es gibt auch eine Digest-Liste (Eine Liste, die Mails zusammengefasst sendet).
Um sich an dieser Digestliste anzumelden, sende eine Email an:
<a href="mailto:pgsql-general-digest-request@postgreSQL.org">pgsql-general-digest-request@postgreSQL.org</a>
mit folgendem Text:
<PRE>
<CODE>
subscribe
end
</CODE>
</PRE>
Die Digests werden an die Mitglieder der Liste geschickt, wenn ca. 30kB an Mails
zusammengekommen sind.<P>
Die Bug-Mailingliste ist verf&uuml;bar. Um sich an dieser Liste anzumelden,
sende eine Email an <a href="mailto:bugs-request@postgreSQL.org">bugs-request@postgreSQL.org</a>
mit folgendem Text:<P>
<PRE>
<CODE>
subscribe
end
</CODE>
</PRE>
Es gibt ebenfalls eine Entwickler-Diskussionsliste. Um sich an dieser Liste anzumelden,
sende eine Email an <a href="mailto:hackers-request@postgreSQL.org">hackers-request@postgreSQL.org</a>
mit diesem Text:<P>
<PRE>
<CODE>
subscribe
end
</CODE>
</PRE><P>
Weitere Mailinglisten und Informationen zu PostgreSQL k&ouml;nnen auf der PostgreSQL-Homepage im WWW
gefunden werden:
<BLOCKQUOTE>
<a href="http://postgreSQL.org">http://postgreSQL.org</a>
</BLOCKQUOTE><P>
Es gibt au&szlig;erdem einen IRC-Channel im EFNet, Kanal #PostgreSQL.
Bruce nutzt den Unix-Befehl: <CODE>irc -c '#PostgreSQL' "$USER" irc.phoenix.net</CODE> um teilzunehmen<P>
Kommerzieller Support f&uuml;r PostgreSQL ist bei <a href="http://www.pgsql.com">http://www.pgsql.com/</a> verf&uuml;gbar<P>
<H4><a name="1.7">1.7</a>) Was ist die neueste Version von PostgreSQL?</H4><P>
Das neueste Release von PostgreSQL ist die Version 6.5.<P>
Wir planen alle 4 Monate Hauptreleases herauszugeben.<P>
<H4><a name="1.8">1.8</a>) Welche Dokumente sind f&uuml;r PostgreSQL verf&uuml;gbar? </H4><P>
Einige Handb&uuml;cher, Man-Pages und einige kleine Testprogramme sind in der Distribution enthalten.
Siehe im /doc-Verzeichnis.<P>
<I>psql</I>
hat einige nette \d-Befehle, um Informationen &uuml;ber Typen, Operatoren, Funktionen, Aggregate, usw. zu zeigen. <P>
Die Website enth&auml;lt sogar noch mehr Unterlagen.<P>
<H4><a name="1.9">1.9</a>) Wie erfahre ich etwas &uuml;ber bekannte Fehler oder fehlende Eigenschaften von PostgreSQL?
</H4><P>
PostgreSQL unterst&uuml;tzt eine ausgedehnte Untermenge von SQL-92.
Siehe unser <a href="http://www.postgreSQL.org/docs/todo.html">TODO</a>
f&uuml;r eine Auflistung der bekannten Fehler, fehlende Eigenschaften und zuk&uuml;nftige Pl&auml;ne.<P>
<H4><a name="1.10">1.10</a>) Wie kann ich SQL lernen?</H4><P>
Es gibt nette SQL-Tutorials bei <a href="http://w3.one.net/~jhoffman/sqltut.htm">
http://w3.one.net/~jhoffman/sqltut.htm</a> und bei <a href="http://ourworld.compuserve.com/homepages/Graeme_Birchall/DB2_COOK.HTM">
http://ourworld.compuserve.com/homepages/Graeme_Birchall/DB2_COOK.HTM.</a><P>
Viele unserer User m&ouml;gen <I>The Practical SQL Handbook</I>, Bowman et al.,
Addison Wesley.<P>
<H4><a name="1.11">1.11</a>) Ist PostgreSQL Y2K (Jahr 2000) f&auml;hig?</H4><P>
Ja, wir k&ouml;nnen Datumsangaben nach dem Jahr 2000 n.Chr. und vor 2000 v.Chr. leicht
verarbeiten.<P>
<H4><a name="1.12">1.12</a>) Wie kann ich am Entwicklerteam teilnehmen?</H4><P>
Zuerst lade die neuesten Quellen herunter und lies die PostgreSQL-Entwicklerunterlagen
auf unserer Website oder in der Distribution. Zweitens melde Dich zu den Mailinglisten
pgsql-hackers und pgsql-patches an. Drittens sende qualitativ hochwertige Programm&auml;nderungen
an die pgsql-patches Mailingliste.<P>
Es gibt ungef&auml;hr ein Dutzend Leute, die das <I>commit</I>-Recht im PostgreSQL-CVS Archiv haben.
Alle haben so viele hochwertige Patches eingebracht, da&szlig; es schwer f&uuml;r die
CVS-Verwalter war, mitzuhalten. Und wir hatten das Vertrauen, da&szlig;
die &Auml;nderungen, die sie festlegten, sehr wahrscheinlich von hoher Qualit&auml;t sind. <P>
<H4><a name="1.13">1.13</a>) Wie sende ich einen Fehler-Bericht?</H4><P>
F&uuml;lle die "Fehler-Vorlage"-Datei (bug.template im doc-Verzeichnis) aus und sende sie an:
<a href="mailto:bugs@postgreSQL.org">bugs@postgreSQL.org</a><P>
&Uuml;berpr&uuml;fe auch den ftp-Server <a href="ftp://ftp.postgreSQL.org/pub">ftp://ftp.postgreSQL.org/pub</a>,
um nachzusehen, ob es eine neuere PostgreSQL-Version oder neue Patches gibt.
<P>
<H4><a name="1.14">1.14</a>) Wie l&auml;uft PostgreSQL im Vergleich zu anderen Datenbanksystemen?</H4><P>
Es gibt verschiedene Methoden, Software zu messen: Eigenschaften, Leistung,
Zuverl&auml;ssigkeit, Support und Preis.<P>
<DL>
<DT> <B>Eigenschaften</B>
<DD>
PostgreSQL hat die meisten Eigenschaften, die in gro&szlig;en kommerziellen DBMS's, wie
Transaktionen, Sub-SELECTs, Trigger, Views und verfeinertes Locking, vorhanden sind.
Wir haben einige Eigenschaften, die andere nicht haben, wie benutzerbestimmte Typen, Vererbung,
Regeln, und die Multi-Versionen-Steuerung zum Verringern von konkurrierenden Locks.
Wir haben keine referentielle Integrit&auml;t von externen Schl&uuml;sseln oder Outer Joins,
aber wir arbeiten an diesen Dingen f&uuml;r unser n&auml;chstes Release.<P>
<DT> <B>Leistung</B>
<DD>
PostgreSQL l&auml;uft in zwei Modi. Im normalen <I>fsync</I>-Modus wird jede komplette Transaktion
auf die Platte geschrieben und garantiert, da&szlig;, selbst wenn das Betriebssystem abst&uuml;rzt und
der Strom ausf&auml;llt, die Daten sicher gespeichert wurden.
In diesem Modus sind wir langsamer als die meisten kommerziellen Datenbanken,
zum Teil, weil wenige von ihnen solch eine konservatives Methode der Datenspeicherung in ihren
Standardbetriebsmodi betreiben.<P>
Im <I>no-fsync</I>-Modus sind wir normalerweise schneller als kommerzielle Datenbanken. In
diesem Modus kann ein Betriebssystemabsturz jedoch Datenkorruption zur Folge haben.
Wir arbeiten daran, einen Zwischenmodus zur Verf&uuml;gung zu stellen, der unter weniger Leistungseinbu&szlig;e
leidet als der <I>fsync</I>-Modus und die Datenintegrit&auml;t innerhalb 30 Sekunden
im Falle eines Betriebssystemabsturzes erlaubt. Der Modus ist durch den Datenbankverwalter
ausw&auml;hlbar.<P>
Im Vergleich zu MySQL oder schlankeren Datenbanksystemen sind wir hinsichtlich INSERTs/UPDATEs langsamer,
weil wir einen Transaktions-Overhead haben.
Selbstverst&auml;ndlich hat MySQL kaum eine der Eigenschaften, die oben im Kapitel <I>Eigenschaften</I> erw&auml;hnt werden.
PostgreSQL ist f&uuml;r Flexibilit&auml;t und gute Eigenschaften designed, trotzdem fahren wir fort,
die Leistung durch Profiling und Quellcodeanalyse zu verbessern.<P>
<DT> <B>Zuverl&auml;ssigkeit</B>
<DD>
Wir stellen fest, da&szlig; ein DBMS zuverl&auml;ssig sein mu&szlig;, oder es ist wertlos. Wir bem&uuml;hen uns,
gut gepr&uuml;ften, best&auml;ndigen Code freizugeben, der nur ein Minimum an Programmfehler hat.
Jede Freigabe hat mindestens einen Monat Betatestphase hinter sich, und unsere Freigabehistorie zeigt,
da&szlig; wir stabile, solide Versionen freigeben, die im Produktionsbetrieb
genutzt werden k&ouml;nnen. Wir glauben, da&szlig; wir im Vergleich mit anderer
Datenbanksoftware vorteilhaft dastehen.<P>
<DT> <B>Support</B>
<DD>
Unsere Mailingliste stellt eine gro&szlig;e Gruppe Entwickler und Benutzer zur Behebung aller
m&ouml;glichen anzutreffenden Probleme zur Verf&uuml;gung.
Wir k&ouml;nnen nicht immer eine Fehlerbehebung garantieren,
kommerzielle DBMS's tun dies aber auch nicht.
Direkter Zugriff zu den Entwicklern, zur Benutzergemeinschaft, zu den Handb&uuml;chern und zum Quellcode bietet h&auml;ufig
h&ouml;herwertigen PostgreSQL-Support im Vergleich zu anderen DBMS's.
Es gibt den kommerziellen "Pro-Ereignis"-Support,
der f&uuml;r diejenigen bereitgestellt wird, die ihn ben&ouml;tigen. (siehe Support-Faq), <P>
<DT> <B>Preis</B>
<DD>
PostgrSQL ist frei verf&uuml;gbar, sowohl f&uuml;r die kommerzielle, wie f&uuml;r die nicht-kommerzielle
Nutzung. Du kannst Deinen Code fast ohne Beschr&auml;nkungen zu unserem hinzuf&uuml;gen. Die einzigen
Beschr&auml;nkungen werden in der BSD-artigen Lizenz weiter oben aufgef&uuml;hrt.
</DL>
<HR>
<H2><CENTER>Fragen zu Benutzerprogrammen</CENTER></H2>
<H4><a name="2.1">2.1</a>) Gibt es ODBC-Treiber f&uuml;r PostgreSQL?</H4><P>
Es sind zwei ODBC-Treiber verf&uuml;gbar: PostODBC und OpenLink ODBC.<P>
PostODBC ist in der Distribution enthalten. Mehr Informationen k&ouml;nnen unter
<a href="http://www.insightdist.com/psqlodbc">http://www.insightdist.com/psqlodbc</a> abgerufen werden.<P>
OpenLink ODBC kann unter <a href="http://www.openlinksw.com/">http://www.openlinksw.com</a>
geholt werden.
Die Software arbeitet mit OpenLinks Standard-ODBC-Client, so da&szlig; PostgreSQL-ODBC auf
jeder Client-Plattform zur Verf&uuml;gung steht, die unterst&uuml;tzt wird (Win, Mac, Unix, VMS).<P>
Sie werden dieses Produkt wahrscheinlich an Leute verkaufen, die kommerziellen Qualit&auml;ts-Support
brauchen, aber es wird immer eine Freeware-Version verf&uuml;gbar sein.
Fragen dazu bitte an <a href="mailto:postgres95@openlink.co.uk">postgres95@openlink.co.uk</a>.<P>
<H4><a name="2.2">2.2</a>) Welche Werkzeuge gibt es, um PostgreSQL-Datenbanken &uuml;ber Webseiten
verf&uuml;gbar zu machen?</H4><P>
Eine nette Einf&uuml;hrung zu Datenbank-gest&uuml;tzten Webseiten kann unter
<a href="http://www.webtools.com">http://www.webtools.com</a> abgerufen werden.<P>
Eine weitere gibt es bei <a href="http://www.phone.net/home/mwm/hotlist/">
http://www.phone.net/home/mwm/hotlist/.</a><P>
F&uuml;r die Web-Integration ist PHP eine ausgezeichnete Schnittstelle.
PHP gibt es bei <a href="http://www.php.net">http://www.php.net</a><P>
PHP ist hervorragend f&uuml;r einfache Anbindungen geeignet. F&uuml;r komplexere
Aufgaben nutzen viele die Perl-Schnittstelle mit CGI.pm.<P>
Einen WWW-Gateway, basierend auf WDB, kann man bei
<a href="http://www.eol.ists.ca/~dunlop/wdb-p95">http://www.eol.ists.ca/~dunlop/wdb-p95</a> herunterladen.
<H4><a name="2.3">2.3</a>) Hat PostgreSQL eine grafische Benutzerschnittstelle?
Einen Report-Generator? Eine eingebaute Query-Schnittstelle?</H4><P>
Wir haben eine nette grafische Benutzerschnittstelle mit Namen
<I>pgaccess,</I> welche in der Distribution enthalten ist.
<I>pgaccess</I> hat auch einen Reportgenerator. Die Webpage liegt hier:
<A HREF="http://www.flex.ro/pgaccess">http://www.flex.ro/pgaccess</A><P>
In der Distribution gibt es au&szlig;erdem <I>ecpg,</I>,
welches eine eingebundene SQL-Query-Schnittstelle f&uuml;r C zur Verf&uuml;gung stellt.
<H4><a name="2.4">2.4</a>) Welche Sprachen sind f&uuml;r die Kommunikation mit PostgreSQL verf&uuml;gbar?</H4><P>
Wir haben:
<UL>
<LI>C(libpq)
<LI>C++(libpq++)
<LI>Embedded C(ecpg)
<LI>Java(jdbc)
<LI>Perl(perl5)
<LI>ODBC(odbc)
<LI>Python(PyGreSQL)
<LI>TCL(libpgtcl)
<LI>ein rohes C/4GL(contrib/pginterface)
<LI>Embedded HTML(<a href="http://www.php.net">PHP from http://www.php.net</a>)
</UL><P>
<HR>
<H2><CENTER>Administrative Fragen</CENTER></H2><P>
<H4><a name="3.1">3.1</a>) Warum schl&auml;gt initdb fehl?</H4><P>
<UL>
<LI>
&uuml;berpr&uuml;fe, da&szlig; keine Binaries vorheriger Versionen in Deinem Pfad
(PATH-Variable) sind.
(Wenn Du die Meldung siehst: <CODE>WARN:heap_modifytuple: repl is \ 9</CODE>, ist das das Problem.)
<Li> &uuml;berpr&uuml;fe, da&szlig; der Pfad richtig gesetzt ist
<LI> &uuml;berpr&uuml;fe, ob der User <I>postgres</I> der Eigent&uuml;mer der entsprechenden Dateien ist
</UL><P>
<H4><a name="3.2">3.2</a>) Wie installiere ich PostgreSQL woanders als in /usr/local/pgsql?</H4><P>
Der einfachste Weg ist mittels der --prefix Option beim configure den Pfad anzugeben.
Falls Du das vergessen haben solltest, kannst Du die Datei Makefile.global &auml;ndern und
POSTGRESDIR entsprechend anpassen, oder Du erzeugst ein Makefile.custom und definierst POSTGRESDIR dort.
<P>
<H4><a name="3.3">3.3</a>) Wenn ich den postmaster starte, bekomme ich einen <I>Bad System Call</I> oder eine <I>core dumped</I> Meldung. Warum?</H4><P>
Das kann verschiedene Ursachen haben. &Uuml;berpr&uuml;fe zuerst, ob Dein Kernel System V Extensions
enth&auml;lt. PostgreSQL ben&ouml;tigt die Kernel-Unterst&uuml;tzung f&uuml;r Shared Memory und Semaphoren.
<P>
<H4><a name="3.4">3.4</a>) Wenn ich versuche, den postmaster zu starten, bekomme ich <I>IpcMemoryCreate</I> Fehlermeldungen. Warum?</H4><P>
Du hast entweder den Kernel nicht f&uuml;r Shared Memory konfiguriert, oder Du mu&szlig;t den
Shared Memory Bereich vergr&ouml;&szlig;ern.
Die genaue Gr&ouml;&szlig;e h&auml;ngt von Deiner Systemarchitektur ab und mit wievielen
Puffern und Serverprozessen Du postmaster konfiguriert hast.
F&uuml;r die meisten Systeme, mit Standardangaben f&uuml;r Puffer und Prozessen ben&ouml;tigst
Du ein Minimum von ca. 1 MB.
<H4><a name="3.5">3.5</a>) Wenn ich versuche, den postmaster zu starten, bekomme ich <I>IpcSemaphoreCreate</I> Fehlermeldungen. Warum?</H4><P>
Falls die Fehlermeldung <I>IpcSemaphoreCreate: semget failed (No space
left on device)</I> lautet, dann ist Dein Kernel mit zu wenig Semaphoren konfiguriert.
Postgres ben&ouml;tigt eine Semaphore pro m&ouml;glichen Backend-Prozess.
Eine Zwischenl&ouml;sung w&auml;re, postmaster mit einer geringeren Anzahl an Backend-Prozessen zu starten.
Benutze dazu die <I>-N</I> Option mit einem Wert kleiner als die standardm&auml;&szlig;igen 32.
Eine dauerhafte L&ouml;sung w&auml;re es, die Kernel-Parameter
<I>SEMMNS</I> und <I>SEMMNI</I> zu erh&ouml;hen.<P>
Falls die Fehlermeldung anders aussieht, hast Du m&ouml;glicherweise keine Semaphoren-Unterst&uuml;tzung
in Deinem Kernel aktiviert.<P>
<H4><a name="3.6">3.6</a>) Wie verhindere ich, da&szlig; andere Hosts auf meine PostgreSQL Datenbanken zugreifen?</H4><P>
Die Standardeinstellung ist, da&szlig; PostgreSQL Verbindungen von der lokalen Maschine &uuml;ber
Unix-Domain-Sockets erlaubt. Andere Maschinen werden keine Verbindung aufbauen k&ouml;nnen, bis
der <I>postmaster</I> mit der <I>-i</I> Option gestartet ist und die Host-basierte Authentizierung
in der Datei <I>$PGDATA/pg_hba.conf</I> entsprechend angepasst ist.
Das erlaubt TCP/IP-Verbindungen.
<P>
<H4><a name="3.7">3.7</a>) Warum kann ich mich nicht von einer anderen Maschine mit meiner Datenbank verbinden?</H4><P>
Die Standardeinstellung erlaubt nur Unix-Domain-Socket-Verbindungen der lokalen Maschine.
Um TCP/IP Verbindungen zu erm&ouml;glichen, stelle sicher, da&szlig; der postmaster
mit der <I>-i</I> Option gestartet wurde, und f&uuml;ge einen passenden Host-Eintrag in die Datei
<I>pgsql/data/pg_hba.conf</I> ein. Siehe auch die <I>pg_hba.conf</I> Man-Page.<P>
<H4><a name="3.8">3.8</a>) Warum kann ich nicht als <I>root</I> auf die Datenbank zugreifen?</H4><P>
Du solltest keine Datenbank-Benutzer mit der User-ID 0 (root) erzeugen.
Sie werden auf keine Datenbank zugreifen k&ouml;nnen. Das ist eine Sicherheitsma&szlig;nahme,
wegen der M&ouml;glichkeit Objekt-Module dynamisch in die Datenbank zu linken.
<P>
<H4><a name="3.9">3.9</a>) Alle meine Server st&uuml;rzen bei gleichzeitigem Tabellenzugriff ab. Warum?</H4><P>
Dieses Problem kann durch einen Kernel verursacht werden, der ohne Support f&uuml;r Semaphoren
konfiguriert wurde.
<H4><a name="3.10">3.10</a>) Wie optimiere ich die Datenbankmaschine f&uuml;r bessere Leistung?</H4><P>
Sicherlich k&ouml;nnen Indizes Abfragen beschleunigen. Der <I>explain</I> Befehl
erlaubt Dir zu sehen, wie PostgreSQL Deine Abfrage interpretiert und welche Indizes
benutzt werden.
<P>
Wenn Du eine Menge <I>INSERTs</I> machst, &uuml;berpr&uuml;fe, ob Du sie als Stapelverarbeitung
mit dem <I>copy</I>-Befehl abarbeiten kannst.
Das ist viel schneller als einzelne <I>INSERTs</I>.
Zweitens, SQL-Statements, die nicht in einem <I>begin work/commit</I> Transaktions-Block eingegeben werden,
werden als eigene Transaktion behandelt. &Uuml;berpr&uuml;fe, ob die Statements nicht
in einen einzelnen Transaktions-Block zusammengefasst werden k&ouml;nnen. Das reduziert den Transaktions-Overhead.
Du kannst auch erw&auml;gen, Indizes zu l&ouml;schen und neu zu erstellen, wenn Du gro&szlig;e
Datenmengen &auml;nderst.<P>
Es gibt verschiedene Tuning-Ma&szlig;nahmen, die man ergreifen kann.
Du kannst fsync() abschalten, indem Du beim Starten des postmasters die Optionen <I>-o -F</I> angibst.
Das hindert fsync()´s daran, nach jeder Transaktion die Daten auf die Platte zu schreiben.
Du kannst auch mit der -B Option des postmasters die Anzahl der Shared Memory Puffer f&uuml;r den Backend-Prozess erh&ouml;hen.
Falls Du diesen Wert zu hoch einstellst, kann es sein, da&szlig; der postmaster nicht startet, weil
der Shared Memory Speicherplatz Deines Kernels aufgebraucht wird.
Jeder Puffer ist 8 kB gro&szlig; und es gibt standardm&auml;&szlig;ig 64 Puffer.<P>
Du kannst ebenfalls die -S Option des Backends nutzen, um die Gr&ouml;&szlig;e des Speicherplatzes f&uuml;r
tempor&auml;res Sortieren zu erh&ouml;hen.
Der -S Wert wird in Kilobyte gemessen und ist standardm&auml;&szlig;ig auf 512 kB festgelegt. Es w&auml;re
jedoch unklug, den Wert zu hoch anzugeben, da ein Query m&ouml;glicherweise Speicherplatzmangel verursacht,
wenn es viele gleichzeitige Sortierungen durchf&uuml;hren mu&szlig;.<P>
Der <I>cluster</I> Befehl kann benutzt werden, um Daten in Basistabellen zu gruppieren, so da&szlig; sie
auf einen Index zusammengebracht werden. Siehe auch die cluster(l) Man-Page f&uuml;r weitere Details.
<H4><a name="3.11">3.11</a>) Welche Debugging/Fehlersuch-Hilfsmittel sind f&uuml;r PostgreSQL verf&uuml;gbar?</H4><P>
PostgreSQL hat einige M&ouml;glichkeiten, Statusinformationen zu berichten, die
n&uuml;tzlich f&uuml;r die Fehlersuche sein k&ouml;nnen.<P>
Erstens, wenn beim configure-Lauf die Option --enable-cassert angegeben wurde,
verfolgen viele <I>assert()´s</I> den Fortschritt des Backends und halten das Programm
an, wenn etwas Unerwartetes passiert.
<P>
Postmaster und postgres, haben mehrere Fehlersuch-Optionen zur Verf&uuml;gung.
Stelle zuerst sicher, da&szlig; Du den Standard-Output und Fehlerkanal in eine Datei umleitest, wenn Du den postmaster startest, :
<PRE>
<CODE>
cd /usr/local/pgsql
./bin/postmaster &gt;server.log 2&gt;&1 &
</CODE>
</PRE><P>
Das erzeugt eine server.log Datei im PostgreSQL-Verzeichnis.
Diese Datei enth&auml;lt n&uuml;tzliche Informationen &uuml;ber Probleme oder Fehler, die im Server
aufgetreten sind. Postmaster hat eine -d Option, die noch detailliertere Informationen liefert.
Zur -d Option wird eine Nummer angegeben, die den Debug-Level - also die Menge der berichteten Information - angibt.
Achtung, hohe Debug-Level erzeugen schnell gro&szlig;e Logdateien!
<P>
Du kannst tats&auml;chlich das Postgres-Backend auf der Kommandozeile
laufen lassen und SQL-Statements direkt eingeben.
Diese Vorgehensweise wird aber <B>nur</B> zur Fehlersuche empfohlen.
Beachte, da&szlig; ein Zeilenumbruch das SQL-Statement beendet, nicht das Semikolon.
Wenn Du PostgreSQL mit Debugging-Symbolen kompiliert hast, kannst Du einen Debugger
benutzen, um zu beobachten, was passiert.
Da das Backend nicht vom postmaster gestartet wurde, l&auml;uft es nicht in der
gleichen Umgebung und deshalb k&ouml;nnen einige locking/backend Operationen
nicht reproduziert werden.
Einige Betriebssysteme k&ouml;nnen sich an einen Backend-Prozess direkt
anh&auml;ngen, um Probleme zu diagnostizieren.
<P>
Das Programm postgres hat -s, -A und -t Optionen, die bei der Fehlersuche
und Leistungsmessung sehr n&uuml;tzlich sein k&ouml;nnen.
Du kannst das Paket auch mit Profiling kompilieren, um zu sehen, welche Funktionen wieviel
Ausf&uuml;hrungszeit beanspruchen.
Das Backend Profil wird im Verzeichnis pgsql/data/base/dbname abgelegt.
Das Client Profil wird in das aktuelle Verzeichnis abgelegt.
<P>
<H4><a name="3.12">3.12</a>) Ich bekomme die Meldung "Sorry, too many clients", wenn ich eine Verbindung versuche. Warum?</H4><P>
Du mu&szlig;t die Grenze des postmasters, die festlegt,
wieviele gleichzeitige Backend-Prozesse gestartet werden k&ouml;nnen, hochsetzen.<P>
In Postgres 6.5 sind das normalerweise 32 Prozesse. Du kannst diesen Wert dadurch erh&ouml;hen,
da&szlig; Du den postmaster mit einem entsprechenden <I>-N</I> Wert neu startest.
In der Standardkonfiguration kannst Du <I>-N</I> auf maximal 1024 setzen.
Falls Du mehr brauchst, erh&ouml;he <I>MAXBACKENDS</I> in <I>include/config.h</I> und
kompiliere das Paket neu.
Du kannst den Standardwert von <I>-N</I> w&auml;hrend der Konfiguration
setzen, indem Du <I>--with-maxbackends</I> angibst.
Anmerkung: Falls Du <I>-N</I> gr&ouml;&szlig;er als 32 einstellst, solltest
Du <I>-B</I> auf einen Wert, h&ouml;her als 64 setzen.
F&uuml;r eine hohe Anzahl an Backend-Prozessen, solltest Du m&ouml;glicherweise einige
Unix-Kernel Parameter ebenfalls erh&ouml;hen.
Folgendes Parameter solltest Du pr&uuml;fen:
die Maximalgr&ouml;&szlig;e der Shared Memory Blocks <I>SHMMAX,</I>
die Maximalanzahl der Semaphoren <I>SEMMNS</I> und <I>SEMMNI,
</I> die maximale Anzahl von Prozessen <I>NPROC,</I>
die maximale Anzahl von Prozessen pro User <I>MAXUPRC,</I>
und die Maximalzahl der ge&ouml;ffneten Dateien <I>NFILE</I> und <I>NINODE.</I>
Der Grund f&uuml;r die Begrenzung der erlaubten Backend-Prozesse liegt darin, da&szlig;
verhindert werden soll, da&szlig; das System seine freien Ressourcen aufbraucht.
<P>
In den Postgres-Versionen vor 6.5 war die maximale Anzahl von Backends auf
64 festgelegt und eine &Auml;nderung setzte eine erneute Kompilierung voraus,
bei der die Konstante MaxBackendId in <I>include/storage/sinvaladt.h.</I>
entsprechend angepasst wurde.<P>
<H4><a name="3.13">3.13</a>) Was sind die pg_psort.XXX Dateien in meinem Datenbank-Verzeichnis?</H4><P>
Dies sind tempor&auml;re Dateien, die durch den Query-Ausf&uuml;hrer erzeugt werden.
Wenn zum Beispiel eine Sortierung durchgef&uuml;hrt werden mu&szlig;, um ein <I>ORDER BY</I>
auszuf&uuml;hren, und diese Sortierung mehr Platz ben&ouml;tigt, als mit dem Backend-Parameter -S
erlaubt wurde, dann werden diese tempor&auml;ren Dateien erzeugt, um die Daten dort zu halten.
<P>
Die tempor&auml;ren Dateien sollten automatisch gel&ouml;scht werden, falls das Backend jedoch
w&auml;hrend einer Sortierung abst&uuml;rzt, bleiben sie erhalten.
Wenn zu diesem Zeitpunkt keine Transaktion l&auml;uft, kannst Du die
pg_tempNNN.NN Dateien ohne Gefahr l&ouml;schen.<P>
<H4><a name="3.14">3.14</a>) Wie richte ich eine Benutzergruppe (pg_group) ein?</H4><P>
Zur Zeit gibt es keine einfache Schnittstelle, um Benutzergruppen einzurichten
Du mu&szlig;t explizit die pg_group-Tabelle mittels INSERT/UPDATE modifizieren.
Zum Beispiel:
<PRE>
<CODE>
jolly=&gt; INSERT into pg_group (groname, grosysid, grolist)
jolly=&gt; values ('posthackers', '1234', '{5443, 8261}');
INSERT 548224
jolly=&gt; grant INSERT on foo to group posthackers;
CHANGE
jolly=&gt;
</CODE>
</PRE><P>
Die Felder in pg_group sind:
<UL>
<LI> groname: der Gruppenname. Dieser Name sollte rein alphanumerisch sein. Keine Unterstriche oder andere Punktionen
<LI> grosysid: die Gruppen-ID. Die Gruppen-ID ist ein int4-Feld. Sie sollte eindeutig f&uuml;r jede Gruppe sein.
<LI> grolist: die Liste der pg_user IDs, die zu dieser Gruppe geh&ouml;ren. (int4[].)
</UL><P>
<HR>
<H2><CENTER>Fragen zum Betrieb</CENTER></H2><P>
<H4><a name="4.1">4.1</a>) Das System scheint Kommata, Dezimalpunkte und Datumsformate durcheinanderzubringen.</H4><P>
&Uuml;berpr&uuml;fe die Konfiguration Deiner Locale-Einstellung. PostgreSQL benutzt die
Einstellungen des jeweiligen Users und nicht die des postmaster Prozesses.
Es gibt postgres und psql SET Befehle, um das Datumsformat zu kontrollieren.
Setzte diese entsprechend Deiner Arbeitsumgebung.
<P>
<H4><a name="4.2">4.2</a>) Was ist der genauer Unterschied zwischen Binary Cursors und Normal Cursors?</H4><P>
Vgl. die <I>declare</I> Man-Page f&uuml;r eine Beschreibung.<P>
<H4><a name="4.3">4.3</a>) Wie w&auml;hle ich per <I>SELECT</I> nur die ersten paar Zeilen in einem Query aus?</H4><P>
Vgl. die <I>fetch</I> Man-Page, oder benutze SELECT ... LIMIT....<P>
Das verhindert nur, da&szlig; alle Ergebniszeilen zum Client &uuml;bermittelt werden.
Die komplette Abfrage mu&szlig; abgearbeitet werden, selbst wenn Du nur die ersten paar Zeilen haben m&ouml;chtest.
Ziehe ein Query in Erw&auml;gung, das ein <I>ORDER BY</I> benutzt. Es gibt keine M&ouml;glichkeit Zeilen
zur&uuml;ckzuliefern, bevor nicht die komplette Abfrage abgearbeitet ist.
<P>
<H4><a name="4.4">4.4</a>) Wie bekomme ich eine Liste der Tabellen oder anderen Dingen, die ich in <I>psql</I> sehen kann<BR></H4><P>
Du kannst Dir die Datei pgsql/src/bin/psql/psql.c mit dem Quellcode f&uuml;r <I>psql</I> ansehen.
Sie enth&auml;lt die SQL-Befehle, die die Backslash-Kommandos (\) ausf&uuml;hren.
Seit Postgres 6.5 kannst Du <I>psql</I> auch mit der <I>-E</I> Option starten. Dadurch gibt
<I>psql</I> die Queries aus, die es bei der Ausf&uuml;hrung der Befehle benutzt.
<P>
<H4><a name="4.5">4.5</a>) Wie entferne ich eine Spalte von einer Tabelle?</H4><P>
Wir unterst&uuml;tzen <I>alter table drop column</I> nicht, aber mache es so:
<PRE> <CODE>
SELECT ... -- w&auml;hle alle Spalten au&szlig;er die, die Du entfernen willst
INTO TABLE new_table
FROM old_table;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
</CODE>
</PRE><P>
<H4><a name="4.6">4.6</a>) Was ist die Maximalgr&ouml;&szlig;e f&uuml;r eine Zeile, eine Tabelle, eine Datenbank?</H4><P>
Zeilen sind auf 8 kB begrenzt, aber das kann ge&auml;ndert werden, indem Du in
<I>include/config.h</I> die Konstante <I>BLCKSZ</I> &auml;nderst.
Um Attribute mit mehr als 8 kB zu nutzen, kannst Du auch das "Large Object Interface" benutzen.<P>
Zeilen &uuml;berschreiten keine 8 kB-Grenzen. Eine Zeile mit 5 kB wird 8 kB Speicherplatz ben&ouml;tigen.
<P>
Tabellen- und Datenbankgr&ouml;&szlig;en haben keine Grenzen. Es gibt viele Datenbanken mit zig Gigabytes und
wahrscheinlich einige mit hunderten Gigabyte.
<H4><a name="4.7">4.7</a>) Wieviel Plattenplatz ben&ouml;tigt eine Datenbank zur Speicherung einer Datendatei mit zeilenweisen Datens&auml;tzen?<BR></H4><P>
Eine Postgres Datenbank kann ungef&auml;hr sechseinhalb mal soviel Platz brauchen,
wie eine einfache Textdatei.<P>
Betrachten wir eine Datei mit 300.000 Zeilen, mit jeweil zwei Integern pro Zeile.
Die einfache Textdatei ben&ouml;tigt 2,4 MB Speicherplatz.
Die Gr&ouml;&szlig;e der Postgres Datenbankdatei, die diese Daten enth&auml;lt, liegt
ungef&auml;hr bei 14 MB.
<PRE>
36 Bytes: jeder Zeilenkopf (ungef&auml;hr)
+ 8 Bytes: zwei Integer-Felder @ jedes 4 Bytes
+ 4 Bytes: Zeiger auf den Datensatz
-----------------------------------------------
48 Bytes pro Zeile
Die Gr&ouml;&szlig;e einer Datenseite in PostgreSQL ist 8192 Bytes (8 KB), also:
8192 Bytes pro Seite
--------------------- = 171 Zeilen pro Seite (aufgerundet)
48 Bytes pro Zeile
300000 Datenzeilen
----------------------- = 1755 Datenbankseiten
171 Zeilen pro Seite
1755 Datenbankseiten * 8192 Bytes pro Seite = 14,376,960 Bytes (14MB)
</PRE></P>
Indizes haben nicht einen solchen Overhead, sie beinhalten jedoch die Daten, die sie
indizieren und k&ouml;nnen so auch sehr gro&szlig; werden.
<P>
<H4><a name="4.8">4.8</a>) Wie finde ich heraus, welche Indizes oder Operationen in der Datenbank definiert sind?</H4><P>
<I>psql</I> hat eine Vielzahl von Backslash Befehlen, um solche Informationen zu zeigen.
Benutze \?, um sie zu sehen.
<P>
Schaue Dir auch die Datei <I>pgsql/src/tutorial/syscat.source.</I> an.
Sie illustriert viele der <I>SELECT</I>s, die ben&ouml;tigt werden, um diese Informationen
von der Datenbank-Systemtabelle zu erhalten
<P>
<H4><a name="4.9">4.9</a>) Meine Queries sind langsam oder nutzen die Indizes nicht. Warum?</H4><P>
PostgeSQL pflegt automatische Statistiken nicht.
Um die Statistiken zu aktualisieren, mu&szlig;t Du ein explizites <I>vacuum</I> eingeben.
Nach dieser Aktualisierung wei&szlig; der Optimierer
wieviele Zeilen in der Tabelle sind und kann besser entscheiden, ob Indizes benutzt werden sollten.
Der Optimierer benutzt keine Indizes, wenn die Tabelle klein ist, weil ein sequentieller Suchlauf
dann schneller sein w&uuml;rde.<P>
Benutze den Befehl <I> vacuum analyze</I> f&uuml;r die spaltenspezifische Optimierung.
<I>Vacuum analyze</I> ist f&uuml;r komplexe Multi-Join-Abfragen wichtig, damit der Optimierer
die Anzahl der Zeilen von jeder Tabelle sch&auml;tzen und dann die passende Join-Reihenfolge
w&auml;hlen kann.
Das Backend verfolgt die Spaltenstatistik nicht selbst, so da&szlig; <I>vacuum analyze</I>
regelm&auml;&szlig;ig aufgerufen werden sollte.
<P>
Indizes werden nicht f&uuml;r <I>ORDER BY</I> Operationen benutzt.<P>
Bei der Nutzung von Wildcard-Operatoren wie <I>LIKE</I> oder <I>~,</I>&nbsp; k&ouml;nnen Indizes
nur benutzt werden, wenn die Suche mit dem Anfang eines Strings startet.
Um also Indizes zu nutzen, sollten <I>LIKE</I>-Suchen nicht mit
<I>%,</I> und <I>~</I>&nbsp; beginnen (Die Sucheparameter regul&auml;rer Ausdr&uuml;cke sollten
mit <I>^.</I>&nbsp; beginnen.
<H4><a name="4.10">4.10</a>) Auf welche Weise kann ich sehen, wie der Query-Optimierer meine Abfrage auswertet?</H4><P>
Vgl. die <I>EXPLAIN</I> Man-Page.<P>
<H4><a name="4.11">4.11</a>) Was ist ein R-Tree Index?</H4><P>
Ein R-Tree Index wird benutzt, um r&auml;umliche Daten zu indizieren.
Ein Hash-Index kann nicht f&uuml;r Bereichssuchen genutzt werden.
Ein B-Tree Index kann nur f&uuml;r Bereichssuchen in eindimensionalen Daten
genutzt werden. R-Trees k&ouml;nnen multi-dimensionale Daten abhandeln.
Ein Beispiel: Wenn ein R-Tree Index auf ein Attribut vom Typ <I>POINT</I>
gebildet wird, dann kann das System Abfragen wie z.B. "Zeige alle Punkte,
die sich in einem umgebenden Rechteck befinden" effizienter beantworten.
<P>
Die kanonische Ver&ouml;ffentlichung , die das originale R-Tree Design beschreibt ist:
<P>
Guttman, A. "R-Trees: A Dynamic Index Structure for Spatial Searching."
Proc of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, 45-57.<P>
Du kannst dieses Werk ebenfalls in Stonebraker's "Readings in Database
Systems" finden.<P>
Die eingebauten R-Trees k&ouml;nnen Polygone und Rechtecke verarbeiten.
Theoretisch k&ouml;nnen R-Trees auf eine hohe Anzahl von Dimensionen erweitert werden.
Praktisch bedingt diese Erweiterung eine Menge Arbeit und wir haben derzeit
keinerlei Dokumentation dar&uuml;ber, wie das zu machen w&auml;re.
<P>
<H4><a name="4.12">4.12</a>) Was ist "Genetic Query Optimization"?</H4><P>
Das GEQO-Modul in PostgreSQL soll dazu dienen, das Optimierungsproblem beim
Joining vieler Tabellen auf der Basis genetischer Algorithmen (GA) zu l&ouml;sen.
Es erlaubt die Behandlung von gro&szlig;en Join-Queries ohne ersch&ouml;pfende Suche.
<P>
F&uuml;r weitere Informationen siehe die Dokumentation.
<H4><a name="4.13">4.13</a>) Wie verfahre ich bei der Suche mit regul&auml;ren Ausdr&uuml;cken und bei einer Suche mit Ignorierung der Gro&szlig;- und Kleinschreibweisen?</H4><P>
<I>~</I> und <I>~*</I>&nbsp; sind wahrscheinlich das, was Du willst.
Vgl. psql's <I>\do</I> Befehl. <P>
<H4><a name="4.14">4.14</a>) Wie ermittle ich in einem Query, da&szlig; ein Feld NULL ist?</H4><P>
Du testest die Spalte mit IS NULL und IS NOT NULL.<P>
<H4><a name="4.15">4.15</a>) Was ist der Unterschied zwischen den verschiedenen CHAR-Typen?</H4>
<PRE>
Typ interner Name Bemerkungen
--------------------------------------------------
CHAR char 1 Zeichen
CHAR(#) bpchar mit Leerzeichen gef&uuml;llt bis zur angegebenen L&auml;nge
VARCHAR(#) varchar Die Gr&ouml;&szlig;e legt die Maximall&auml;nge fest, kein Ausf&uuml;llen mit Leerzeichen
TEXT text Die L&auml;nge wird nur durch die maximale Zeilenl&auml;nge beschr&auml;nkt
BYTEA bytea Bytearray mit variabler L&auml;nge
</PRE><P>
Du mu&szlig;t die internen Namen benutzen, wenn Du interne Operationen durchf&uuml;hren willst.
<P>
Die letzten vier Typen sind "varlena"-Typen (d.h. die ersten vier Bytes geben die L&auml;nge an, gefolgt
von den Daten).
<I>CHAR(#)</I> belegt die maximale Anzahl von Bytes, unabh&auml;ngig davon, wieviele Daten im
Feld gespeichert werden.
<I>TEXT, VARCHAR(#)</I> und <I>BYTEA</I> haben alle eine variable L&auml;nge auf dem Datentr&auml;ger,
deshalb gibt es einen leichten Geschwindigkeitsnachteil bei der Nutzung dieser Typen.
Genauer, der Nachteil gilt f&uuml;r den Zugriff auf alle Spalten nach der ersten Spalte dieses Typs.
<P>
<H4><a name="4.16">4.16</a>) Wie erzeuge ich ein serielles Feld mit automatischer Erh&ouml;hung des Inhalts?</H4><P>
PostgreSQL unterst&uuml;tzt einen <I>SERIAL</I> Datentyp. Er erzeugt automatisch eine
Sequenz und einen Index auf die Spalte. Siehe die <I>create_sequence</I> Man-Page
f&uuml;r weitere Informationen &uuml;ber Sequenzen.
Du kannst aber auch das <I>Oid</I> Feld jeder Zeile als eindeutigen Wert nutzen.
Jedoch mu&szlig;t Du, falls Du Deine Datenbank einmal komplett ausgeben und wieder einlesen willst,
die <I>pg_dump's -o</I> oder die <I>copy with oids</I> Option benutzen, um die Oids zu retten.<P>
<H4><a name="4.17">4.17</a>) Was ist ein Oid? Was ist ein Tid?</H4><P>
Oids sind PostgreSQLs Antwort auf eindeutige Zeilen-IDs. Jede Zeile, die in PostgreSQL
erzeugt wird, bekommt eine eindeutige Oid. Alle Oids, die w&auml;hrend initdb erzeugt werden, sind kleiner
als 16384 (nach <I>backend/access/transam.h</I>).
Alle Oids, die durch den Benutzer erzeugt werden, sind gleich oder gr&ouml;&szlig;er als dieser Wert.
Standardm&auml;&szlig;ig sind all diese Oids nicht nur innerhalb einer Tabelle oder Datenbank, sondern
in der gesamten PostgreSQL Installation eindeutig.
<P>
PostgreSQL benutzt Oids in seinen internen Systemtabellen, um Zeilen zwischen den Tabellen zu
verbinden. Diese Oids k&ouml;nnen zur Identifikation spezifischer Benutzerzeilen und in Joins
genutzt werden.
Es wird empfohlen, den Spaltentyp OID zu nutzen, um Oids-Werte zu speichern.
Siehe die <I>sql(l)</I> Man-Page, um die anderen internen Spalten kennenzulernen.
Du kannst einen Index auf ein Oid-Feld erzeugen, um schnelleren Zugriff zu erreichen.
<P>
Oids werden allen neuen Zeilen von einem zentralen Bereich, der von allen Datenbanken
genutzt wird, zugewiesen. Es gibt keinen Grund, warum Du nicht die Oid &auml;ndern, oder eine Kopie der
Tabelle mit den originalen Oids anlegen k&ouml;nntest.
<PRE>
CREATE TABLE new_table(old_oid oid, mycol int);
SELECT INTO new SELECT old_oid, mycol FROM old;
COPY new TO '/tmp/pgtable';
DELETE FROM new;
COPY new WITH OIDS FROM '/tmp/pgtable';
<!--
CREATE TABLE new_table (mycol int);
INSERT INTO new_table (oid, mycol) SELECT oid, mycol FROM old_table;
-->
</PRE><P>
Tids werden genutzt, um spezifische physische Zeilen mit Block und
Versatzwert zu identifizieren. Tids &auml;ndern sich, wenn Zeilen ge&auml;ndert oder
neu geladen werden. Sie werden von Index-Eintr&auml;gen genutzt, um die
Zeilen physisch zu adressieren.
<H4><a name="4.18">4.18</a>) Was ist die Bedeutung der verschiedenen Ausdr&uuml;cke, die in PostgreSQL benutzt werden (z.B. attribute, class,...)?</H4><P>
Einige der Quelltexte und die &auml;ltere Dokumentation nutzen allgemeine Begriffe.
Hier sind einige aufgef&uuml;hrt:
<UL>
<LI> row, record, tuple
<LI> attribute, field, column
<LI> table, class
<LI> retrieve, SELECT
<LI> replace, UPDATE
<LI> append, INSERT
<LI> oid, serial value
<LI> portal, cursor
<LI> range variable, table name, table alias
</UL><P>
<H4><a name="4.19">4.19</a>) Wieso bekomme ich einen Fehler: "FATAL: palloc failure: memory exhausted?"<BR></H4><P>
M&ouml;glicherweise ist der virtuelle Speicher verbraucht oder Dein Kernel hat
eine niedrige Grenze f&uuml;r bestimmte Ressourcen.
Versuche dieses, bevor Du den postmaster startest:
<PRE>
<CODE>
ulimit -d 65536
limit datasize 64m
</CODE>
</PRE>
Je nach Deiner eingesetzten Shell mag nur einer dieser Befehle funktionieren.
Aber es wird die Grenze des Datensegments f&uuml;r Prozesse erh&ouml;hen und vielleicht
l&auml;uft so Dein Query durch.
Dieser Befehl wirkt sich auf den aktuellen Prozess und alle seine Unterprozesse
aus, die nach diesem Befehl gestartet werden. Falls Du ein Problem mit dem SQL-CLient hast,
weil das Backend zu viele Daten zur&uuml;ckliefert, versuche diesen Befehl, bevor Du den
SQL-Client startest.
<P>
<H4><a name="4.20">4.20</a>) Wie kann ich feststellen, welche PostgreSQL-Version ich laufen habe?<BR></H4><P>
Gib in <I>psql</I> <CODE>SELECT version();</CODE> ein<P>
<H4><a name="4.21">4.21</a>) Beim Arbeiten mit "large-object" kommt die Fehlermeldung: <I>invalid large obj descriptor.</I> Warum?<BR></H4><P>
Du solltest die Befehle <CODE>BEGIN WORK</CODE> und <CODE>COMMIT
</CODE> bei jeden Gebrauch von Large Objects benutzen. Also um
<CODE>lo_open</CODE> ... <CODE>lo_close.</CODE><P>
Die Dokumentation hat schon immer darauf hingewiesen, da&szlig;
<I>lo_open</I> in eine Transaktion eingebunden werden mu&szlig;, aber die PostgreSQL Versionen vor 6.5
haben diese Regel nicht erzwungen.
Statt dessen scheiterten sie gelegentlich, wenn Du diese Regel gebrochen hattest.<P>
Das aktuelle PostgreSQL erzwingt diese Regel, indem es die Handles der Large Objects
beim COMMIT der Transaktion schlie&szlig;t, was sofort nach dem <I>lo_open</I> passiert,
wenn Du nicht innerhalb einer Transaktion bist.
So f&uuml;hrt der erste Versuch, etwas mit dem Large Object zu machen zu einem
<I>invalid large obj descriptor</I>.
Also wird der Code, der bisher benutzt wurde, nun diese Fehlermeldung erzeugen, wenn Du
keine Transaktionen benutzt hast.
<P>
Falls Du eine Client-Schnittstelle wie ODBC benutzt, kann es sein, da&szlig; Du
<CODE>auto-commit off</CODE> setzen mu&szlig;t.<P>
<HR>
<H2><CENTER>PostgreSQL erweitern</CENTER></H2><P>
<H4><a name="5.1">5.1</a>) Ich habe eine benutzerdefinierte Funktion geschrieben. Wenn ich sie in <I>psql</I> aufrufe, kommt ein <I>core dump</I>. Warum?</H4><P>
Dieses Problem kann viele Ursachen haben. Teste deine Funktion zuerst in einem
Extra-Testprogramm. Stelle au&szlig;erdem sicher, da&szlig; Deine Funktion nicht etwa elog-Nachrichten sendet, wenn der Client Daten erwartet,
wie in den type_in() oder type_out() Funktionen<P>
<H4><a name="5.2">5.2</a>) Was bedeutet die Meldung: <I>NOTICE:PortalHeapMemoryFree: 0x402251d0 not in alloc set!</I>?</H4><P>
Du <I>pfree</I>st etwas, das Du nicht <I>palloc</I>t hast!
Stelle sicher, da&szlig; Du nicht <I>malloc/free</I> und <I>palloc/pfree</I> durcheinanderw&uuml;rfelst.
<H4><a name="5.3">5.3</a>) Wie kann ich ein paar elegante neue Feldtypen und Funktionen zu PostgreSQL beitragen?
</H4><P>
Sende Deine Erweiterungen zur pgsql-hackers Mailing Liste,
und sie werden eventuell im <I>contrib/</I> Verzeichnis enden.<P>
<H4><a name="5.4">5.4</a>) Wie schreibe ich eine Funktion in C, die einen Tuple zur&uuml;ckliefert?</H4><P>
Das erfordert derart extreme Genialit&auml;t, da&szlig; die Autoren es niemals versucht haben,
obwohl es im Prinzip zu machen w&auml;re.<P>
<H4><a name="5.5">5.5</a>) Ich habe eine der Quellendateien ge&auml;ndert. Warum macht sich die &Auml;nderung beim erneuten Compilerlauf nicht bemerkbar?</H4><P>
Die Makefiles finden nicht die richtigen Abh&auml;ngigkeiten. Du mu&szlig;t ein <I>make clean</I> und dann ein weiteres <I>make</I> machen.
</BODY>
</HTML>
<PRE>
=======================================================
Frequently Asked Questions (FAQ) for PostgreSQL V6.4
HP-UX Specific
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
=======================================================
last updated: Sat Nov 28 16:21:25 EST 1998
current maintainer: Tom Lane (tgl@sss.pgh.pa.us)
original author: Tom Lane (tgl@sss.pgh.pa.us)
Questions covered here:
1.1) What do I need to install PostgreSQL on HP-UX?
1.2) Anything special about the build/install procedure?
1.3) yacc dies trying to process src/backend/parser/gram.y.
1.4) Linking the main postgres executable fails, complaining that
there's no "alloca" function.
1.5) OK, it seemed to build and install, but the regression test fails.
----------------------------------------------------------------------
Section 1: Installing PostgreSQL
----------------------------------------------------------------------
1.1) What do I need to install PostgreSQL on HP-UX?
PostgreSQL 6.4 is known to build and pass regression test on HPUX 9.03,
9.05, and 10.20, given appropriate system patch levels and build tools.
It should work on other HPUX 9.* and 10.* releases for Series 700/800
machines, too. (No one has reported trying it with HPUX 11 yet.)
Since this is a new FAQ, I don't yet have a lot of information about the
exact prerequisites, but I'd appreciate hearing from anyone who fails to
build a working copy, so that we can add more info about exactly what is
needed.
Aside from PostgreSQL 6.4 or later sources, you will need GNU make
(HP's make will not do), and either GNU gcc or HP's full ANSI C compiler.
You must also get flex (GNU lex) 2.5.4 or later --- all versions of
HP's lex fail on the Postgres lexer files.
I'd also recommend making sure you are fairly up-to-date on HP patches,
particularly if you are using HPUX 9. At a minimum, if you are on HPUX 9,
you *must* have PHSS_4630 (libm update) or a successor patch; otherwise
Postgres' date/time functions will misbehave. On general principles you
should be current on libc and ld/dld patches, as well as compiler
patches if you are using HP's C compiler (but I don't currently know of
any specific failures due to not having recent patches for these files).
See HP's support websites, such as http://us-support.external.hp.com/,
for free copies of their latest patches.
PostgreSQL 6.3.2 and earlier required quite a few small tweaks to
install on HPUX, so I recommend you not bother with anything older
than 6.4.
1.2) Anything special about the build/install procedure?
When you run configure, you will want to explicitly select either the
hpux_cc or hpux_gcc template depending on which compiler you plan to
use:
./configure --with-template=hpux_cc
for HP's C compiler, or
./configure --with-template=hpux_gcc
for GNU gcc. (If you omit --with-template, configure may either
default to hpux_cc or give up entirely, depending on which HPUX and
PostgreSQL releases you have.)
You may want to tweak the CFLAGS setting in template/hpux_[g]cc before
you configure; the distributed files contain neither -O nor -g switches,
which is hardly optimal for any situation. I've seen no problems using
-O with gcc 2.7.2.*.
The default install target location is /usr/local/pgsql, which
(particularly on HPUX 10) you might want to change to something under
/opt. If so, use the --prefix switch to configure.
If you have both HP and GNU C++ compilers in your PATH, keep an eye on
whether configure picks the right one --- you want the HP c++ if you are
using HP C, or g++ if you are using gcc. Mixing HP and GNU compilers
won't work. You may need to provide a --with-CXX=compiler switch to
force configure to pick the matching C++ compiler, or even say
--without-CXX if you have a C++ compiler but it doesn't match the C
compiler you want to use.
Otherwise the standard build/install procedure described in the
PostgreSQL documentation works fine.
1.3) yacc dies trying to process src/backend/parser/gram.y.
HP's yacc doesn't create its tables large enough to handle the Postgres
grammar (a lot of other vendors' yaccs have this problem too). There
are three possible workarounds:
1. The quickest answer is just to "touch" src/backend/parser/gram.c
and src/backend/parser/parse.h and repeat the build. Any PostgreSQL
distribution file should have up-to-date copies of those files included,
so you shouldn't need to run yacc on gram.y at all ... but sometimes
gram.y mistakenly has a newer timestamp in the distribution than the
derived files do.
2. Install "bison" (GNU yacc) and reconfigure. Bison doesn't have a
problem with large grammars. Note this is not the right choice if you
are using HP's cc on HPUX 9 --- see next item.
3. Increase yacc's table sizes enough to cope. With a pre-6.4
PostgreSQL grammar, I was able to get HPUX 9's yacc to work by
setting YFLAGS to
-d -Np2000 -Ns3000 -Nm100000 -Nl2000 -Na30000 -Nc10000
(You can edit YFLAGS either in the template file before running
configure, or in src/Makefile.global afterwards.) Future PostgreSQL
releases might require even larger tables, but this should do for
a starting point.
1.4) Linking the main postgres executable fails, complaining that
there's no "alloca" function.
If you're using HP's cc on HPUX 9, it's right: there's no alloca
function. The only place in PostgreSQL that uses alloca is the parser
(gram.c), and that does so only if it was generated with GNU bison.
Unfortunately the distribution copy of gram.c is made with bison.
There are several possible answers:
1. Remake gram.c with HP's yacc (see above item for switch settings).
You might also need to remake src/backend/bootstrap/bootparse.c.
2. Build with gcc, which treats alloca as a compiled-in-line function.
3. Install HPUX 10, which has alloca. You're gonna have to do that
before Y2K anyway...
1.5) OK, it seemed to build and install, but the regression test fails.
There are several "expected failures" due to differences between HPUX
and the regression test reference platform used by the PostgreSQL group.
A look at the textual differences between the expected and actual
outputs will usually reveal that the differences are minor. You should
expect these differences:
TEST(S) COMMENTS
int2, int4: pg_atoi generates a differently worded error
message for integer overflow.
float8: In 6.4, float8 shows some differences due to
different handling of overflow/underflow errors in
exp() and pow(). This should be fixed in 6.4.1
and later.
float8, geometry: Lots of differences in the last digit or two
because of different roundoff errors in floating
arithmetic. Also, HPUX does not distinguish
-0 from 0 during printout, but the reference
platform does.
horology: HPUX time library does not know about daylight
savings time before 1970, so there are some
places in horology where a time will be shown
in PST instead of PDT.
In addition, the int8 regression test will fail massively on HPUX 9,
because int8 doesn't actually work on this platform (sprintf/sscanf
don't cope with long long int). Either upgrade to HPUX 10, or don't
use int8 data.
Any other error is cause for suspicion. In particular, if you see
failures in the datetime test on HPUX 9, you probably forgot to
install the libm patch PHSS_4630 --- see item 1.1 above.
</PRE>
<PRE>
======================================================
Frequently Asked Questions (FAQ) for PostgreSQL >=V6.1
IRIX Specific
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
======================================================
last updated: Mon Mar 05 17:00:00 GMT 1998
current maintainer: Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
original author: Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
Changes in this version (* = modified, + = new, - = removed):
*1.5) Can I install PostgreSQL (<V6.3) under Irix 6.x?
+1.10) How do I install PostgreSQL V6.3 under Irix 6.x?
This file is divided approximately as follows:
1.*) Installing PostgreSQL
2.*) Uninstalling PostgreSQL
3.*) Extending PostgreSQL
Questions answered:
1.1) What extra items do I need to install PostgreSQL under Irix?
1.2) What changes do I need to make to src/Makefile.global?
1.3) What are the references in X11_LIB to libsocket and libnsl in
src/Makefile.global?
1.4) Are there any other changes I should make?
1.5) Can I install PostgreSQL (<V6.3) under Irix 6.x?
1.6) The make fails with the following message:
ld32: ERROR 4: Conflicting flag setting: -call_shared
1.7) Why won't it link? (Problems with lorder)
1.8) I have major problems with IRIX 6!
1.9) Why does lex fail with PostgreSQL 6.2.1?
1.10) How do I install PostgreSQL V6.3 under Irix 6.x?
2.1) Why can't I move the executable files?
3.1) How do I compile a C program to create a function for extending
PostgreSQL
----------------------------------------------------------------------
Section 1: Installing PostgreSQL
----------------------------------------------------------------------
1.1) What extra items do I need to install PostgreSQL under Irix?
You *must* have the following installed:
a) Gnu make (installed as gmake)
You are recommended to install the following:
a) GNU install (installed as ginstall)
(This is part of the GNU fileutils package)
You may choose to install the following:
a) GNU readline library (if you wish psql to have readline
support).
b) tcl/tk (if you wish to compile pgtclsh)
1.2) What changes do I need to make to src/Makefile.global or
src/Makefile.custom?
The easiest way to do this is to use the customize script in
the src directory.
You *must* set the following variables:
PORTNAME= irix5
You will also need to change the following to match your own
installation:
POSTGRESDIR
If you switch on the USE_TCL option, you will need to set these:
TCL_INCDIR=
TCL_LIBDIR=
TCL_LIB =
TK_INCDIR=
TK_LIBDIR=
TK_LIB =
You may also make any other changes you need as documented in
the INSTALL file and in Makefile.global
1.3) What are the references in X11_LIB to libsocket and libnsl in
src/Makefile.global?
This was a problem in 1.08 (they are Sun Solaris specific).
It is fixed in 1.09 and above.
1.4) Are there any other changes I should make?
If you have installed the GNU install program (ginstall), you
should add the following line to src/Makefile.custom:
CUSTOM_INSTALL=ginstall
For an explanation as to why this is a good idea, see Question 2.1
Ginstall is part of the GNU fileutils package.
1.5) Can I install PostgreSQL (<V6.3) under Irix 6.x?
Instructions for PostgreSQL V6.3 are answered in Question 1.10!
Irix 6.2-6.4 has a bug in ld which mishandles the addresses of
static procedures when object files are assembled into
larger object files using 'ld -r'. This bug has been reported
to Silicon Graphics.
One option is to use the Gnu version of ld. Alternatively,
the following patch should be applied as a workaround.
(Supplied by Bob Bruccoleri <bruc@bms.com>)
*** ./backend/Makefile.orig Thu May 22 00:00:15 1997
--- ./backend/Makefile Thu Jun 5 16:47:27 1997
***************
*** 54,60 ****
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
postgres: $(OBJS) ../utils/version.o
! $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
$(OBJS): $(DIRS:%=%.dir)
--- 54,64 ----
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
postgres: $(OBJS) ../utils/version.o
! # $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
! -rm -f *.o
! find . -name "*.o" -exec cp \{\} . \;
! rm -f SUBSYS.o
! $(CC) -o postgres *.o ../utils/version.o $(LDFLAGS)
$(OBJS): $(DIRS:%=%.dir)
1.6) The make fails with the following message:
ld32: ERROR 4: Conflicting flag setting: -call_shared
If gmake fails in .../src/backend while building obj/ACCESS.o
with a message from ld32, you can work around this by using
ld for the LD environment variable rather than cc.
The problem has been observed under Irix 5.3 when compiling both
Postgres95-1.09 and PostgreSQL-6.2Beta6, but on some systems
these appear to compile with no such problems.
Fix supplied by Brian Sanders (bsanders@netcom.com,
brian@fresnelsoft.com)
1.7) Why won't it link? (Problems with lorder)
According to the IRIX man pages, lorder is useless, but harmless
under IRIX. However, it has caused problems for some people
using both IRIX 6.2.
The solution is to add the following line to
.../src/makefiles/Makefile.irix5
MK_NO_LORDER=true
1.8) I have major problems with IRIX 6!
The following is quoted directly from Bob Bruccoleri <bruc@bms.com>
There is a really nasty loader bug in the compiler system (7.1)
on Irix 6.x, and the error that Lasse Petersen is the result of it.
Here is the original message. I don't know if all the changes have been
folded into the current release.
Date: Fri, 06 Jun 1997 17:12:20 -0400 (EDT)
From: bruc@bms.com (Robert Bruccoleri)
Subject: [PORTS] Patches for Irix 6.4
I have worked out how to compile PostgreSQL on Irix 6.4 using the -n32 compiler
mode and version 7.1 of the C compiler. (The n32 compiler use 32 bits addressing,
but allows access to all the instructions in the MIPS4 instruction set.)
There were several problems:
1) The ld command is not referenced as a macro in all the Makefiles. On
this platform, you have to include -n32 on all the ld commands. Makefiles
were changed as needed.
2) There is a bug in "ld" which mishandles the addresses of static procedures
when object files are assembled into larger object files using "ld -r".
Because of this, I put a hack into src/backend/Makefile to avoid all the
SUBSYS.o files and just link all the objects. I have contacted SGI about the
problem, and hopefully, it will be fixed in the near future.
3) Lots of warnings are generated from the compiler. Since the regression
tests worked OK, I didn't attempt to fix them. If anyone wants the compilation
log, please let me know, and I'll email it to you.
The version of postgresql was 970602. Here is Makefile.custom:
CUSTOM_COPT = -O2 -n32
MK_NO_LORDER = 1
LD = ld -n32
CC += -n32
Here are the patches:
*** ./backend/access/Makefile.orig Sun Nov 10 00:00:15 1996
- --- ./backend/access/Makefile Tue Jun 3 10:22:32 1997
***************
*** 8,13 ****
- --- 8,16 ----
#
#-------------------------------------------------------------------------
+ SRCDIR = ../..
+ include ../../Makefile.global
+
OBJS = common/SUBSYS.o gist/SUBSYS.o hash/SUBSYS.o heap/SUBSYS.o \
index/SUBSYS.o rtree/SUBSYS.o nbtree/SUBSYS.o transam/SUBSYS.o
*** ./backend/bootstrap/Makefile.orig Fri Apr 18 06:00:23 1997
- --- ./backend/bootstrap/Makefile Tue Jun 3 10:23:59 1997
***************
*** 38,44 ****
all: SUBSYS.o
SUBSYS.o: $(OBJS)
! ld -r -o SUBSYS.o $(OBJS)
# bootstrap.o's dependency on bootstrap_tokens.h is computed by the
# make depend, but we state it here explicitly anyway because
- --- 38,44 ----
all: SUBSYS.o
SUBSYS.o: $(OBJS)
! $(LD) -r -o SUBSYS.o $(OBJS)
# bootstrap.o's dependency on bootstrap_tokens.h is computed by the
# make depend, but we state it here explicitly anyway because
*** ./backend/Makefile.orig Thu May 22 00:00:15 1997
- --- ./backend/Makefile Thu Jun 5 16:47:27 1997
***************
*** 54,60 ****
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
postgres: $(OBJS) ../utils/version.o
! $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
$(OBJS): $(DIRS:%=%.dir)
- --- 54,64 ----
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source
postgres: $(OBJS) ../utils/version.o
! # $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
! -rm -f *.o
! find . -name "*.o" -exec cp \{\} . \;
! rm -f SUBSYS.o
! $(CC) -o postgres *.o ../utils/version.o $(LDFLAGS)
$(OBJS): $(DIRS:%=%.dir)
***************
*** 116,122 ****
install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(POSTGRES_IMP) fmgr.h\
global1.bki.source local1_template1.bki.source \
libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
!
$(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
ifeq ($(MAKE_EXPORTS), true)
$(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
- --- 120,126 ----
install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(POSTGRES_IMP) fmgr.h\
global1.bki.source local1_template1.bki.source \
libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
!
$(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
ifeq ($(MAKE_EXPORTS), true)
$(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
*** ./backend/optimizer/Makefile.orig Wed Feb 19 12:00:34 1997
- --- ./backend/optimizer/Makefile Tue Jun 3 10:39:47 1997
***************
*** 8,13 ****
- --- 8,16 ----
#
#-------------------------------------------------------------------------
+ SRCDIR= ../..
+ include ../../Makefile.global
+
all: submake SUBSYS.o
OBJS = path/SUBSYS.o plan/SUBSYS.o prep/SUBSYS.o util/SUBSYS.o geqo/SUBSYS.o
*** ./backend/libpq/pqcomprim.c.orig Mon May 26 00:00:23 1997
- --- ./backend/libpq/pqcomprim.c Fri Jun 6 16:02:24 1997
***************
*** 32,40 ****
# define hton_l(n) (ntoh_l(n))
# else /* BYTE_ORDER != BIG_ENDIAN */
# if BYTE_ORDER == PDP_ENDIAN
! # #error PDP_ENDIAN macros not written yet
# else /* BYTE_ORDER != anything known */
! # #error BYTE_ORDER not defined as anything understood
# endif /* BYTE_ORDER == PDP_ENDIAN */
# endif /* BYTE_ORDER == BIG_ENDIAN */
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
- --- 32,40 ----
# define hton_l(n) (ntoh_l(n))
# else /* BYTE_ORDER != BIG_ENDIAN */
# if BYTE_ORDER == PDP_ENDIAN
! # error PDP_ENDIAN macros not written yet
# else /* BYTE_ORDER != anything known */
! # error BYTE_ORDER not defined as anything understood
# endif /* BYTE_ORDER == PDP_ENDIAN */
# endif /* BYTE_ORDER == BIG_ENDIAN */
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
*** ./backend/storage/Makefile.orig Sun Nov 10 00:01:06 1996
- --- ./backend/storage/Makefile Tue Jun 3 10:41:29 1997
***************
*** 8,13 ****
- --- 8,16 ----
#
#-------------------------------------------------------------------------
+ SRCDIR= ../..
+ include ../../Makefile.global
+
all: submake SUBSYS.o
OBJS = buffer/SUBSYS.o file/SUBSYS.o ipc/SUBSYS.o large_object/SUBSYS.o \
1.9) Why does lex fail with PostgreSQL 6.2.1?
IRIX 5.3 lex has been reported to fail in
postgresql-6.2.1/src/backend/parser with the error:
lex scan.l
"scan.l":line 86: Error: Invalid request %x xc
gmake[2]: *** [scan.c] Error 1
The answer is to use GNU flex 2.5.4 or later. Use the command
flex --version
to check you have a new enough version of flex
1.10) How do I install PostgreSQL V6.3 under Irix 6.x?
Irix 6.2-6.4 has a bug in ld which mishandles the addresses of
static procedures when object files are assembled into
larger object files using 'ld -r'. This bug has been reported
to Silicon Graphics.
Depending on your Irix installation you may also encounter
2 other problems detailed below: Conflict in C standards,
Conflict in library functions.
a) Solving the ld bug
---------------------
One option is to use the Gnu version of ld. Alternatively,
the following patch should be applied as a workaround.
(Supplied by Bob Bruccoleri <bruc@bms.com> and modified for
PostgreSQL V6.3 by Lasse Hiller Petersen <lassehp@imv.aau.dk>)
Apply the following patch:
*** ./backend/Makefile.orig Tue Mar 3 15:33:58 1998
--- ./backend/Makefile Tue Mar 3 15:39:27 1998
***************
*** 63,69 ****
global1.description
local1_template1.description
postgres: $(OBJS) ../utils/version.o
! $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
$(OBJS): $(DIRS:%=%.dir)
--- 63,73 ----
global1.description
local1_template1.description
postgres: $(OBJS) ../utils/version.o
! # $(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
! -rm -f *.o
! find . -name "*.o" -exec cp \{\} . \;
! rm -f SUBSYS.o
! $(CC) -o postgres *.o ../utils/version.o $(LDFLAGS)
$(OBJS): $(DIRS:%=%.dir)
Lasse configured with ./configure --enable-locale
and modified Makefile.custom to contain:
CC = cc -n32
LD = ld -n32
He reports that the installation without -n32 works fine too,
but the -n32 was required for compatibility with his Perl
installation. His system was an Origin200 running IRIX64 v6.4.
b) Conflict in C standards
--------------------------
I have found that the following patch is also necessary in order
to prevent a duplicate definition of a Union used for semaphores.
Apply the following patch to:
.../src/makefile/Makefile.irix5:
*** src/makefiles/Makefile.irix5.orig Thu Mar 5 16:59:58 1998
--- src/makefiles/Makefile.irix5 Thu Mar 5 17:01:13 1998
***************
*** 6,9 ****
%.so: %.o
$(LD) -G -Bdynamic -shared -o $@ $<
!
--- 6,9 ----
%.so: %.o
$(LD) -G -Bdynamic -shared -o $@ $<
! CFLAGS+= -U_NO_XOPEN4
i.e. the addition of the line:
CFLAGS+= -U_NO_XOPEN4
This is needed to stop the semun union being redefined in
/usr/include/sys/sem.h
c) Conflict in library functions
--------------------------------
In addition, if you have the nsl and crypt libraries these will
conflict with the required definitions. I think that libnsl.a
may be the Netware socket library (or something similar). In
any case, if you have these libraries, they will be added to
Makefile.global and you will need to remove them.
Thus, you should edit .../src/Makefile.global. Goto (approximately)
line 217 where LDFLAGS= is set and remove -lnsl and -lcrypt
from this line.
----------------------------------------------------------------------
Section 2: Deinstalling PostgreSQL
----------------------------------------------------------------------
2.1) Why can't I move the executable files?
By default, the IRIX port uses the BSD compatible version of
install from /usr/bin/X11. If you read the man page for this
version of install, you will see that it is not meant for
end-user use; it has the interesting side-effect of chowning
files it installs to root.
You should still be able to delete the files as you (the
postgres user) will own the directory in which they are
stored.
The normal IRIX install program cannot be used easily as it
takes its arguments in the reverse order. It is therefore
recommended to use the GNU version of install (ginstall).
See Question 1.4
----------------------------------------------------------------------
Section 3: Extending PostgreSQL
----------------------------------------------------------------------
3.1) How do I compile a C program to create a function for extending
PostgreSQL
Here is a sample command line:
cc -I/usr/local/PostgreSQL/include/ -I/usr/local/PostgreSQL/src/backend
-shared -o funcs.so funcs.c
----------------------------------------------------------------------------
Dr. Andrew C.R. Martin University College London
EMAIL: (Work) martin@biochem.ucl.ac.uk (Home) andrew@stagleys.demon.co.uk
URL: http://www.biochem.ucl.ac.uk/~martin
Tel: (Work) +44(0)171 419 3890 (Home) +44(0)1372 275775
</PRE>
<PRE>
=======================================================
Frequently Asked Questions (FAQ) for PostgreSQL >= V6.1
Linux Specific
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
=======================================================
last updated: Fri Jun 19 13:35:00 BST 1998
current maintainer: Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
original author: Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
Changes in this version (* = modified, + = new, - = removed):
+1.23) Why does the compile fail with messages about F_BOOLIN, F_BOOLOUT
and F_BYTEAIN being undeclared?
This file is divided approximately as follows:
1.*) Installing PostgreSQL
2.*) Compiling accessory programs
3.*) Runtime Problems
Questions answered:
1.1) What changes do I need to make to src/Makefile.global or
src/Makefile.custom and are there any other changes needed?
1.2) Why do I get problems with missing libreadline?
1.3) [REDHAT] Why do I get problems with missing libdl and dlfcn.h?
1.4) [SLACKWARE 3.1] Why do I get problems with missing libdl and dlfcn.h?
1.5) My compile of the backend dies complaining about the include file
dlfcn.h missing
1.6) GCC complains about an ignored option -fpic
1.7) I get warnings of the form
warning: cast from pointer to integer of different size
1.8) [SuSE-Linux 4.2-4.4] Where is curses and termcap?
1.9) Why do I get problems with ld.so?
1.10) Why do I get `yy_flush_buffer undefined' errors?
1.11) How do I compile PostgreSQL on an a.out system?
1.12) Why does make fail with:
yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
make: /usr/bin/make: cannot execute binary file
1.13) What are the references in X11_LIB to libsocket and libnsl in
src/Makefile.global?
1.14) [DEBIAN] Where is libtermcap?
1.15) [REDHAT] Can I get PostgreSQL as an RPM?
1.16) While trying to compile a development version under Linux, compilation
fails with a message like:
In file included from /usr/include/sys/sem.h:8,
from ipc.c:37:
/usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
....
make: *** [ipc.o] Error 1
1.17) When compiling postgres, gcc reports signal 11 and aborts.
1.18) Can I install 6.1.1 under MkLinux?
1.19) Why does make exit or crash?
1.20) How can I optimise for 486 or pentium processors
1.21) Why do I get strange results with printing times (for example
in the regression test 'timespan')?
1.22) Why don't I get any shared libraries for libpq when I compile
6.3.2?
1.23) Why does the compile fail with messages about F_BOOLIN, F_BOOLOUT
and F_BYTEAIN being undeclared?
2.1) The linker fails to find libX11 when compiling pgtclsh
3.1) I get an error reporting _fUnKy_POSTPORT_sTuFf_ undefined when
running scripts like createuser
3.2) I run postmaster and after that system says 'Bad system call(Core
dumped)'
3.3) When I try to start the Postmaster, why do I get an error of the form
Failed Assertion("!(file != 0):(null)", File:
"/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
!(file != 0) (0)
initdb: could not create template database
initdb: cleaning up.
3.4) Why doesn't createuser work?
3.5) Why do I get an error like:
IpcMemoryCreate: memKey=155356396 , size=760632 ,
permission=384IpcMemoryCreate: shmget(..., create, ...)
failed: Invalid argument
3.6) Why does psql fail with:
psql: can't load library 'libpq.so.1'
3.7) Other strange behaviour
3.8) When PostgreSQL is running when the system is shutdown, Linux
always fsck's the disk when rebooted.
3.9) Why does Query 32 in the regression tests take so long?
3.10) Why do I get funny rounding results in some date/time arithmetic,
such as
select '4 hours'::timespan;
returning '3 hours 59 minutes 60 seconds'?
----------------------------------------------------------------------
Section 1: Compiling PostgreSQL
----------------------------------------------------------------------
1.1) What changes do I need to make to src/Makefile.global or
src/Makefile.custom and are there any other changes needed?
Changes to the makefiles are most easily made by running the
customize shell script in the src directory which will write a
Makefile.custom for you.
The only other change you may have to make is to replace
Flex if you have version 2.5.3 which has a bug which generally
manifests itself as createuser failing (See Question 3.4)
If you modify the makefiles by hand, you *must* set the
following variable:
PORTNAME= linux
You will also need to change the following to match your own
installation:
POSTGRESDIR
If you switch on the USE_TCL option, you will need to set these:
TCL_INCDIR=
TCL_LIBDIR=
TCL_LIB=
TK_INCDIR=
TK_LIBDIR=
TK_LIB=
X11_INCDIR=
X11_LIBDIR=
X11_LIB=
On my Slackware3.0 system, these are:
TCL_INCDIR= /usr/include/tcl
TCL_LIBDIR= /usr/lib
TCL_LIB= -ltcl
TK_INCDIR= /usr/include/tcl
TK_LIBDIR= /usr/lib
TK_LIB= -ltk
X11_INCDIR= /usr/include/X11
X11_LIBDIR= /usr/X386/lib
X11_LIB= -lX11
You may also make any other changes you need as documented in
the INSTALL file and in Makefile.global
1.2) Why do I get problems with missing libreadline?
Linux systems generally don't come with the GNU readline library
installed. Either ensure you do not activate the readline options
in src/Makefile.global or src/Makefile.custom or install the GNU
readline library.
Note that Debian Linux (like FreeBSD) does come with readline
installed.
1.3) [REDHAT] Why do I get problems with missing libdl and dlfcn.h?
This manifests itself as being unable to link with functions
such as dlopen(), dlclose(), etc. during the last phase of the
compilation.
The libdl library is used for dynamic linking of user-supplied
functions at run-time. For some reason this library was missed out
from the Redhat distribution. It seems that the latest Redhat 4.0
(Colgate) fixes this.
RedHat now have a new ld.so RPM package on their FTP site.
Simply grab:
ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/ld.so-1.7.14-4.i386.rpm
Install the RPM file in the usual way and off you go!
NOTE! You will have to re-run configure and do a make clean
after installing the library and before recompiling.
There has been one report of a corrupted system resulting from
programs accessing these libraries while updating them (not
altogether surprising). Consequently it is a good idea to reboot
the system before installing the new libraries and to
have as little running as possible during this upgrade. Going
into single-user mode is probably a good idea!
If you want to do it the hard way, you can obtain the library and the
header file from:
ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ld.so-1.7.14.tar.gz
Alternatively, you may find precompiled binaries in
distributions/debian/buzz/binary-i386/base/ld.so-1.7.14-4.deb
on the same site, or follow the instructions given for question 1.2 for
correcting the same error with early releases of Slackware 3.1.
Don't use this method unless you know what you are doing!
1.4) [SLACKWARE 3.1] Why do I get problems with missing libdl and dlfcn.h?
This manifests itself as being unable to link with functions
such as dlopen(), dlclose(), etc. during the last phase of the
compilation.
See the answer to question 1.3. Slackware up to version 3.0 was
supplied with this library and include file and they seem to be
back in again in the latest versions of 3.1, but the early 3.1
releases (before 9th September 1996) had them missing and many
CD-ROM versions will have been pressed from the first 3.1 releases.
There has been one report of a corrupted system resulting from
programs accessing these libraries while updating them (not
altogether surprising). Consequently it is a good idea to reboot
the system before installing the new libraries and to
have as little running as possible during this upgrade. Going
into single-user mode is probably a good idea!
The easiest fix is to obtain the file ldso.tgz from the a4 disk of
a more recent Slackware distribution and unpack this file
from the root (/) directory, then do
sh install/doinst.sh
to complete the installation. Follow this with
ldconfig
NOTE! You will have to re-run configure and do a make clean
after installing the library and before recompiling.
If you want to install manually, you must first install the file
dlfcn.h in /usr/include.
Second, install the file libdl.so.1.7.14 (or whatever the latest
release is) in /lib, then do:
cd /lib
ln -sf libdl.so.1.7.14 libdl.so.1
ln -sf libdl.so.1 libdl.so
On some systems (depending on your GCC configuration) it may be
necessary to do:
cd /usr/lib
ln -sf /lib/libdl.so .
Finally
ldconfig
NOTE! You will have to re-run configure and do a make clean
after installing the library and before recompiling.
1.5) My compile of the backend dies complaining about the include file
dlfcn.h missing
See the answer to question 1.3/1.4. Don't forget that if you are using
an a.out system you must first have installed the dld package
(which is not supplied with most a.out systems) to have dlfcn.h
at all. See Question 1.11.
1.6) GCC complains about an ignored option -fpic
Earlier versions of GCC accepted either -fpic or -fPIC.
It appears that more recent versions (V2.7.2?) require -fPIC.
If you are using an ELF version of Linux, this can safely be
ignored as -fPIC is the default.
You can correct this by editing src/Makefile.global and
changing CFLAGS_SL
1.7) I get warnings of the form
warning: cast from pointer to integer of different size
These were seen in earlier versions of Postgres95 and could
safely be ignored. PostgreSQL V6.0 should compile with no warnings
except those related to system header files (which can also
be safely ignored).
1.8) [SuSE-Linux 4.2-4.4] Where is curses and termcap?
SuSE-Linux 4.2 has ncurses but not curses. 4.4 appears to have both.
SuSE-Linux also has the termcap library is in /usr/lib/termcap
instead of in /usr/lib.
PostgreSQL (up to V6.0)
-----------------------
Set the value of CURSES_LIB in src/Makefile.custom to -lncurses
(or do this through the customize script).
Add the following line to src/Makefile.custom:
LDADD_BE+= -L/usr/lib/termcap
You may need to edit src/bin/psql/Makefile and change:
ifeq ($(PORTNAME), linux)
LD_ADD+=
to:
ifeq ($(PORTNAME), linux)
LD_ADD+= -ltermcap
PostgreSQL (V6.1)
-----------------
The configure script doesn't know to look in /usr/lib/termcap for
the termcap library, so you should specify this as one of the
library directories when asked for additional directories to
search.
If this doesn't work (I don't have SuSE to verify that it does)
then after running configure, you need to edit
src/Makefile.global and add -ltermcap to the LDFLAGS line
(after -lreadline). (Alternatively, you can modify
src/Makefile.custom before running configure.)
Some versions of SuSE provide only ncurses, so you may need
to force use of ncurses rather than curses by changing
-lcurses to -lncurses. (Reported true for SuSE 5.1)
1.9) Why do I get problems with ld.so?
If you get problems with ld.so, another library required under
ELF for dynamic loading, then you have messed up your installation
or (more likely) upgrade of Linux.
See the answers to Question 1.3/1.4. You may need to install
ld.so.x.y.z in /lib and run ldconfig.
The most recent stable release of the ld package is 1.7.14
At the time of writing, 1.8.x versions of ld are experimental.
1.10) Why do I get `yy_flush_buffer undefined' errors?
This isn't really Linux specific, but is common on older Linux
installations. You must have a recent version of flex (2.5.2 or later)
to compile PostgreSQL. Note that flex 2.5.3 has a bug: see
Question 3.4.
1.11) How do I compile PostgreSQL on an a.out system?
First, you must install the dld library. This may be obtained
from Sunsite as:
Linux/libs/dld.3.2.7.tar.gz
(ftp://sunsite.unc.edu/pub/Linux/libs/dld.3.2.7.tar.gz)
Second, add the following line to src/Makefile.custom:
LINUX_ELF=
(or use the customize script)
1.12) Why does make fail with:
yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
make: /usr/bin/make: cannot execute binary file
This was a problem in earlier versions of Postgres95. The default
for PostgreSQL is to use bison -y rather than yacc.
yacc is generally implemented as a script which invokes bison -y
For some reason (certain versions of make? certain versions of
bash?) make is unable to execute this script file.
To correct this, simply edit src/mk/port/postgres.mk.linux
and, at the end of the file, change:
# YACC = bison -y
to
YACC = bison -y
1.13) What are the references in X11_LIB to libsocket and libnsl in
src/Makefile.global?
This was a problem in 1.08 (they are Sun Solaris specific).
It is fixed in 1.09 and 6.0
1.14) [DEBIAN] Where is libtermcap?
Debian Linux comes without the termcap library and uses ncurses
(which uses terminfo instead). There is no need to change the
CURSES_LIB variable in src/bin/psql/Makefile since Debian provides
a link from libncurses to libcurses (unlike SuSE-Linux --- see
Question 1.8).
You may need to edit src/bin/psql/Makefile and comment out the
change:
ifeq ($(PORTNAME), linux)
LD_ADD+= -ltermcap
to:
ifeq ($(PORTNAME), linux)
LD_ADD+=
1.15) [REDHAT] Can I get PostgreSQL as an RPM?
Yes! Michal Mosiewicz <mimo@lodz.pdi.net>
(http://www.pdi.lodz.pl/~mimo) has kindly put together an RPM
for PostgreSQL V6.0 on Intel architectures which he has uploaded to
ftp://ftp.redhat.org/pub/Incoming/Postgres-6.0-1.i386.rpm
This is a pre-compiled version, the source RPM is on its
was as I write (3rd Feb 1997).
1.16) While trying to compile a development version under Linux, compilation
fails with a message like:
In file included from /usr/include/sys/sem.h:8,
from ipc.c:37:
/usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
....
make: *** [ipc.o] Error 1
The problem is that Linux provides no prototypes for these
inline functions. The solution is to go into the
.../src/backend/storage/ipc directory and edit the Makefile.
Change the line
CFLAGS+=$(INCLUDE_OPT)
to
CFLAGS+=$(INCLUDE_OPT) -Wno-error
Do the same in the ../src/backend/storage/lmgr directory.
1.17) When compiling postgres, gcc reports signal 11 and aborts.
More specifically:
gcc: Internal compiler error: program cc1 got fatal
signal 11
This may be a hardware/memory problem. PortgreSQL is a big
program, and large gcc compilations (such as building
PostgreSQL or bebuilding the kernel) stress memory like
few other programs, resulting in errors that do not occur
in normal operation. Lesser operating systems are also
unlikely to stress the hardware to this degree so you
may never see any problems under DOS/Windows.
More information on this problem at:
http://www.bitwizard.nl/sig11
From this Sig11 FAQ, there appears to be a specific problem
with Redhat 5.0 gcc running on Cyrix processors. See the
URL above for more details!
1.18) Can I install 6.1.1 under MkLinux?
Tatsuo Ishii <t-ishii@sra.co.jp> has done this under
MkLinux DR2.1 update2 after a small patch available from:
ftp://ftp.sra.co.jp/pub/cmd/postgres/6.1.1/mklinux.patch.gz
1.19) Why does make exit or crash?
There have been a couple of reports of gmake either just
exiting early or seg faulting. The latter problem was reported
with gmake 3.74 - upgrading to 3.76.1 solved the problem.
However, 3.74 is known to work fine in other people's setups.
In short, try upgrading gmake to the latest version you can
find before reporting this as a problem
1.20) How can I optimise for 486 or pentium processors
The default compiler flags perform no optimisation for 486
or Pentium processors. To add such optimisation, edit
Makefile.custom and add:
CFLAGS+= -m486
or (for the new compilers that most people are not yet running)
CFLAGS+= -mpentium
or
CFLAGS+= -mpentiumpro
1.21) Why do I get strange results with printing times (for example
in the regression test 'timespan')?
The times are appearing as: '4 hours 59 mins 60.00 secs'
instead of '5 hours'
This is a problem with the glibc2 library which comes with
Redhat 5.0. Update your glibc to the latest RedHat version
for v5.0/hurricane. Anything prior to glibc-2.0.7 is likely
to have the problem.
1.22) Why don't I get any shared libraries for libpq when I compile
6.3.2?
There was some last minute breakage of the Linux configuration for
v6.3.2. Look in ftp://postgresql.org/pub/patches/ for a few fix-ups,
including a linux_elf patch.
1.23) Why does the compile fail with messages about F_BOOLIN, F_BOOLOUT
and F_BYTEAIN being undeclared?
The actual messages are something like:
-I/usr/include/readline -O2 -Wall -Wmissing-prototypes -I..
-Wno-error -c bootstrap.c -o bootstrap.o
bootstrap.c:160: `F_BOOLIN' undeclared here (not in a function)
bootstrap.c:160: initializer element for `Procid[0].inproc' is not
constant
bootstrap.c:160: `F_BOOLOUT' undeclared here (not in a function)
bootstrap.c:160: initializer element for `Procid[0].outproc' is not
constant
bootstrap.c:161: `F_BYTEAIN' undeclared here (not in a function)
bootstrap.c:161: initializer element for `Procid[1].inproc' is not
constant
This is tricky unless you know why it happens, as these constants
don't seem to be defined anywhere.
The solution is to make sure that cpp is included in your path
before you start the make.
On Redhat 5.1, cpp is in /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3
----------------------------------------------------------------------
Section 2: Compiling accessory programs
----------------------------------------------------------------------
2.1) The linker fails to find libX11 when compiling pgtclsh
Add the following to src/Makefile.custom
X11_LIBDIR = /usr/X11R6/lib
----------------------------------------------------------------------
Section 3: Runtime Problems
----------------------------------------------------------------------
3.1) I get an error reporting _fUnKy_POSTPORT_sTuFf_ undefined when
running scripts like createuser
This is a bug in V1.06-V1.07 of Postgres and is fixed in V1.08
and above.
3.2) I run postmaster and after that system says 'Bad system call(Core
dumped)'
This indicates that you have not compiled shared memory support
into your kernel. You need to recompile the Linux kernel to add this
feature.
3.3) When I try to start the Postmaster, why do I get an error of the form
Failed Assertion("!(file != 0):(null)", File:
"/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
!(file != 0) (0)
initdb: could not create template database
initdb: cleaning up.
Your permissions on the file /dev/null are wrong.
ls -l /dev/null should give you something like:
crw-rw-rw- 1 root wheel 2, 2 Oct 8 18:41 /dev/null
Correct the permissions using:
chmod a+rw /dev/null
3.4) Why doesn't createuser work?
There is a problem with Version 2.5.3 of GNU flex and createuser.
Your options are to downgrade flex to V2.5.2, upgrade to V2.5.4
or apply a patch to V2.5.3 which is supplied in doc/README.flex
You may obtain V2.5.4 from
ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz
3.5) Why do I get an error like:
IpcMemoryCreate: memKey=155356396 , size=760632 ,
permission=384IpcMemoryCreate: shmget(..., create, ...)
failed: Invalid argument
You haven't build IPC support into your Linux kernel. You
will have to rebuild the kernel and switch on this option.
3.6) Why does psql fail with:
psql: can't load library 'libpq.so.1'
Psql has been compiled to link dynamically with the libpq
library.
To solve this, you should log in as root and edit the file
/etc/ld.so.conf
Add a single line at the end which gives the name of the
PostgreSQL library directory (the lib subdirectory of your
PostgreSQL installation) and run
/sbin/ldconfig -v
Alternatively, (and if you don't have root access), you may
use the LD_LIBRARY_PATH environment variable.
The LD_LIBRARY_PATH variable contains a colon separated list of
paths to be searched for shared libraries. This list is
searched before the libraries specified by ldconfig.
Therefore under Bash, you would do something like:
export LD_LIBRARY_PATH='PathToPGSQL'/lib
or, using tcsh
setenv LD_LIBRARY_PATH 'PathToPGSQL'/lib
replacing 'PathToPGSQL' with the appropriate path to your top level
PostgreSQL directory
Note that the ldd command can be used on a dynamically linked
executable to list the paths to all the shared libraries upon
which the executable depends.
3.7) Other strange behaviour
I'm not sure what the symptoms might be except for nothing
working properly, but it has been pointed out that one needs
to be careful that the dynamic loader loads the correct version
of the libpq library. If you have old versions lying around
in your library path (for example in /usr/lib) these may get
loaded instead of the new version you intended to load. Make
sure you get them out of the way and look at Q3.6 for
details of loading libraries.
3.8) When PostgreSQL is running when the system is shutdown, Linux
always fsck's the disk when rebooted.
There have been some reports of this happening and it seems
to be a result of running PostgreSQL from /etc/inittab as
suggested in the INSTALL document.
You are therefore recommended to start the postmaster from an
rc script. Under a Slackware-like release, you would modify
/etc/rc.d/rc.local to start the postmaster. Under a RedHat-like
release you should create a SysV style script in
/etc/rc.d/rc3.d based on the /etc/rc.d/init.d skeleton file.
There's a sample file in contrib/linux/postgres.init
Here's another sample file supplied by John Robinson
<john@intelligent.co.uk> which you should modify as needed:
#!/bin/sh
#
# postgreSQL.init This shell script takes care of starting and stopping
# the PostgreSQL postmaster.
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting postgres Postmaster daemon:"
if [ -z "`pidofproc postmaster`" ]
then
su postgres -c "/usr/local/pgsql/bin/postmaster -D /home/postgreSQL/data -p 5432 &"
echo -n " postmaster"
else
echo -n " (already running)"
fi
echo
touch /var/lock/subsys/postgres
;;
stop)
# Stop daemons.
echo -n "Shutting down postgres Postmaster daemon: "
killall -TERM postmaster 2>/dev/null
killall -TERM postgres 2>/dev/null
echo
rm -f /var/lock/subsys/postgres
;;
*)
echo "Usage: postgres {start|stop}"
exit 1
esac
exit 0
3.9) Why does Query 32 in the regression tests take so long?
This is due to a bug in regression scripts which only happens
on linux boxes. There are two workarounds as far as I know
(information from Tatsuo Ishii <t-ishii@sra.co.jp>):
1. change following in regress.sh:
time postgres -texecutor -tplanner -Q bench < bench.sql
to:
postgres -texecutor -tplanner -Q bench < bench.sql
2. after running the test, remove a line at the very end of
bench.out something like:
85.86user 114.47system 4:49.20elapsed 69%CPU (0avgtext+0avgdata 0maxresident)k
then type:
sh ./perquery < bench.out > & bench.out.perquery
3.10) Why do I get funny rounding results in some date/time arithmetic,
such as
select '4 hours'::timespan;
returning '3 hours 59 minutes 60 seconds'?
You are running the new glibc2 libraries and have a version earlier than
2.0.7. It is a math rounding problem in the library. Upgrade your library.
----------------------------------------------------------------------------
Dr. Andrew C.R. Martin University College London
EMAIL: (Work) martin@biochem.ucl.ac.uk (Home) andrew@stagleys.demon.co.uk
URL: http://www.biochem.ucl.ac.uk/~martin
Tel: (Work) +44(0)171 419 3890 (Home) +44(0)1372 275775
</PRE>
<HTML>
<HEAD>
<TITLE>Linux PostgreSQL FAQ (german)</TITLE>
<META NAME="Author" CONTENT="Karsten Schulz">
<META NAME="GENERATOR" CONTENT="all pages hand-made by Karsten Schulz, using NEdit (Linux)">
<META http-equiv="content-type" CONTENT="text/html;CHARSET=iso8859-1">
<META NAME="robots" CONTENT="index">
<META NAME="robots" CONTENT="follow">
<META NAME="description" CONTENT="Die deutsche &Uuml;bersetzung der Linux-spezifischen FAQ zum Datenbanksystem PostgreSQL">
<META NAME="keywords" CONTENT="Linux, FAQ, DB, PostgreSQL, SQL, deutsch, german">
<LINK REV=MADE HREF="mailto:schulz@Linux-Systemhaus.de" TITLE="Karsten Schulz">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER><H1>H&auml;ufig gestellte Fragen (FAQ) zu PostgreSQL &gt;= V6.1, Linux-spezifisch</H1>
<STRONG>Bitte Zusammen mit der normalen FAQ lesen!</STRONG></CENTER>
<HR>
<TABLE BORDER=0>
<TR>
<TD>Letztes Update des Originals:</TD>
<TD>Tue Aug 10 11:15:00 BST 1999</TD>
</TR>
<TR>
<TD>Original-FAQ gepflegt durch:</TD>
<TD>Andrew C.R. Martin (<A HREF="mailto:martin@biochem.ucl.ac.uk">martin@biochem.ucl.ac.uk</A>)</TD>
</TR>
<TR>
<TD>Original Autor:</TD>
<TD>Andrew C.R. Martin (<A HREF="mailto:martin@biochem.ucl.ac.uk">martin@biochem.ucl.ac.uk</A>)</TD>
</TR>
<TR>
<TD COLSPAN=2>&nbsp;</TD>
</TR>
<TR>
<TD>Letztes Update der &Uuml;bersetzung:</TD>
<TD>Mo, 23. August 1999, 10:00 CEST</TD>
</TR>
<TR>
<TD>&Uuml;bersetzer:</TD>
<TD>Karsten Schulz (<A HREF="mailto:schulz@linux-systemhaus.de">schulz@linux-systemhaus.de</A>)</TD>
</TR>
</TABLE>
<HR>
<P>
&Auml;nderungen in dieser Version (* = ge&auml;ndert, + = neu, - = entfernt)
<P>
<A HREF="#3.11">+3.11)</A> Wieso bekomme ich einen Fehler wie: <EM>IpcMemoryCreate: shmget failed (Permission denied)</EM>?<BR>
<H2>Diese Datei ist ungef&auml;hr wie folgt unterteilt:</H2>
<A HREF="#1.">1.*)</A> PostgreSQL kompilieren<BR>
<A HREF="#2.">2.*)</A> Hilfs- und Zusatzprogramme kompilieren<BR>
<A HREF="#3.">3.*)</A> Laufzeit Probleme<BR>
<P><BR>
<H2>Beantwortete Fragen:</H2>
<A NAME="1.">&nbsp;</A><H3><A HREF="#Sec1">PostgreSQL kompilieren</A></H3>
<A HREF="#1.1">1.1)</A> Welche Anpassungen m&uuml;ssen in src/Makefile.global oder src/Makefile.custom gemacht werden
und gibt es weitere notwendige &Auml;nderungen?<BR>
<A HREF="#1.2">1.2)</A> Warum habe ich Probleme mit der fehlenden Bibliothek libreadline?<BR>
<A HREF="#1.3">1.3)</A> [REDHAT] Warum habe ich Probleme mit der fehlenden Bibliothek libdl und der fehlenden dlfcn.h?<BR>
<A HREF="#1.4">1.4)</A> [SLACKWARE 3.1] Warum habe ich Probleme mit der fehlenden Bibliothek libdl und der fehlenden dlfcn.h?<BR>
<A HREF="#1.5">1.5)</A> Die Kompilierung des Backends schl&auml;gt mit der Meldung fehl, da&szlig; die Include-Datei dlfcn.h fehlen w&uuml;rde.<BR>
<A HREF="#1.6">1.6)</A> GCC meldet, da&szlig; er die Option -fpic ignorieren w&uuml;rde.<BR>
<A HREF="#1.7">1.7)</A> Ich bekomme Warnungen, wie: <EM>warning: cast from pointer to integer of different size</EM><BR>
<A HREF="#1.8">1.8)</A> [SuSE-Linux 4.2-5.3] Wo sind curses und termcap?<BR>
<A HREF="#1.9">1.9)</A> Warum bekomme ich Probleme mit ld.so?<BR>
<A HREF="#1.10">1.10)</A> Wieso bekomme ich <EM>yy_flush_buffer undefined</EM> Fehler?<BR>
<A HREF="#1.11">1.11)</A> Wie kompiliere ich PostgreSQL auf einem a.out System?<BR>
<A HREF="#1.12">1.12)</A> Warum scheitert make mit der Meldung:<BR><EM>
yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
make: /usr/bin/make: cannot execute binary file</EM><BR>
<A HREF="#1.13">1.13)</A> Was sind die Bez&uuml;ge in der Bibliothek X11_LIB zu libsocket und libnsl in der Datei src/Makefile.global?<BR>
<A HREF="#1.14">1.14)</A> [DEBIAN] Wo ist die Bibliothek libtermcap?<BR>
<A HREF="#1.15">1.15)</A> [REDHAT] Kann ich PostgreSQL als RPM-Archiv bekommen?<BR>
<A HREF="#1.16">1.16)</A> W&auml;hrend ich versuche eine Entwickler-Version unter Linux zu kompilieren, bricht der Vorgang mit folgender
Fehlermeldung ab:<BR><EM>
In file included from /usr/include/sys/sem.h:8,<BR>
from ipc.c:37:<BR>
/usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'<BR>
....<BR>
make: *** [ipc.o] Error 1</EM><BR>
<A HREF="#1.17">1.17)</A> Beim Kompilieren von PostgreSQL bricht der gcc mit einer Signal 11 Meldung ab.<BR>
<A HREF="#1.18">1.18)</A> Kann ich Version 6.1.1 unter MkLinux installieren?<BR>
<A HREF="#1.19">1.19)</A> Warum stoppt make oder bricht sonstwie ab?<BR>
<A HREF="#1.20">1.20)</A> Wie kann ich f&uuml;r die Prozessoren 486 oder Pentium optimieren?<BR>
<A HREF="#1.21">1.21)</A> Wieso bekomme ich seltsame Ergebnisse beim Drucken von Zeiten (z.B. beim Regressionstest 'timespan')?<BR>
<A HREF="#1.22">1.22)</A> Warum bekomme ich keine shared libraries f&uuml;r libpq, wenn ich Version 6.3.2 kompiliere?<BR>
<A HREF="#1.23">1.23)</A> Warum scheitert der Kompilierungslauf mit Nachrichten, da&szlig; F_BOOLIN, F_BOOLOUT und F_BYTEAIN nicht deklariert seien?<BR>
<P>
<A NAME="2.">&nbsp;</A><H3><A HREF="#Sec2">Hilfs- und Zusatzprogramme kompilieren</A></H3>
<A HREF="#2.1">2.1)</A> Der Linker findet die Bibliothek libX11 nicht, wenn pgtclsh kompiliert werden soll.<BR>
<A NAME="3.">&nbsp;</A><H3><A HREF="#Sec3">Laufzeit Probleme</A></H3>
<A HREF="#3.1">3.1)</A> Ich bekomme die Fehlermeldung <EM>_fUnKy_POSTPORT_sTuFf_ undefined</EM>, wenn Skripts wie createuser laufen.<BR>
<A HREF="#3.2">3.2)</A> Nachdem ich postmaster starte, meldet das System <EM>Bad system call (Core dumped)</EM><BR>
<A HREF="#3.3">3.3)</A> Wenn ich versuche, den Postmaster zu starten, bekomme ich eine Fehlermeldung wie:<BR><EM>
Failed Assertion("!(file != 0):(null)", File:<BR>
"/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)<BR>
!(file != 0) (0)<BR>
initdb: could not create template database<BR>
initdb: cleaning up.</EM><BR>
<A HREF="#3.4">3.4)</A> Warum funktioniert createuser nicht?<BR>
<A HREF="#3.5">3.5)</A> Wieso bekomme ich einen Fehler, wie:<BR><EM>
IpcMemoryCreate: memKey=155356396 , size=760632 ,<BR>
permission=384IpcMemoryCreate: shmget(..., create, ...)<BR>
failed: Invalid argument</EM><BR>
<A HREF="#3.6">3.6)</A> Wieso scheitert der Aufruf von psql mit: <EM>psql: can't load library 'libpq.so.1</EM><BR>
<A HREF="#3.7">3.7)</A> Andere seltsame Verhaltensweisen<BR>
<A HREF="#3.8">3.8)</A> Wenn PostgreSQL beim Systemhalt lief, f&uuml;hrt Linux beim Neustart jedesmal einen Filesystemcheck (fsck) durch<BR>
<A HREF="#3.9">3.9)</A> Warum dauert Query 32 in den RegressionsTests so lange?<BR>
<A HREF="#3.10">3.10)</A> Warum bekomme ich lustige Rundungsergebnisse in einigen Datums/Zeit-Berechnungen, wie:<BR><EM>
select '4 hours'::timespan;<BR>
liefert '3 hours 59 minutes 60 seconds'</EM>?<BR>
<A HREF="#3.11">+3.11)</A> Wieso bekomme ich einen Fehler wie: <EM>IpcMemoryCreate: shmget failed (Permission denied)</EM>?<BR>
<P>
<H3><A NAME="Sec1">Abschnitt 1: PostgreSQL kompilieren</A></H3>
<H4><A NAME="1.1">1.1)</A> Welche Anpassungen m&uuml;ssen in src/Makefile.global oder src/Makefile.custom gemacht werden
und gibt es weitere notwendige &Auml;nderungen?</H4>
&Auml;nderungen an den Makefiles werden am einfachsten dadurch gemacht, indem das <EM>customize shellscript</EM>
im src-Verzeichnis aufgerufen wird, das ein Makefile.custom erzeugt.
<P>
Die einzige andere &Auml;nderung, die evtl. zu machen w&auml;re, ist Flex zu ersetzen, wenn Du die Version 2.5.3 hast.
Diese Version hat einen Fehler, der sich durch das Scheitern des createuser-Programms &auml;u&szlig;ert.
(siehe dazu auch <A HREF="#3.4">Frage 3.4</A>).
<P>
Falls Du die Makefiles manuell &auml;nderst, <STRONG>musst</STRONG> Du die
folgende Variable setzen:<BR><BR>
<PRE>
PORTNAME= linux
</PRE>
Du musst auch die folgende Variable &auml;ndern, damit sie auf Deine
Installation passt:
<PRE>
POSTGRESDIR
</PRE>
Falls Du die <EM>USE_TCL</EM>-Option aktivierst, musst Du folgende Variablen setzen:<BR><BR>
<PRE>
TCL_INCDIR=
TCL_LIBDIR=
TCL_LIB=
TK_INCDIR=
TK_LIBDIR=
TK_LIB=
X11_INCDIR=
X11_LIBDIR=
X11_LIB=
</PRE>
Auf meinem Slackware 3.0 System sind das:
<PRE>
TCL_INCDIR= /usr/include/tcl
TCL_LIBDIR= /usr/lib
TCL_LIB= -ltcl
TK_INCDIR= /usr/include/tcl
TK_LIBDIR= /usr/lib
TK_LIB= -ltk
X11_INCDIR= /usr/include/X11
X11_LIBDIR= /usr/X386/lib
X11_LIB= -lX11
</PRE>
<P>
Du solltest auch alle weiteren &Auml;nderungen durchf&uuml;hren, die in der
Datei INSTALL und in Makefile.global dokumentiert sind.
<H4><A NAME="1.2">1.2)</A> Warum habe ich Probleme mit der fehlenden Bibliothek libreadline?</H4>
Linux Systeme kommen in der Regel nicht mit einer installierten GNU readline Bibliothek.
Stelle entweder sicher, da&szlig; Du die readline-Optionen in src/Makefile.global oder
src/Makefile.custom nicht aktivierst oder installiere die GNU readline Bibliothek.<BR>
Hinweis: Debian Linux (wie FreeBSD) kommt mit einer installierten GNU readline Bibliothek.
<H4><A NAME="1.3">1.3)</A> [REDHAT] Warum habe ich Probleme mit der fehlenden Bibliothek libdl und der fehlenden dlfcn.h?</H4>
Das Problem erscheint dadurch, da&szlig; in der letzten Phase des Kompilierungsvorgangs Funktionen wie
dlopen(), dlclose(), etc. nicht gelinkt werden k&ouml;nnen.
<P>
Die libdl Bibliothek wird zum dynamischen Linken von Benutzerfunktionen zur Laufzeit
benutzt. Aus irgendwelchen Gr&uuml;nden wurde diese Bibliothek mit der RedHat-Distribution
nicht ausgeliefert. Anscheinend ist dies in der letzten RedHat 4.0 (Colgate) ge&auml;ndert worden.
<P>
RedHat hat nun ein neues ld.so RPM-Archiv auf ihrem ftp-Server. Hole Dir einfach:
<P>
<A HREF="ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/">ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/ld.so-1.7.14-4.i386.rpm</A>
<P>
Installiere das RPM-Archiv wie &uuml;blich und gut ist!
<P>
Hinweis: Du mu&szlig;t <EM>configure</EM> und <EM>make clean</EM> nach der Installation
der Bibliothek und vor dem erneuten Kompilieren laufen lassen.
<P>
Es gab einen Bericht &uuml;ber ein zerst&ouml;rtes System, weil Programme auf
diese Bibliothek w&auml;hrend des Updates zugegriffen haben (alles in allem nicht
weiter &uuml;berraschend). Konsequenterweise ist es eine gute Idee, das System vor der
Installation zu rebooten, um so wenige Programme wie m&ouml;glich w&auml;hrend
des Updates laufen zu haben. In den Single-User-Mode zu gehen ist wahrscheinlich
auch eine gute Idee!
<P>
Wenn Du lieber den harten Weg gehen willst, kannst Du die Bibliothek und
die Header-Dateien von:
<P>
<A HREF="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/">ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ld.so-1.7.14.tar.gz</A>
<P>
holen. Alternativ findest Du vorkompilierte Binaries in
distributions/debian/buzz/binary-i386/base/ld.so-1.7.14-4.deb auf dem gleichen
ftp-Server oder folge den Instruktionen bei <A HREF="#1.2">Frage 1.2</A>, die den gleichen Fehler
f&uuml;r Slackware 3.1 behandelt.
<P>
Mache es aber nur auf diese Weise, wenn Du wei&szlig;t, was Du tust!
<H4><A NAME="1.4">1.4)</A> [SLACKWARE 3.1] Warum habe ich Probleme mit der fehlenden Bibliothek libdl und der fehlenden dlfcn.h?</H4>
Das Problem erscheint dadurch, da&szlig; in der letzten Phase des Kompilierungsvorgangs Funktionen wie
dlopen(), dlclose(), etc. nicht gelinkt werden k&ouml;nnen.
<P>
Siehe die Antwort zu <A HREF="#1.3">Frage 1.3</A>.
<P>
Slackware bis Version 3.0 war mit dieser Bibliothek und der Include-Datei ausgestattet und ab sp&auml;ten
3.1er-Versionen scheinen sie auch wieder da zu sein. Aber in fr&uuml;hen 3.1er-Versionen (vor dem 09.09.96)
fehlten sie und es wurden viele CD-ROMs von diesen ersten 3.1.er-Versionen gepresst.
<P>
Es gab einen Bericht &uuml;ber ein zerst&ouml;rtes System, weil Programme auf
diese Bibliothek w&auml;hrend des Updates zugegriffen haben (alles in allem nicht
weiter &uuml;berraschend). Konsequenterweise ist es eine gute Idee, das System vor der
Installation zu rebooten, um so wenige Programme wie m&ouml;glich w&auml;hrend
des Updates laufen zu haben. In den Single-User-Mode zu gehen ist wahrscheinlich
auch eine gute Idee!
<P>
Der einfachste Weg, den Fehler zu beseitigen ist, die Datei ldso.tgz von der a4-Diskette einer
aktuelleren Slackware zu nehmen, diese Datei im Wurzelverzeichnis (/) zu entpacken und dann ein
<PRE>sh install/doinst.sh</PRE>
durchzuf&uuml;hren. Danach ein <PRE>ldconfig</PRE>durchf&uuml;hren.
<P>
Hinweis: Du mu&szlig;t <EM>configure</EM> und <EM>make clean</EM> nach der Installation
der Bibliothek und vor dem erneuten Kompilieren laufen lassen.
<P>
Falls Du manuell installieren m&ouml;chtest, installiere zuerst die Datei dlfcn.h in /usr/include.
Dann die libdl.so.1.7.14 (oder was immer die letzte Version ist) in /lib. Dann f&uuml;hre
folgende Befehle aus:
<PRE>
cd /lib
ln -sf libdl.so.1.7.14 libdl.so.1
ln -sf libdl.so.1 libdl.so
</PRE>
Auf manchen Systemen (je nach Deiner gcc-Konfiguration) k&ouml;nnen noch folgende
Befehle notwendig sein:
<PRE>
cd /usr/lib
ln -sf /lib/libdl.so .
</PRE>
Und zum Schlu&szlig; noch ein <PRE>ldconfig</PRE>
<P>
Hinweis: Du mu&szlig;t <EM>configure</EM> und <EM>make clean</EM> nach der Installation
der Bibliothek und vor dem erneuten Kompilieren laufen lassen.
<H4><A NAME="1.5">1.5)</A> Die Kompilierung des Backends schl&auml;gt mit der Meldung fehl, da&szlig; die Include-Datei dlfcn.h fehlen w&uuml;rde.</H4>
Siehe die Antworten zu den Fragen <A HREF="#1.3">1.3</A> und <A HREF="#1.4">1.4</A>.
Und vergiss nicht, falls Du ein a.out-System benutzt, da&szlig; Du das dld-Paket installiert haben mu&szlig;
(welches bei den meisten a.out-Systemen nicht dabei ist), um dlfcn.h zu haben. Siehe <A HREF="#1.11">Frage 1.11</A>.
<H4><A NAME="1.6">1.6)</A> GCC meldet, da&szlig; er die Option -fpic ignorieren w&uuml;rde.</H4>
Fr&uuml;here Versionen des gcc nahmen entweder <CODE>-fpic</CODE> oder <CODE>-fPIC</CODE> an.
Es scheint, da&szlig; neuere Versionen (V2.7.2?) <CODE>-fPIC</CODE> erfordern.
Falls Du ein ELF-System benutzt, kannst das alles ignoriert werden, da <CODE>-fPIC</CODE>
als Standardvorgabe voreingestellt ist.
Du kannst diese Angabe korrigieren, indem Du CFLAGS_SL in der Datei src/Makefile.global
&auml;nderst.
<H4><A NAME="1.7">1.7)</A> Ich bekomme Warnungen, wie: <EM>warning: cast from pointer to integer of different size</EM></H4>
Diese Warnungen wurden in fr&uuml;heren Versionen von Postgres95 gesichtet und k&ouml;nnen ignoriert werden.
PostgreSQL V6.0 sollte ohne Warnungen kompiliert werden, au&szlig;er jenen, die sich auf System-Header-Dateien beziehen
(welche auch ignoriert werden k&ouml;nnen).
<H4><A NAME="1.8">1.8)</A> [SuSE-Linux 4.2-5.3] Wo sind curses und termcap?</H4>
SuSE-Linux 4.2 hat ncurses, nicht curses. Version 4.4 scheint beide Bibliotheken zu haben.
Bei SuSE-Linux ist au&szlig;erdem die termcap-Bibliothek in /usr/lib/termcap/ und nicht in /usr/lib.
<H5>PostgreSQL (bis Version V6.0)</H5>
Setze den Wert f&uuml;r CURSES_LIB in src/Makefile.custom auf -lncurses (oder erledige das durch das <EM>customize script</EM>.
F&uuml;ge folgende Zeile zur Datei src/Makefile.custom hinzu:
<PRE>
LDADD_BE+= -L/usr/lib/termcap
</PRE>
M&ouml;glicherweise mu&szlig;t Du in der Datei src/bin/psql/Makefile folgende &Auml;nderung durchf&uuml;hren:
<PRE>
ifeq ($(PORTNAME), linux)
LD_ADD+=
</PRE>
&auml;ndern in:
<PRE>
ifeq ($(PORTNAME), linux)
LD_ADD+= -ltermcap
</PRE>
<H5>PostgreSQL (V6.1)</H5>
Das Konfigurationsscript wei&szlig; nicht, da&szlig; es auch in /usr/lib/termcap nach der termcap-Bibliothek schauen soll.
Du solltest dieses Verzeichnis angeben, wenn es nach zus&auml;tzlichen Such-Verzeichnissen fragt.
<P>
Falls das nicht funkitoniert (Ich habe SuSE nicht, um das zu testen), dann solltest Du nach dem <EM>./configure</EM>-Lauf
die Datei src/Makefile.global &auml;ndern und in die LDFLAGS-Zeile den Eintrag -ltermcap (nach -lreadline) hinzuf&uuml;gen.
(Alternativ kannst Du auch die Datei src/Makefile.custom &auml;ndern, bevor Du <EM>./configure</EM> aufrufst.)
<P>
Einige SuSE-Versionen liefern nur ncurses, deshalb kann es sein, da&szlig; Du die
Benutzung von ncurses statt curses erzwingen mu&szlig;t, indem Du -lcurses in -lncurses &auml;nderst.
(best&auml;tigt f&uuml;r SuSE 5.1)
<P>
<H5>PostgreSQL (V6.4)</H5>
In PostgreSQL V6.4 &uuml;berpr&uuml;ft <CODE>configure</CODE> sowohl das Vorhandensein von
curses, als auch das von ncurses.
In der Zwischenzeit kannst Du den patch von <A HREF="mailto:ke@suse.de">Karl Eichwalder (ke@suse.de)</A>
anwenden:
<P>
<A HREF="http://www.PostgreSQL.ORG/mhonarc/pgsql-patches/msg00407.html">http://www.PostgreSQL.ORG/mhonarc/pgsql-patches/msg00407.html</A><BR>
oder (mit deutschen Bemerkungen):<BR>
<A HREF="http://www.suse.de/Support/sdb/ke_postgresql-632.html">http://www.suse.de/Support/sdb/ke_postgresql-632.html</A>
<P>
Es gab au&szlig;erdem einen Bericht, da&szlig; beim Update von SuSE 5.0 auf SuSE 5.2 der Link
von libtermcap.so.2.0.8 auf libtermcap.so nicht gesetzt wurde:
<PRE>
cd /usr/lib
ln -s libtermcap.so.2.0.8 libtermcap.so
</PRE>
<H4><A NAME="1.9">1.9)</A> Warum bekomme ich Probleme mit ld.so?</H4>
Falls Du Probleme mit ld.so bekommst - eine andere Bibliothek, die im ELF-System f&uuml;r dynamisches Laden
ben&ouml;tigt wird - dann hast Du Deine Systeminstallation oder wahrscheinlicher ein Linux-Update durcheinandergebracht
Siehe die Fragen <A HREF="#1.3">1.3</A>/<A HREF="#1.4">1.4</A>. M&ouml;glicherweise mu&szlig;t Du ld.so.x.y.z in /lib installieren
und ldconfig laufen lassen. Die aktuellste Version des ld-Packages ist 1.7.14. Zum Zeitpunkt des Schreibens dieser FAQ ist die Version 1.8 noch experimental.
<H4><A NAME="1.10">1.10)</A> Wieso bekomme ich <EM>yy_flush_buffer undefined</EM> Fehler?</H4>
Das ist nicht wirklich Linux-spezifisch, aber es tritt h&auml;ufiger auf alten Linux-Systemen auf.
Du brauchst eine aktuelle Version von flex (2.5.2. oder neuer), um PostgreSQL zu kompilieren. Beachte, da&szlig; flex 2.5.3.
einen Bug hat, siehe auch <A HREF="3.4">Frage 3.4</A>.
<H4><A NAME="1.11">1.11)</A> Wie kompiliere ich PostgreSQL auf einem a.out System?</H4>
Als erstes mu&szlig;t Du die dld-Bibliothek installieren. Diese gibt es auf Sunsite unter
Linux/libs/dld.3.2.7.tar.gz (<A HREF="ftp://sunsite.unc.edu/pub/Linux/libs/">ftp://sunsite.unc.edu/pub/Linux/libs/dld.3.2.7.tar.gz</A>).
<P>
Dann f&uuml;ge folgende Zeile in src/Makefile.custom hinzu:
<PRE>
LINUX_ELF=
</PRE>
oder benutze das <EM>customize Skript</EM>
<H4><A NAME="1.12">1.12)</A> Warum scheitert make mit der Meldung:<BR><EM>
yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
make: /usr/bin/make: cannot execute binary file</EM></H4>
Das war ein Problem in fr&uuml;hreren Versionen von Postgres95. Standardm&auml;&szlig;ig benutzt PostgreSQL <CODE>bison -y</CODE>
anstatt <CODE>yacc</CODE>.
<P>
yacc ist normalerweise als Skript implementiert, das <CODE>bison -y</CODE> aufruft. Aus verschiedenen Gr&uuml;nden ist
<EM>make</EM> nicht in der Lage, das Skript auszuf&uuml;hren (verschiedene Versionen von make? Verschiedene Versionen der bash?)
<P>
Um das zu beheben, &auml;ndere einfach die Datei src/mk/port/postgres.mk.linux am Ende. Die Zeile:
<PRE>
# YACC = bison -y
</PRE>
wird zu:
<PRE>
YACC = bison -y
</PRE>
<H4><A NAME="1.13">1.13)</A> Was sind die Bez&uuml;ge in der Bibliothek X11_LIB zu libsocket und libnsl in der Datei src/Makefile.global?</H4>
Das war ein Problem in Version 1.08 (Sun Solaris spezifisch). Sie sind behoben in 1.09 und 6.0
<H4><A NAME="1.14">1.14)</A> [DEBIAN] Wo ist die Bibliothek libtermcap?</H4>
Debian Linux kommt ohne die termcap-Bibliothek und benutzt ncurses (welche terminfo benutzt).
Es gibt keinen Grund, die CURSES_LIB-Variable in src/bin/psql/Makefile zu &auml;ndern, da Debian
einen Link von libncurses auf libcurses bereitstellt (im Gegensatz zu SuSE, siehe <A HREF="1.8">Frage 1.8</A>)
<P>
Du kannst die Datei src/bin/psql/Makefile wie folgt &auml;ndern:
<PRE>
ifeq ($(PORTNAME), linux)
LD_ADD+= -ltermcap
</PRE>
in
<PRE>
ifeq ($(PORTNAME), linux)
LD_ADD+=
</PRE>
<H4><A NAME="1.15">1.15)</A> [REDHAT] Kann ich PostgreSQL als RPM-Archiv bekommen?</H4>
Ja! <A HREF="mailto:mimo@lodz.pdi.net">Michal Mosiewicz</A> (<A HREF="http://www.pdi.lodz.pl/~mimo">http://www.pdi.lodz.pl/~mimo</A>)
hat ein RPM f&uuml;r PostgreSQL V6.0 auf Intel Architekturen zusammengestellt,
welches er nach <A HREF="ftp://ftp.redhat.org/pub/Incoming/">ftp://ftp.redhat.org/pub/Incoming/Postgres-6.0-1.i386.rpm</A>
hochgeladen hat.
<P>
Das ist eine vorkompilierte Version, das Quelltext-RPM stammt vom 03.02.1997.
<H4><A NAME="1.16">1.16)</A> W&auml;hrend ich versuche eine Entwickler-Version unter Linux zu kompilieren, bricht der Vorgang mit folgender
Fehlermeldung ab:<BR><EM>
In file included from /usr/include/sys/sem.h:8,<BR>
from ipc.c:37:<BR>
/usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'<BR>
....<BR>
make: *** [ipc.o] Error 1</EM></H4>
Das Problem ist, da&szlig; Linux keine Prototypen f&uuml;r diese Inline-Funktionen bereith&auml;lt. Die L&ouml;sung
liegt darin, das Makefile in .../src/backend/storage/ipc/ zu &auml;ndern:
&Auml;ndere die Zeile:
<PRE>
CFLAGS+=$(INCLUDE_OPT)
</PRE>
in
<PRE>
CFLAGS+=$(INCLUDE_OPT) -Wno-error
</PRE>
Mache dasselbe dann im ../src/backend/storage/lmgr Verzeichnis.
<H4><A NAME="1.17">1.17)</A> Beim Kompilieren von PostgreSQL bricht der gcc mit einer Signal 11 Meldung ab.</H4>
Oder genauer: <EM>gcc: Internal compiler error: program cc1 got fatal signal 11</EM>
<P>
Das k&ouml;nnen Hardware/Speicherprobleme sein. PostgreSQL ist ein gro&szlig;es Programm und gro&szlig;e
gcc-Kompilierungsl&auml;fe (wie eben PostgreSQL oder eine Kernel-Kompilierung) beanspruchen den Hauptspeicher
wie wenig andere Programme. Dadurch k&ouml;nnen Fehler auftreten, die in normalen Situationen nicht erscheinen.
Niedrigere Betriebssysteme beanspruchen die Hardware ebenfalls nicht in diesem Ma&szlig;e, deshalb kann es sein, da&szlig; Du niemals
Probleme unter DOS/Windows siehst.
<P>
Mehr Information zu diesem Problem gibt es unter <A HREF="http://www.BitWizard.nl/sig11/">http://www.BitWizard.nl/sig11/</A> und
in deutsch unter <A HREF="http://www.suse.de/sdb/de/html/kfr_58.html">http://www.suse.de/sdb/de/html/kfr_58.html</A>.
<P>Laut dieser Sig11-FAQ scheint es ein spezielles Problem mit dem RedHat 5.0 gcc auf einem Cyrix-Prozessor zu geben.
Siehe bitte dort nach den Details nach.
<H4><A NAME="1.18">1.18)</A> Kann ich Version 6.1.1 unter MkLinux installieren?</H4>
<A HREF="mailto:t-ishii@sra.co.jp">Tatsuo Ishii</A> hat das unter MkLinux DR2.1 update2 geschafft, nachdem der kleine Patch
von <A HREF="ftp://ftp.sra.co.jp/pub/cmd/postgres/6.1.1/">ftp://ftp.sra.co.jp/pub/cmd/postgres/6.1.1/mklinux.patch.gz</A>
eingespielt wurde.
<H4><A NAME="1.19">1.19)</A> Warum stoppt make oder bricht sonstwie ab?</H4>
Es gibt eine Reihe von Reports dar&uuml;ber, da&szlig; gmake zu fr&uuml;h aussteigt oder mit einem Segmentation Fault aussteigt.
Das letzte Problem wurde von gmake 3.74 berichtet. Ein Update auf 3.76.1 l&ouml;ste dieses Problem.
Wie auch immer, 3.74 arbeitet bei vielen Leuten zur vollsten Zufriedenheit. Kurz gesagt, upgrade
Deinen gmake auf die aktuellste Version, bevor Du dieses Problem meldest.
<H4><A NAME="1.20">1.20)</A> Wie kann ich f&uuml;r die Prozessoren 486 oder Pentium optimieren?</H4>
Die Standard-Compilerflags f&uuml;hren keine Optimierung f&uuml;r den 486er oder den Pentium-Prozessor durch.
Um diese Optimierung zu aktivieren, f&uuml;ge wahlweise <U>eine</U> der folgenden Zeilen
der Datei Makefile.custom hinzu:
<PRE>
CFLAGS+= -m486
</PRE>
oder
<PRE>
CFLAGS+= -mpentium
</PRE>
oder
<PRE>
CFLAGS+= -mpentiumpro
</PRE>
<H4><A NAME="1.21">1.21)</A> Wieso bekomme ich seltsame Ergebnisse beim Drucken von Zeiten (z.B. beim Regressionstest 'timespan')?</H4>
Die Zeit erscheint z.B. als: "4 hours 59 mins 60.00 secs" und nicht als "5 hours"
<P>
Das ist ein Problem mit der glibc2-Bibliothek, die mit RedHat 5.0 ausgeliefert wird. Update Deine glibc auf die aktuellste RedHat-Version
f&uuml;r v5.0/Hurricane. Alle Versionen vor glibc-2.9.7 scheinen dieses Problem zu haben.
<H4><A NAME="1.22">1.22)</A> Warum bekomme ich keine shared libraries f&uuml;r libpq, wenn ich Version 6.3.2 kompiliere?</H4>
Es gab eine Last-Minute-&Auml;nderung der Linux-Konfiguration f&uuml;r Version 6.3.2.
Siehe f&uuml;r einige Fehlerbehebungen und einen Linux-ELF-Patch in <A HREF="ftp://postgresql.org/pub/patches/">ftp://postgresql.org/pub/patches/</A> nach.
<H4><A NAME="1.23">1.23)</A> Warum scheitert der Kompilierungslauf mit Nachrichten, da&szlig; F_BOOLIN, F_BOOLOUT und F_BYTEAIN nicht deklariert seien?</H4>
Die komplette Meldung sieht ungef&auml;hr so aus:
<PRE>
-I/usr/include/readline -O2 -Wall -Wmissing-prototypes -I..
-Wno-error -c bootstrap.c -o bootstrap.o
bootstrap.c:160: `F_BOOLIN' undeclared here (not in a function)
bootstrap.c:160: initializer element for `Procid[0].inproc' is not
constant
bootstrap.c:160: `F_BOOLOUT' undeclared here (not in a function)
bootstrap.c:160: initializer element for `Procid[0].outproc' is not
constant
bootstrap.c:161: `F_BYTEAIN' undeclared here (not in a function)
bootstrap.c:161: initializer element for `Procid[1].inproc' is not
constant
</PRE>
Solange Du nicht wei&szlig;t, warum das passiert, ist dieses Problem ziemlich kniffelig, da diese
Konstanten anscheinend nirgendwo definiert werden.
<P>
Die L&ouml;sung ist daf&uuml;r zu sorgen, da&szlig; der cpp in Deinem Pfad erreichbar ist, bevor
make gestartet wird.
<P>
Auf Redhat 5.1, ist cpp in /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3
<H3><A NAME="Sec2">Abschnitt 2: Hilfs- und Zusatzprogramme kompilieren</A></H3>
<H4><A NAME="2.1">2.1)</A> Der Linker findet die Bibliothek libX11 nicht, wenn pgtclsh kompiliert werden soll.</H4>
F&uuml;ge folgende Zeile in src/Makefile.custom hinzu:
<PRE>
X11_LIBDIR = /usr/X11R6/lib
</PRE>
<H3><A NAME="Sec3">Abschnitt 3: Laufzeit Probleme</A></H3>
<H4><A NAME="3.1">3.1)</A> Ich bekomme die Fehlermeldung <EM>_fUnKy_POSTPORT_sTuFf_ undefined</EM>, wenn Skripts wie createuser laufen.</H4>
Das ist ein Fehler in Versionen 1.06-1.07 und ist ab Version 1.08 und h&ouml;her behoben.
<H4><A NAME="3.2">3.2)</A> Nachdem ich postmaster starte, meldet das System <EM>Bad system call (Core dumped)</EM></H4>
Diese Fehlermeldung deutet an, da&szlig; Du keinen Shared-Memory-Support in den Kernel einkompiliert hast.
Der Kernel mu&szlig; mit dieser Option neu kompiliert werden, um diese Eigenschaft hinzuzuf&uuml;gen.
<H4><A NAME="3.3">3.3)</A> Wenn ich versuche, den Postmaster zu starten, bekomme ich eine Fehlermeldung wie:<BR><EM>
Failed Assertion("!(file != 0):(null)", File:<BR>
"/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)<BR>
!(file != 0) (0)<BR>
initdb: could not create template database<BR>
initdb: cleaning up.</EM></H4>
Deine Berechtigungen f&uuml;r die Datei /dev/null sind falsch gesetzt.
ein <CODE>ls -l /dev/null</CODE> sollte folgende Ausgabe zeigen:
<PRE>
crw-rw-rw- 1 root wheel 2, 2 Oct 8 18:41 /dev/null
</PRE>
Korrigiere die Berechtigungen mit:
<PRE>
chmod a+rw /dev/null
</PRE>
<H4><A NAME="3.4">3.4)</A> Warum funktioniert createuser nicht?</H4>
Es gibt ein Problem mit Version 2.5.3 des GNU flex und createuser. Die M&ouml;glichkeiten, diesen Fehler zu beheben sind:
Entweder auf die flex-Version 2.5.3 zu gehen, auf Version 2.5.4 zu gehen, oder
den Patch nach doc/README.flex einzuspielen.
<P>
Die Version 2.5.4. gibt es unter <A HREF="ftp://prep.ai.mit.edu/pub/gnu/">ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz</A>.
<H4><A NAME="3.5">3.5)</A> Wieso bekomme ich einen Fehler, wie:<BR><EM>
IpcMemoryCreate: memKey=155356396 , size=760632 ,<BR>
permission=384IpcMemoryCreate: shmget(..., create, ...)<BR>
failed: Invalid argument</EM></H4>
Du hast keine IPC-Unterst&uuml;tzung in Deinen Linux-Kernel einkompiliert.
Der Kernel mu&szlig; mit dieser Option neu kompiliert werden, um diese Eigenschaft hinzuzuf&uuml;gen.
<H4><A NAME="3.6">3.6)</A> Wieso scheitert der Aufruf von psql mit: <EM>psql: can't load library 'libpq.so.1</EM></H4>
Psql wurde mit dynamischen Zugriff auf die libpq-bibliothek kompiliert.
Um dieses Problem zu l&ouml;sen, solltest Du Dich als root anmelden und die Datei /etc/ld.so.conf editieren.
F&uuml;ge eine Zeile am Ende hinzu, die den Namen des PostgreSQL-Bibliotheken-Verzeichnis enth&auml;lt (das
lib-Verzeichnis im PostgreSQL-Installationsverzeichnis) und rufe den Befehl <CODE>/sbin/ldconfig -v</CODE> auf.
Alternativ (und falls Du keinen root-Zugriff hast) kannst Du die LD_LIBRARY_PATH-Variable
benutzen.
Die LD_LIBRARY_PATH-Variable enth&auml;lt eine durch Doppelpunkt getrennte Liste mit Suchpfaden f&uuml;r
Shared-Bibliotheken. Diese Liste wird durchsucht, bevor auf die Informationen von ldconfig zugegriffen wird.
Unter der bash sieht das ganze so aus:
<PRE>
export LD_LIBRARY_PATH='PathToPGSQL'/lib
</PRE>
unter der tcsh so:
<PRE>
setenv LD_LIBRARY_PATH 'PathToPGSQL'/lib
</PRE>
wobei 'PathToPGSQL' das Installationsverzeichnis von PostgreSQL ist.
Hinweis: der ldd-Befehl dient dazu, sich die dynamischen Bibliotheken f&uuml;r eine bestimmte
ausf&uuml;hrbare Datei anzeigen zu lassen.
<H4><A NAME="3.7">3.7)</A> Andere seltsame Verhaltensweisen</H4>
Ich bin mir nicht sicher, welche Symptome alle auftreten k&ouml;nnen, au&szlig;er da&szlig; gar nichts richtig funktioniert,
aber es stellte sich heraus, da&szlig; man sorgsam darauf achten sollte, da&szlig; die richtige Version der libpq-Bibliothek
geladen wird. Falls Du alte Versionen in Deinem Bibliothekspfad hast (z.B. in /usr/lib) k&ouml;nnen diese statt der
neueren Version geladen werden. Schaffe diese alten Versionen beiseite und siehe im &uuml;brigen
<A HREF="3.6">Frage 3.6</A> f&uuml;r weitere Details bez&uuml;glich dem Laden von Bibliotheken.
<H4><A NAME="3.8">3.8)</A> Wenn PostgreSQL beim Systemhalt lief, f&uuml;hrt Linux beim Neustart jedesmal einen Filesystemcheck (fsck) durch</H4>
Es gab dar&uuml;ber einige Berichte und es scheint, da&szlig; dies passiert, wenn PostgreSQL von der /etc/inittab
gestartet wird, wie im INSTALL-Dokument beschrieben.
<P>
Deshalb wird Dir empfohlen, den postmaster von einem rc-Skript aus zu starten.
Unter einem Slackware-artigem System w&uuml;rdest Du /etc/rc.d/rc.local modifizieren,
um den postmaster zu starten.
<P>
Unter RedHat-artigen Systemen w&uuml;rdest Du ein SysV-artiges Skript in /etc/rc.d/rc3.d
basierend auf der /etc/rc.d/init.d Schablonen-Datei erstellen.
<P>
Es gibt eine Beispieldatei unter dem Verzeichnis contrib/linux/postgres.init.
<P>
Hier ist noch ein anderes Beispiel von <A HREF="mailto:john@intelligent.co.uk">John Robinson</A>
welches Du entsprechend anpassen kannst.
<PRE>
#!/bin/sh
#
# postgreSQL.init This shell script takes care of starting and stopping
# the PostgreSQL postmaster.
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# See how we were called.
case "$1" in
start)
# Start daemons.
echo -n "Starting postgres Postmaster daemon:"
if [ -z "`pidofproc postmaster`" ]
then
su postgres -c "/usr/local/pgsql/bin/postmaster -D /home/postgreSQL/data -p 5432 &"
echo -n " postmaster"
else
echo -n " (already running)"
fi
echo
touch /var/lock/subsys/postgres
;;
stop)
# Stop daemons.
echo -n "Shutting down postgres Postmaster daemon: "
killall -TERM postmaster 2&gt;/dev/null
killall -TERM postgres 2&gt;/dev/null
echo
rm -f /var/lock/subsys/postgres
;;
*)
echo "Usage: postgres {start|stop}"
exit 1
esac
exit 0
</PRE>
<H4><A NAME="3.9">3.9)</A> Warum dauert Query 32 in den RegressionsTests so lange?</H4>
Das passiert wegen eines Fehlers in den Regressions-Skripten auf Linux-Kisten.
Es gibt - soweit ich wei&szlig; - zwei M&ouml;glichkeiten, diese Fehler zu umgehen
(die Information stammt von <A HREF="mailto:t-ishii@sra.co.jp">Tatsuo Ishii</A>):
<P>
1. &auml;ndere folgende Zeile in regress.sh:
<PRE>
time postgres -texecutor -tplanner -Q bench &lt; bench.sql
</PRE>
in
<PRE>
postgres -texecutor -tplanner -Q bench &lt; bench.sql
</PRE>
2. nachdem der Test gelaufen ist, entferne eine Zeile ganz am Ende der Datei bench.out,
die ungef&auml;hr so aussieht:
<PRE>
85.86user 114.47system 4:49.20elapsed 69%CPU (0avgtext+0avgdata 0maxresident)k
</PRE>
dann gib folgendes auf der Befehlszeile ein:
<PRE>
sh ./perquery &lt; bench.out &gt; & bench.out.perquery
</PRE>
<H4><A NAME="#3.10">3.10)</A> Warum bekomme ich lustige Rundungsergebnisse in einigen Datums/Zeit-Berechnungen, wie:<BR><EM>
select '4 hours'::timespan;<BR>
liefert '3 hours 59 minutes 60 seconds'</EM>?</H4>
Du benutzt neue glibc2-Bibliotheken in einer Version kleiner als 2.0.7. Das ist ein mathematisches Rundungsproblem.
Aktualisiere Deine Bibliothek.
<H4><A NAME="3.11">3.11)</A> Wieso bekomme ich einen Fehler wie: <EM>IpcMemoryCreate: shmget failed (Permission denied)</EM>?</H4>
Im Detail erscheint der Fehler mit dieser Meldung:<BR>
<PRE>
In detail, a message like this may appear:
IpcMemoryCreate: shmget failed (Permission denied)
key=5432010, size=120, permission=700
IpcMemoryAttach: shmat failed (Permission denied) id=0
FATAL 1: AttachSLockMemory: could not attach segment
</PRE>
Dieser Fehler wird durch nicht gel&ouml;schte Segmente im <EM>shared memory</EM> verursacht.
(Du kannst sie mit dem Programm <EM>ipcs</EM> sehen.
Benutze das Programm <EM>ipcrm</EM>, um sie zu l&ouml;schen.
<HR>
<P><BR>
<P><BR>
<CENTER>
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=2>
<TR>
<TH COLSPAN=2>Author of the english version</TH>
</TR>
<TR>
<TD ALIGN=LEFT>Dr. Andrew C.R. Martin</TD>
<TD ALIGN=RIGHT>University College London</TD>
</TR>
<TR>
<TD ALIGN=LEFT>EMAIL: (Work) martin@biochem.ucl.ac.uk</TD>
<TD ALIGN=RIGHT>(Home) andrew@stagleys.demon.co.uk</TD>
</TR>
<TR>
<TD ALIGN=CENTER COLSPAN=2>URL: http://www.biochem.ucl.ac.uk/~martin</TD>
</TR>
<TR>
<TD ALIGN=LEFT>Tel: (Work) +44(0)171 419 3890</TD>
<TD ALIGN=RIGHT>(Home) +44(0)1372 275775</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=2>
<TR>
<TH COLSPAN=2>Translator of the german version</TH>
</TR>
<TR>
<TD ALIGN=LEFT>Karsten Schulz</TD>
<TD ALIGN=RIGHT>Linux Systemhaus Schulz</TD>
</TR>
<TR>
<TD ALIGN=LEFT>EMAIL: (Work) schulz@Linux-Systemhaus.de</TD>
<TD ALIGN=RIGHT>(Home) kaschu@t800.ping.de</TD>
</TR>
<TR>
<TD ALIGN=CENTER COLSPAN=2>URL: http://www.Linux-Systemhaus.de/</TD>
</TR>
<TR>
<TD ALIGN=LEFT>Tel: (Work) +49 231 3944432</TD>
<TD ALIGN=RIGHT>(Fax) +49 231 3944435</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.1.105 i586) [Netscape]">
</HEAD>
<BODY BGCOLOR="#FFFDEC">
<PRE>=======================================================
Frequently Asked Questions (FAQ) per PostgreSQL >= V6.1
Specifiche per Linux Os
DA LEGGERE IN CONGIUNZIONE CON LE NORMALI FAQ
=======================================================
Ultimo aggiornamento:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lunedi' 18 Maggio 11:17:00 GMT 1998
Curatore corrente:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
Autore originale:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
Traduzione FAQ in italiano: Daniele Medri 'MaDriD' (madrid@darshan.org)
Cambiamenti in questa versione (* = modificato, + = nuovo, - = rimosso):
+1.21)&nbsp; Perche' ricevo strani risultati con i tempi di stampa (per esempio
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nel test di regressione 'timespan'?</PRE>
<PRE>Questo file &egrave; diviso approsimativamente nel sequente modo:
1.*)&nbsp;&nbsp;&nbsp; Istallare PostgreSQL
2.*)&nbsp;&nbsp;&nbsp; Compilare programmi accessori
3.*)&nbsp;&nbsp;&nbsp; Problemi di esecuzione
Domande risposte:
1.1)&nbsp;&nbsp;&nbsp; Quali cambiamenti devo fare a src/Makefile.global o a src/Makefile.custom
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e ci sono altri cambiamenti necessari?
1.2)&nbsp;&nbsp;&nbsp; Perche' ricevo problemi con missing libreadline?
1.3)&nbsp;&nbsp;&nbsp; [REDHAT] Perche' ricevo problemi di libdl e dlfcn.h perse?
1.4)&nbsp;&nbsp;&nbsp; [SLACKWARE 3.1] Perche' ricevo problemi di libdl e dlfcn.h perse?
1.5)&nbsp;&nbsp;&nbsp; La mia compilazione si arresta segnalando la mancanza dell'include file
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dlfcn.h perso.
1.6)&nbsp;&nbsp;&nbsp; GCC reclama una ignorata opzione -fpic
1.7)&nbsp;&nbsp;&nbsp; Ricevo messaggi di warning (errore) del tipo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; warning: cast from pointer to integer of different size
1.8)&nbsp;&nbsp;&nbsp; [SuSE-Linux 4.2-4.4] Dove sono curses e termcap?
1.9)&nbsp;&nbsp;&nbsp; Perche' ho problemi con&nbsp; ld.so?
1.10)&nbsp;&nbsp; Perche' ricevo errori del tipo `yy_flush_buffer undefined'?
1.11)&nbsp;&nbsp; Come posso compilare PostgreSQL su un sistema a.out?
1.12)&nbsp;&nbsp; Che cosa fallisce con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make: /usr/bin/make: cannot execute binary file
1.13)&nbsp;&nbsp; Quali sono i riferimenti in X11_LIB a libsocket e libnsl in
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src/Makefile.global?
1.14)&nbsp;&nbsp; [DEBIAN] Dov'e' libtermcap?
1.15)&nbsp;&nbsp; [REDHAT] Posso trovare PostgreSQL come RPM?
1.16)&nbsp;&nbsp; Quando tento di compilare una versione in sviluppo sotto Linux, la
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; compilazione fallisce con il seguente messaggio:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In file included from /usr/include/sys/sem.h:8,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from ipc.c:37:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make: *** [ipc.o] Error 1
1.17)&nbsp;&nbsp; Quando sto' compilando postgres, gcc riporta un signal 11 e si interrompe.
1.18)&nbsp;&nbsp; Posso installare 6.1.1 su MkLinux?
1.19)&nbsp;&nbsp; Perche' esce o va in crash?
1.20)&nbsp;&nbsp; Come posso ottimizzarlo per un 486 o un processore pentium
1.21)&nbsp;&nbsp; Perche' ricevo strani risultati con i tempi di stampa (per esempio
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nel test di regressione 'timespan'?
2.1)&nbsp;&nbsp;&nbsp; Il linker non trova libX11 quando sta' compilando pgtclsh
3.1)&nbsp;&nbsp;&nbsp; Ricevo un messaggio tipo&nbsp; _fUnKy_POSTPORT_sTuFf_ non definito quando
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lancio uno script come createuser
3.2)&nbsp;&nbsp;&nbsp; Lancio postmaster e dopo il sistema dice 'Bad system call(Core&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dumped)'
3.3)&nbsp;&nbsp;&nbsp; Quando tento di lanciare Postmaster, perche' ricevo un errore del tipo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Failed Assertion("!(file != 0):(null)", File:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; !(file != 0) (0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initdb: could not create template database
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initdb: cleaning up.
3.4)&nbsp;&nbsp;&nbsp; Perche' createuser non funziona?
3.5)&nbsp;&nbsp;&nbsp; Perche' ricevo un errore del tipo:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IpcMemoryCreate: memKey=155356396 , size=760632 ,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; permission=384IpcMemoryCreate: shmget(..., create, ...)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failed: Invalid argument
3.6)&nbsp;&nbsp;&nbsp; Perche' psql fallisce con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; psql: can't load library 'libpq.so.1'
3.7)&nbsp;&nbsp;&nbsp; Altri comportamenti strani
3.8)&nbsp;&nbsp;&nbsp; Quando PostgreSQL e' attivo allo shutdown di sistema, Linux
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; esegue al reboot un fsck al disco.
3.9)&nbsp;&nbsp;&nbsp; Perche' la Query 32 nel test di regressione pretende molto tempo?
3.10)&nbsp;&nbsp; Perche' ricevo dei risultati arrotondati su date/time aritmetici,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; come
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select '4 hours'::timespan;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; returning '3 hours 59 minutes 60 seconds'?
----------------------------------------------------------------------
Sezione 1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Compilare PostgreSQL
----------------------------------------------------------------------
1.1)&nbsp;&nbsp;&nbsp; Quali cambiamenti devo fare a src/Makefile.global o a&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src/Makefile.custom e ci sono altri cambiamenti necessari?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I cambiamenti ai makefiles sono piu'facilmente fatti usando
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lo script di shell per la personalizzazione che si trova nella
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directory src che scrive un file Makefile.custom appropriato.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I soli altri cambiamenti che tu devi fare e rimpiazzare Flex se tu
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hai una versione 2.5.3, la quale ha dei bug che si manifestano al
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fallimento di createuser (Vedi domanda 3.4)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se tu modifichi i makefiles a mano, tu *devi* settare le seguenti
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variabili:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PORTNAME=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; linux
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tu devi anche cambiare quello che segue per settare la tua propria&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; installazione:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSTGRESDIR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se tu cambi sull'opzione USE_TCL, devi settare questo:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCL_INCDIR=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCL_LIBDIR=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCL_LIB=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TK_INCDIR=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TK_LIBDIR=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TK_LIB=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_INCDIR=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_LIBDIR=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_LIB=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sul mio sistema Slackware3.0 esse sono:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCL_INCDIR=&nbsp;&nbsp;&nbsp;&nbsp; /usr/include/tcl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCL_LIBDIR=&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCL_LIB=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ltcl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TK_INCDIR=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/include/tcl
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TK_LIBDIR=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TK_LIB=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ltk
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_INCDIR=&nbsp;&nbsp;&nbsp;&nbsp; /usr/include/X11
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_LIBDIR=&nbsp;&nbsp;&nbsp;&nbsp; /usr/X386/lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_LIB=&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -lX11
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Devi fare ogni altro cambiamento necessario come documentato nel
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file INSTALL e in Makefile.global
1.2)&nbsp;&nbsp;&nbsp; Perche' ricevo problemi con missing libreadline?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I sistemi Linux in genere non vengono distribuiti con la libreria
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Gnu readline installata. Si pu&ograve; in ogni caso o disattivare l'opzione
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; di readline in src/Makefile.global o src/Makefile.custom, oppure
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; installare la libreria GNU stessa (readline).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nota che Linux Debian (come FreeBSD) esce con le readline installate.
1.3)&nbsp;&nbsp;&nbsp; [REDHAT] Perche' ricevo problemi di libdl e dlfcn.h perse??
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questa manifestazione avvisa che non c'e' la capacita' di linkare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; funzioni come dlopen(), dlclose(), etc. durante l'ultima fase di compilazione.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; La libreria libdl e' usata per linkare in maniera dinamica le funzioni
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e rendere flessibile l'avvio dell'applicativo. Per alcune ragioni questa
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; non era presente nella distribuzione Red Hat. La versione Redhat 4.0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Colgate) a colmato a questa mancanza.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RedHat ha ora una nuova versione di ld.so in formato RPM nei propri siti FTP.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Scaricate:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/ld.so-1.7.14-4.i386.rpm
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Installa il file RPM nella maniera usuale e andra'!
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ATTENZIONE! Devi rilanciare nuovamente il file configure e fare un&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make clean dopo aver installato la libreria e prima di ricompilare.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C'e' stata una sola notizia di sistema corrotto da programmi che&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accedevano a queste librerie mentre venivano aggiornate (nessun altra&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sorpresa.) Conseguentemente e' una buona idea quella di fare un reboot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; del sistema prima di installare le nuove librerie e avere pochi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; processi attivi durante questo upgrade. Lanciare il sistema in
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modalita' utente singolo (single-user) e' probabilmente una buona idea!
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se tu vuoi fare la strada piu' dura, puoi ottenere la libreria e&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l'header file da:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ld.so-1.7.14.tar.gz
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Alternativamente puoi trovare i file binari precompilati in&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; distributions/debian/buzz/binary-i386/base/ld.so-1.7.14-4.deb
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nel medesimo sito, o seguire le istruzioni date alla domanda 1.2 per
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; correggere lo stesso errore con le aggiornate versioni di Slackware 3.1.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Non scegliere questo metodo se non sai quello che stai facendo!
1.4)&nbsp;&nbsp;&nbsp; [SLACKWARE 3.1] Perche' ricevo problemi di libdl e dlfcn.h perse??
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questa manifestazione avvisa che non c'e' la capacita' di linkare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; funzioni come dlopen(), dlclose(), etc. durante l'ultima fase di compilazione.</PRE>
<PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Guarda la risposta alla domanda 1.3. Slackware fino alla versione 3.0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; era provvista di questa libreria e degli include file e ritornarono nell'ultima
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; versione 3.1, ma la prima versione della 3.1 (prima del 9 settembre 1996)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; non aveva queste e molte versioni su CD-ROM erano state stampate&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con la prima edizione.&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C'e' stata una sola notizia di sistema corrotto da programmi che&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accedevano a queste librerie mentre venivano aggiornate (nessun altra&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sorpresa.) Conseguentemente e' una buona idea quella di fare un reboot
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; del sistema prima di installare le nuove librerie e avere pochi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; processi attivi durante questo upgrade. Lanciare il sistema in
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; modalita' utente singolo (single-user) e' probabilmente una buona idea!
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Per fissare facilmente questo basta ottenere il file ldso.tgz dal quarto
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dischetto della piu' recente distribuzione Slackware e scompattarlo da
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dalla directory di root (/) e poi lanciare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sh install/doinst.sh
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per completare l'installazione. Successivamente lanciare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldconfig
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ATTENZIONE! Devi rilanciare nuovamente il file configure e fare un&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make clean dopo aver installato la libreria e prima di ricompilare.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se vuoi installarla manualmente bisogna installare prima il file
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dlfcn.h in /usr/include.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Secondo, installa il file libdl.so.1.7.14 (o qualsiasi altra versione)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in /lib, e poi fai:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cd /lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ln -sf libdl.so.1.7.14 libdl.so.1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ln -sf libdl.so.1 libdl.so
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Su certi sistemi (a seconda della personale configurazione di GCC)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e' necessario fare:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cd /usr/lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ln -sf /lib/libdl.so .
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Finalmente
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldconfig
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ATTENZIONE! Devi rilanciare nuovamente il file configure e fare un&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make clean dopo aver installato la libreria e prima di ricompilare.
1.5)&nbsp;&nbsp;&nbsp; La mia compilazione si arresta segnalando la mancanza dell'include file
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dlfcn.h perso.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Guarda la risposta 1.3/1.4. Non dimenticare che se stai usando un sistema
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a.out devi prima avere installato il pacchetto dld (il quale non viene
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fornito con molti sistemi a.out) per avere dlfcn.h e gli altri.&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Guarda la domanda 1.11.
1.6)&nbsp;&nbsp;&nbsp; GCC reclama una ignorata opzione -fpic
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Le prime versioni di GCC accettavano entrambe -fpic o -&pound;PIC.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nelle piu' recenti versioni (V2.7.2?) richiede -&pound;PIC.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se tu stai usando una versione ELF di Linux, questa puo' per sicurezza
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; essere ignorata perche' -&pound;PIC e' di default.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Puoi correggere questa editando il file src/Makefile.global e cambiare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS_SL
1.7)&nbsp;&nbsp;&nbsp; Ricevo messaggi di warning (errore) del tipo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; warning: cast from pointer to integer of different size
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questi appararivano nelle prime versione di Postgres95 e posso per sicurezza
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; essere ignorate. PostgreSQL V6.0 dovrebbe compilare senza warnings
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ad eccezione di quelli relativi agli header file di sistema (i quali possono
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; essere ignorati per sicurezza).
1.8)&nbsp;&nbsp;&nbsp; [SuSE-Linux 4.2-4.4] Dove sono curses e termcap?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SuSE-Linux 4.2 ha le ncurses ma non le curses. 4.4 ha entrambe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SuSE-Linux ha anche le librerie termcap in /usr/lib/termcap&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invece di essere in /usr/lib.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PostgreSQL (fino alla V6.0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -----------------------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Setta il valore delle CURSES_LIB in src/Makefile.custom a -lncurses&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (o fai questo attraverso lo script di personalizzazione).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aggiundi la seguente riga al file src/Makefile.custom:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDADD_BE+= -L/usr/lib/termcap
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Devi editare il file src/bin/psql/Makefile e cambiare:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifeq ($(PORTNAME), linux)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LD_ADD+=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifeq ($(PORTNAME), linux)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LD_ADD+= -ltermcap
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PostgreSQL (V6.1)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -----------------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lo script di configurazone non sa' di cercare nella directory&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/termcap per le librerie termcap, percio' tu devi specificare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; questo come una delle directory delle librerie dove cercare.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se non funziona (non ho SuSE per verificare che vada)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allora lancia configure, edita src/Makefile.global e aggiungi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ltermcap alla linea LDFLAGS
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (dopo -lreadline). (Alternativamente poi configurare&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src/Makefile.custom prima di lanciare configure.)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Alcune versioni di SuSE forniscono solo ncurses, percio' tu devi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; forzare l'uso delle ncurses piuttosto che le curses cambiando&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -lcurses con -lncurses. (dimostrato per SuSE 5.1)
1.9)&nbsp;&nbsp;&nbsp; Perche' ho problemi con&nbsp; ld.so?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se tu hai problemi con ld.so, un altra libreria richiesta sotto ELF
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per il caricamento dinamico, allora hai creato disordine con la tua
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; installazione o fatto un upgrade di Linux.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Guarda le risposte alle domande 1.3/1.4. Devi installare ld.so.x.y.z in
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /lib e lanciare ldconfig.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; La piu' recente vesione stabile del pacchetto ld e&igrave; 1.7.14
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mentre scrivo, la versione 1.8.x di ld e' sperimentale.&nbsp;
1.10)&nbsp;&nbsp; Perche' ricevo errori del tipo `yy_flush_buffer undefined'?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo non e' specifico per Linux, ma e' comune nelle vecchie istallazione
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; di Linux. Devi avere una versione recente di Flex (2.5.2 o superiore)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per compilare PostgreSQL. Nota che Flex 2.5.3 ha dei bug: guarda la&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domanda 3.4.
1.11)&nbsp;&nbsp; Come posso compilare PostgreSQL su un sistema a.out?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Prima, devi installare la libreria dld. Puoi ottenere questa da Sunsite come:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Linux/libs/dld.3.2.7.tar.gz
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ftp://sunsite.unc.edu/pub/Linux/libs/dld.3.2.7.tar.gz)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Secondo, aggiungi la seguente linea al file&nbsp; src/Makefile.custom:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LINUX_ELF=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (o usa lo script di configurazione)
1.12)&nbsp;&nbsp; Che cosa fallisce con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make: /usr/bin/make: cannot execute binary file
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo e' un problema delle prime versioni di Postgres95. Il default
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per PostgreSQL e' di usare bison -y piuttosto che yacc.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; yacc e' generalmente implementato come script che invoca bison -y
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Per alcune ragioni (certe versioni di make? certe versioni di bash?)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make non puo' eseguire questo file di script.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Per correggere questo, edita semplicemente src/mk/port/postgres.mk.linux
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e alla fine del file cambia:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # YACC = bison -y
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YACC = bison -y
1.13)&nbsp;&nbsp; Quali sono i riferimenti in X11_LIB a libsocket e libnsl in
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; src/Makefile.global?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo era un problema nella versione 1.08 (specifica per Sun Solaris)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; E' stata fissata nella 1.09 e 6.0
1.14)&nbsp;&nbsp; [DEBIAN] Dov'e'&nbsp; libtermcap?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debian Linux viene distribuita senza librerie termcap e usa ncurses&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (le quali usano terminfo all'interno). Non c'e' bisogno di cambiare la
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variabile CURSES_LIB&nbsp; in src/bin/psql/Makefile peche' Debian provvede&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con un link da libncurses a libcurses (diversamente da SuSE-Linux --
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Vedi domanda 1.8).
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Devi editare src/bin/psql/Makefile e commentare i cambiamenti:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifeq ($(PORTNAME), linux)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LD_ADD+= -ltermcap
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifeq ($(PORTNAME), linux)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LD_ADD+=
1.15)&nbsp;&nbsp; [REDHAT] Posso trovare PostgreSQL come RPM?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Si! Michal Mosiewicz&nbsp;<mimo@lodz.pdi.net>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (http://www.pdi.lodz.pl/~mimo) ha creato un RPM
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per PostgreSQL V6.0 per architettura Intel uplodata a&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftp://ftp.redhat.org/pub/Incoming/Postgres-6.0-1.i386.rpm
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questa e' una precompilata versione, le sorgenti RPM erano come
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; io ho scritto (3 Febbraio 1997).
1.16)&nbsp;&nbsp; Quando tento di compilare una versione in sviluppo sotto Linux, la
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; compilazione fallisce con il seguente messaggio:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In file included from /usr/include/sys/sem.h:8,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from ipc.c:37:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/include/asm/bitops.h:32: warning: no previous prototype for Set_bit'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; make: *** [ipc.o] Error 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Il problema e' che Linux non prevede prototipi per queste funzioni inline.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; La soluzione e' di andare dentro la directory .../src/backend/storage/ipc
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ed editare Makefile.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cambia la linea
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS+=$(INCLUDE_OPT)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS+=$(INCLUDE_OPT) -Wno-error
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fai lo stesso con la directory ../src/backend/storage/lmgr.
1.17)&nbsp;&nbsp; Quando sto' compilando postgres, gcc riporta un signal 11 e si interrompe.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Piu' specificatamente:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gcc: Internal compiler error: program cc1 got fatal&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; signal 11
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo e' un problema di hardware/memoria. PostgreSQL e' un grande
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; programma, e una larga compilazione con gcc (come la compilazione
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; di PostgreSQL o la compilazione del kernel) stressa la memoria come
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; molti altri programmi, mostrando errori che non appaiono nelle normali
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; operazioni. Sistemi operativi inferiori non riescono a stressare l'hardware
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in questo modo, per questo non vedrai mai questi errori sotto DOS/Windows.&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Maggiori informazioni in merito:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://www.bitwizard.nl/sig11
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Da questo Sig11 FAQ, sembra essere un errore specifico con Redhat 5.0&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lanciando su un processore Cyrix. Guarda il link superiore per i dettagli!
1.18)&nbsp;&nbsp; Posso installare 6.1.1 su MkLinux?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tatsuo Ishii&nbsp;<t-ishii@sra.co.jp> ha fatto questo su MkLinux DR2.1 update2 dopo una piccola
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; patch disponibile presso:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftp://ftp.sra.co.jp/pub/cmd/postgres/6.1.1/mklinux.patch.gz
1.19)&nbsp;&nbsp; Perche' esce o va in crash??
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ci sono state diverse segnalazioni di gmake, dove in tutte si usciva
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subito e c'era una seg faulting. Il problema piu' marcato e' stato&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; riportato con gmake 3.74 - upgradandolo alla 3.76.1 si e' risolto.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Comunque, la versione 3.74 e' funzionante per altri tipi di setup.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In breve, prova ad upgradare gmake all'ultima versione che puoi trovare
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prima di riportarlo come un problema.
1.20)&nbsp;&nbsp; Come posso ottimizzarlo per un 486 o un processore pentium
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Le flags di compilazione per default non permettono l'optimizzazione per 486
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o per processori Pentium. Per aggiungerla come ottimizzazione, edita
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Makefile.custom e aggiungi:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS+= -m486
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o (per i nuovi compilatori che molte persone non stanno usando)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS+= -mpentium
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFLAGS+= -mpentiumpro
1.21)&nbsp;&nbsp; Perche' ricevo strani risultati con i tempi di stampa (per esempio
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nel test di regressione 'timespan'?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Le ore appaiono come: '4 hours 59 mins 60.00 secs'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invece di '5 hours'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo e' un problema con le librerie glibc2 le quali appaiono con
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RedHat 5.0. Aggiorna le tue glibc con le ultime versioni di RedHat per
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v5.0/hurricane. Tutto quello che e' anteriore alle glibc-2.0.7 ha&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; questi problemi.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
----------------------------------------------------------------------
Sezione 2:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Compilare programmi accessori
----------------------------------------------------------------------
2.1)&nbsp;&nbsp;&nbsp; Il linker non trova libX11 quando sta' compilando pgtclsh
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aggiungi la seguente riga al file src/Makefile.custom
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X11_LIBDIR = /usr/X11R6/lib
----------------------------------------------------------------------
Sezione 3:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Problemi di esecuzione
----------------------------------------------------------------------
3.1)&nbsp;&nbsp;&nbsp; Ricevo un messaggio tipo&nbsp; _fUnKy_POSTPORT_sTuFf_ non definito quando
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lancio uno script come createuser
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo e' un bug nella V.1.06-V1.07 di Postgres ed e' fissata con la versione
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.08 o superiore.
3.2)&nbsp;&nbsp;&nbsp; Lancio postmaster e dopo il sistema dice 'Bad system call(Core&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dumped)'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo indica che non hai compilato il supporto per la memoria condivisa nel
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kernel. Devi ricompilare il kernel per aggiungere questa feature.
3.3)&nbsp;&nbsp;&nbsp; Quando tento di lanciare Postmaster, perche' ricevo un errore del tipo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Failed Assertion("!(file != 0):(null)", File:&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; !(file != 0) (0)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initdb: could not create template database
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initdb: cleaning up.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I permessi sul file /dev/null sono sbagliati.&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ls -l /dev/null should give you something like:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crw-rw-rw-&nbsp; 1 root&nbsp; wheel&nbsp;&nbsp;&nbsp; 2,&nbsp;&nbsp; 2 Oct&nbsp; 8 18:41 /dev/null
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Correggi i permessi con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chmod a+rw /dev/null
3.4)&nbsp;&nbsp;&nbsp; Perche' createuser non funziona?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C'e' un problema con la versione 2.5.3 di GNU Flex e createuser.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Le tue opzioni devono recedere a Flex V2.5.2, aggiornale alla V2.5.4 o
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; applica una patch alla V2.5.3 la quale e' fornita in doc/README.flex
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Puoi ottenere la V.2.5.4 da:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ftp://prep.ai.mit.edu/pub/gnu/flex-2.5.4.tar.gz
3.5)&nbsp;&nbsp;&nbsp; Perche' ricevo un errore del tipo:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IpcMemoryCreate: memKey=155356396 , size=760632 ,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; permission=384IpcMemoryCreate: shmget(..., create, ...)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failed: Invalid argument
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Non hai compilato il supporto IPC nel kernel di Linux.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Devi ricompilare il kernel con questa opzione.
3.6)&nbsp;&nbsp;&nbsp; Perche' psql fallisce con:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; psql: can't load library 'libpq.so.1'
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Psql e' stata compilata per linkarsi dinamicamente con la libreria libpq.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Per risolvere questo, devi accedere come root ed editare il file
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/ld.so.conf
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aggiungi una linea singola alla fine, la quale prende il nome della directory
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delle librerie di PostgreSQL (la sottodirectory delle librerie&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dell'installazione diPostgreSQL) e lancia
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /sbin/ldconfig -v
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Alternativamente, (e se tu non hai accesso come root), devi usare la
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variabile di ambiente LD_LIBRARY_PATH.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; La variabile LD_LIBRARY_PATH contiene una lista di paths per ricercare le librerie
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; condivise. Questa lista e' ricercata prima delle librerie specificate da ldconfig.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Percio' sotto Bash, devi fare qualcosa del tipo:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; export LD_LIBRARY_PATH='PathToPGSQL'/lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o, usando tcsh
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setenv LD_LIBRARY_PATH 'PathToPGSQL'/lib
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rimpiazzando 'PathToPGSQL' con l'appropriato path alla tua directory PostgreSQL
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; al top level.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nota che il comando ldd puo' essere eseguito su un programma linkato dinamicamente
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alla lista di paths a tutte le librerie condivise sopra, alle quali gli eseguibili
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dipendono.
3.7)&nbsp;&nbsp;&nbsp; Altri comportamenti strani
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Non sono sicuro quali siano i sintomi che non permettono la corretta esecuzione,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ma si puo' ipotizzare che le ragioni vadano oltre il regolare funzionamento del&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loader dinamico nel caricare la corretta versione delle librerie libpq.&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Se hai una versione vecchia dai una occhiata al path delle librerie
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (per esempio in /usr/lib) che dovrebbero caricare nelle nuove versioni che intendi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; far girare. Renditi sicuro di prendere queste nel percorso e guarda la Domanda 3.6&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per i dettagli in merito al caricamento dinamico delle librerie.
3.8)&nbsp;&nbsp;&nbsp; Quando PostgreSQL e' attivo allo shutdown di sistema, Linux
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; esegue al reboot un fsck al disco.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ci sono state alcune segnalazioni di questo e sembre essere il
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; risultato di lanciare PostgreSQL dal /etc/inittab come suggerito
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nel file INSTALL.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Si raccomanda percio' di lanciare il postmaster da un rc script.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sotto una versione di tipo Slackware, devi modificare /etc/rc.d/rc.local
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; per lanciare il postmaster. Sotto una versione in stile RedHat
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; devi creare uno script in stile SysV sotto /etc/rc.d/rc3.d basato
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sul file /etc/rc.d/init.d.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C'e' un esempio di file in contrib/linux/postgres.init
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Un altro file di esempio &egrave; proposto da John Robinson&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<john@intelligent.co.uk> il quale puo' essere modificato a seconda delle esigenze:
#!/bin/sh
#
# postgreSQL.init This shell script takes care of starting and stopping
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the PostgreSQL postmaster.
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] &amp;&amp; exit 0
# See how we were called.
case "$1" in
&nbsp; start)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Start daemons.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -n "Starting postgres Postmaster daemon:"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ -z "`pidofproc postmaster`" ]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; su postgres -c "/usr/local/pgsql/bin/postmaster -D /home/postgreSQL/data -p 5432 &amp;"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -n " postmaster"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -n " (already running)"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; touch /var/lock/subsys/postgres
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;
&nbsp; stop)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Stop daemons.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -n "Shutting down postgres Postmaster daemon: "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; killall -TERM postmaster 2>/dev/null
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; killall -TERM postgres 2>/dev/null
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rm -f /var/lock/subsys/postgres
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;
&nbsp; *)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "Usage: postgres {start|stop}"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit 1
esac
exit 0
3.9)&nbsp;&nbsp;&nbsp; Perche' la Query 32 nel test di regressione pretende molto tempo?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Questo e' un bug nello script di regressione presente su Linux Os.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ci sono due raggiri per evitarli (informazione di Tatsuo Ishii&nbsp;<t-ishii@sra.co.jp>):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. cambia quello che segue in regress.sh:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; time postgres -texecutor -tplanner -Q bench &lt; bench.sql
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; postgres -texecutor -tplanner -Q bench &lt; bench.sql
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. dopo aver lanciato il test, rimuovi la linea finale di&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bench.out, qualcosa del tipo:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 85.86user 114.47system 4:49.20elapsed 69%CPU (0avgtext+0avgdata 0maxresident)k
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; poi digita:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sh ./perquery &lt; bench.out > &amp; bench.out.perquery
3.10)&nbsp;&nbsp; Perche' ricevo dei risultati arrotondati su date/time aritmetici,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; come
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select '4 hours'::timespan;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; returning '3 hours 59 minutes 60 seconds'?
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Stai usando le nuove librerie glibc2 e hai una versione precedene alla
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.0.7. E' un problema di arrotondamento matematico nella libreria.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aggiorna le tue librerie.</PRE>
<PRE>
----------------------------------------------------------------------------
Dr. Andrew C.R. Martin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; University College London
EMAIL: (Work) martin@biochem.ucl.ac.uk&nbsp;&nbsp;&nbsp; (Home) andrew@stagleys.demon.co.uk
URL:&nbsp;&nbsp; http://www.biochem.ucl.ac.uk/~martin
Tel:&nbsp;&nbsp; (Work) +44(0)171 419 3890&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Home) +44(0)1372 275775
----------------------------------------------------------------------------
Daniele Medri 'MaDriD' - e-mail: madrid@darshan.org web: www.darshan.org&nbsp;&nbsp;
----------------------------------------------------------------------------</PRE>
</BODY>
</HTML>
<PRE>
=======================================================
Frequently Asked Questions (FAQ) for PostgreSQL V6.5
Sun Solaris Specific
TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
=======================================================
last updated: Thu Sep 21 9:30:00 CET 1999
current maintainer: Marc Liyanage (liyanage@access.ch)
original author: Marc Liyanage (liyanage@access.ch)
Contents:
1.1) What tools do I need to build and install PostgreSQL on Solaris?
1.2) What else do I have to do before building PostgreSQL?
1.3) Why am I getting "IpcMemoryCreate" errors when I try
to run postmaster?
1.4) Why am I getting "Can't tell what username to use" errors
when I try to run initdb?
A) Contributors
Notes:
- The commands given here are for the bash shell. If you use
a different shell, you'll have to change the commands accordingly,
especially these regarding environment variables.
- These instructions are written for Solaris 2.6
----------------------------------------------------------------------
Section 1: Building and Installing PostgreSQL
----------------------------------------------------------------------
1.1) What tools do I need to build and install PostgreSQL on Solaris?
You will need
- GNU flex 2.5.4 or better (the lex included in Solaris 2.6 won't work)
- GNU bison (the yacc included in Solaris 2.6 won't work)
- GNU zip (gzip and especially zcat for installing the docs)
- GNU make
- GNU readline library
We also used
- GNU cc (gcc 2.8.1)
If you like Solaris packages, you can find these tools here:
http://www.sunfreeware.com
If you prefer sources, look here:
http://www.gnu.org/order/ftp.html
1.2) What else do I have to do before building PostgreSQL?
Shared libraries
----------------
The default installation procedure puts the shared libraries
into "/usr/local/pgsql/lib", but the dynamic loader won't
find them there at runtime unless you use some hack like
symlinking the libraries in /usr/lib or setting LD_LIBRARY_PATH
for every user that will use the DB system.
The first time you'll encounter this problem is usually when
running "initdb". It will fail with something like
ld.so.1: pg_id: fatal: libpq.so: open failed: No such file or directory
We recommend that you store the path of the directory containing
the libraries in the environment variable LD_RUN_PATH *before*
starting the build. This will cause the linker to store this
path in the binaries.
Do this:
# export LD_RUN_PATH=/usr/local/pgsql/lib
(or wherever you choose to put the libraries)
There is some good information about this here:
http://www.visi.com/~barr/ldpath.html
zcat
----
If
- both the original solaris zcat as well as the recommended
GNU zcat are installed on the system (e.g. the former in /usr/bin and
the latter in /usr/local/bin) and
- configure (or "which zcat") finds the wrong one
then configure needs to be told where GNU zcat can be found.
Failure to do so will cause configure to select the wrong one
and the "gmake install" command in the "doc" subdirectory
(step 12 in the INSTALL file) will fail because Solaris
zcat cannot handle the .gz compressed documentation files.
To fix this, type
# export GZCAT=/usr/local/bin/zcat
(or wherever your GNU zcat lives)
before running configure.
1.3) Why am I getting "IpcMemoryCreate" errors when I try
to run the postmaster?
(See also 3.4 in the main FAQ file)
Under Solaris 2.6 and probably others, the default shared memory
maximum segment size kernel parameter is set too low. The solution
is to put something like the following line into /etc/system and
reboot the system.
set shmsys:shminfo_shmmax=0x7fffffff
Excellent info regarding shared memory under Solaris can be found here:
http://www.sunworld.com/swol-09-1997/swol-09-insidesolaris.html
1.4) Why am I getting "Can't tell what username to use" errors
when I try to run initdb?
Put something like this into the .bash_profile startup script
of the postgres user (see also step 17 in the INSTALL file):
export USER=postgres
----------------------------------------------------------------------
Section A: Contributors
----------------------------------------------------------------------
- Jose Luis Rodriguez Garcia
Suggested to change the shmmax parameter in 1.3 from 0xffffffff to 0x7fffffff
because the value is a signed integer in Solaris versions prior to 2.6.
</PRE>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment