[08254fc] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[7f76b96] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
[08254fc] | 3 | "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[f62b122b] | 7 | <!ENTITY postgresql-download-http "http://gd.tuwien.ac.at/db/postgresql/source/v&postgresql-version;/postgresql-&postgresql-version;.tar.bz2">
|
---|
| 8 | <!ENTITY postgresql-download-ftp "ftp://ftp.fr.postgresql.org/source/v&postgresql-version;/postgresql-&postgresql-version;.tar.bz2">
|
---|
[9aeb405d] | 9 | <!ENTITY postgresql-md5sum "f0ea2b372a7bdaf2613e92176ebf5e0f">
|
---|
| 10 | <!ENTITY postgresql-size "10.2 MB">
|
---|
| 11 | <!ENTITY postgresql-buildsize "236 MB">
|
---|
[08254fc] | 12 | <!ENTITY postgresql-time "1.21 SBU">
|
---|
| 13 | ]>
|
---|
| 14 |
|
---|
[458342f] | 15 | <sect1 id="postgresql" xreflabel="PostgreSQL-&postgresql-version;">
|
---|
[a0f03b0] | 16 | <sect1info>
|
---|
[5cd0959d] | 17 | <othername>$LastChangedBy$</othername>
|
---|
| 18 | <date>$Date$</date>
|
---|
[a0f03b0] | 19 | </sect1info>
|
---|
[00bb024c] | 20 | <?dbhtml filename="postgresql.html"?>
|
---|
[458342f] | 21 | <title>Postgre<acronym>SQL</acronym>-&postgresql-version;</title>
|
---|
| 22 |
|
---|
[08254fc] | 23 | <sect2>
|
---|
[78d0e3c] | 24 | <title>Introduction to <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 25 | </title>
|
---|
[08254fc] | 26 |
|
---|
[78d0e3c] | 27 | <para><application>Postgre<acronym>SQL</acronym></application> is an advanced
|
---|
| 28 | object-relational database management system (<acronym>ORDBMS</acronym>),
|
---|
| 29 | derived from the Berkeley Postgres database management system.</para>
|
---|
[08254fc] | 30 |
|
---|
| 31 | <sect3><title>Package information</title>
|
---|
| 32 | <itemizedlist spacing='compact'>
|
---|
[f62b122b] | 33 | <listitem><para>Download (HTTP):
|
---|
| 34 | <ulink url="&postgresql-download-http;"/></para></listitem>
|
---|
| 35 | <listitem><para>Download (FTP):
|
---|
| 36 | <ulink url="&postgresql-download-ftp;"/></para></listitem>
|
---|
[dc2f5ad] | 37 | <listitem><para>Download MD5 sum: &postgresql-md5sum;</para></listitem>
|
---|
[08254fc] | 38 | <listitem><para>Download size: &postgresql-size;</para></listitem>
|
---|
[f62b122b] | 39 | <listitem><para>Estimated disk space required:
|
---|
| 40 | &postgresql-buildsize;</para></listitem>
|
---|
| 41 | <listitem><para>Estimated build time:
|
---|
| 42 | &postgresql-time;</para></listitem></itemizedlist>
|
---|
[08254fc] | 43 | </sect3>
|
---|
| 44 |
|
---|
[9aeb405d] | 45 | <sect3><title>Additional downloads</title>
|
---|
| 46 | <itemizedlist spacing='compact'>
|
---|
| 47 | <listitem><para>Required patch: <ulink
|
---|
| 48 | url="&patch-root;/postgresql-&postgresql-version;-dsssl_fix-1.patch"/></para>
|
---|
| 49 | </listitem></itemizedlist>
|
---|
| 50 | </sect3>
|
---|
| 51 |
|
---|
[78d0e3c] | 52 | <sect3><title><application>Postgre<acronym>SQL</acronym></application>
|
---|
| 53 | dependencies</title>
|
---|
[08254fc] | 54 | <sect4><title>Optional</title>
|
---|
[f62b122b] | 55 | <para><xref linkend="python"/>,
|
---|
[08254fc] | 56 | <xref linkend="tcl"/>,
|
---|
| 57 | <xref linkend="tk"/>,
|
---|
[cef3a2f] | 58 | <xref linkend="openssl"/>,
|
---|
[08254fc] | 59 | <xref linkend="Linux_PAM"/>,
|
---|
[9aeb405d] | 60 | <xref linkend="sgml-dtd-3"/>,
|
---|
| 61 | <xref linkend="docbook-dsssl"/>,
|
---|
[78d0e3c] | 62 | <xref linkend="openjade"/>,
|
---|
| 63 | <xref linkend="perl-modules"/>: SGMLSpm-&SGMLSpm-version;,
|
---|
[08254fc] | 64 | <ulink url="http://www.pdc.kth.se/kth-krb/">krb4</ulink>,
|
---|
| 65 | <xref linkend="mitkrb"/> or <xref linkend="heimdal"/>,
|
---|
[99e650b] | 66 | <xref linkend="apache-ant"/> and
|
---|
[f62b122b] | 67 | <ulink url="http://rendezvous.sourceforge.net/">Rendezvous</ulink></para>
|
---|
| 68 | </sect4>
|
---|
[08254fc] | 69 | </sect3>
|
---|
| 70 |
|
---|
| 71 | </sect2>
|
---|
| 72 |
|
---|
| 73 | <sect2>
|
---|
[78d0e3c] | 74 | <title>Installation of <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 75 | </title>
|
---|
[08254fc] | 76 |
|
---|
[9aeb405d] | 77 | <para>In order for <command>configure</command> to properly discover
|
---|
| 78 | <application>Docbook <acronym>SGML</acronym>
|
---|
| 79 | <acronym>DTD</acronym></application> (v3.1), you may need to remove
|
---|
| 80 | <application>OpenSP</application> catalog definitions from the system
|
---|
| 81 | <acronym>SGML</acronym> catalogs. Use the following command before building
|
---|
| 82 | the package to accomplish this:</para>
|
---|
| 83 |
|
---|
| 84 | <screen><userinput><command>sed -i.orig \
|
---|
| 85 | -e "/CATALOG \/etc\/sgml\/OpenSP-1.5.1.cat/d" \
|
---|
| 86 | /etc/sgml/catalog \
|
---|
| 87 | /etc/sgml/sgml-docbook.cat</command></userinput></screen>
|
---|
| 88 |
|
---|
[78d0e3c] | 89 | <para>Install <application>Postgre<acronym>SQL</acronym></application> with the
|
---|
| 90 | following commands: </para>
|
---|
[08254fc] | 91 |
|
---|
[9aeb405d] | 92 | <screen><userinput><command>patch -Np1 -i ../postgresql-&postgresql-version;-dsssl_fix-1.patch &&
|
---|
| 93 | ./configure --prefix=/usr --enable-thread-safety &&
|
---|
[08254fc] | 94 | make &&
|
---|
[bccf77a5] | 95 | make install &&
|
---|
| 96 | chown -R root:root /usr/share/doc/postgresql/html</command></userinput></screen>
|
---|
[08254fc] | 97 |
|
---|
[11404f5] | 98 | <para>The standard installation provides only the header files needed
|
---|
| 99 | for client application development. Server-side applications require
|
---|
| 100 | the entire <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 101 | include tree which can be installed using the following command:</para>
|
---|
| 102 |
|
---|
| 103 | <screen><userinput><command>make install-all-headers</command></userinput></screen>
|
---|
| 104 |
|
---|
[08254fc] | 105 | <note><para>If you are upgrading an existing system and are going to
|
---|
| 106 | install the new files over the old ones, then you should
|
---|
| 107 | back up your data, shut down the old server and follow the
|
---|
| 108 | instructions in <ulink
|
---|
| 109 | url="http://www.postgresql.org/docs/7.4/static/install-upgrading.html">the
|
---|
| 110 | official <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 111 | documentation</ulink>.</para></note>
|
---|
| 112 |
|
---|
| 113 | <para>Initialize a database cluster with the following commands:</para>
|
---|
| 114 |
|
---|
[b054b795] | 115 | <screen><userinput><command>mkdir -p /srv/pgsql/data &&
|
---|
| 116 | useradd -d /srv/pgsql/data postgres &&
|
---|
| 117 | chown postgres /srv/pgsql/data &&
|
---|
| 118 | su - postgres -c '/usr/bin/initdb -D /srv/pgsql/data'</command></userinput></screen>
|
---|
[08254fc] | 119 |
|
---|
| 120 | <para>Start the database server with the following command:</para>
|
---|
| 121 |
|
---|
[b054b795] | 122 | <screen><userinput><command>su - postgres -c '/usr/bin/postmaster -D /srv/pgsql/data > \
|
---|
| 123 | /srv/pgsql/data/logfile 2>&1 &'</command></userinput></screen>
|
---|
[08254fc] | 124 |
|
---|
| 125 | <para>Create a database and verify the installation:</para>
|
---|
| 126 |
|
---|
| 127 | <screen><userinput><command>su - postgres -c '/usr/bin/createdb test' &&
|
---|
| 128 | echo "create table t1 ( name varchar(20), state_province varchar(20) );" \
|
---|
| 129 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 130 | echo "insert into t1 values ('Billy', 'NewYork');" \
|
---|
| 131 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 132 | echo "insert into t1 values ('Evanidus', 'Quebec');" \
|
---|
| 133 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 134 | echo "insert into t1 values ('Jesse', 'Ontario');" \
|
---|
| 135 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 136 | echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test')</command></userinput></screen>
|
---|
| 137 |
|
---|
| 138 | </sect2>
|
---|
| 139 |
|
---|
| 140 | <sect2>
|
---|
| 141 | <title>Command explanations</title>
|
---|
| 142 |
|
---|
[9aeb405d] | 143 | <para><parameter>--enable-thread-safety</parameter>: This switch makes the
|
---|
| 144 | client libraries thread-safe by allowing concurrent threads in
|
---|
| 145 | <filename class='libraryfile'>libpq</filename> and <acronym>ECPG</acronym>
|
---|
| 146 | programs to safely control their private connection handles.</para>
|
---|
| 147 |
|
---|
[bccf77a5] | 148 | <para><command>chown -R root:root /usr/share/doc/postgresql/html</command>:
|
---|
| 149 | This command corrects the improper ownership of some documentation
|
---|
| 150 | files.</para>
|
---|
| 151 |
|
---|
[9aeb405d] | 152 | <para><command>useradd -d /srv/pgsql/data postgres</command>: Add an
|
---|
| 153 | unprivileged user to run the database server.</para>
|
---|
[08254fc] | 154 |
|
---|
[78d0e3c] | 155 | <para><command>createdb test, create table t1 , insert into t1 values...,
|
---|
| 156 | select * from t1</command>: Create a database, add a table to it, insert some
|
---|
| 157 | rows into the table and select them to verify that the installation is working
|
---|
[08254fc] | 158 | properly.</para>
|
---|
| 159 |
|
---|
| 160 | </sect2>
|
---|
| 161 |
|
---|
| 162 | <sect2>
|
---|
[78d0e3c] | 163 | <title>Configuring <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 164 | </title>
|
---|
[08254fc] | 165 |
|
---|
| 166 | <sect3>
|
---|
| 167 | <title>Config files</title>
|
---|
| 168 |
|
---|
[78d0e3c] | 169 | <para><filename>$PGDATA/pg_ident.con</filename>,
|
---|
| 170 | <filename>$PGDATA/pg_hba.conf</filename> and
|
---|
| 171 | <filename>$PGDATA/postgresql.conf</filename></para>
|
---|
[08254fc] | 172 |
|
---|
[78d0e3c] | 173 | <para>The <envar>PGDATA</envar> environment variable is used to distinguish
|
---|
| 174 | database clusters from one another by setting it to the value of the directory
|
---|
[08254fc] | 175 | which contains the cluster desired. The three configuration files
|
---|
| 176 | exist in every <filename class="directory">PGDATA/</filename> directory.
|
---|
| 177 | Details on the format of the files and the options that can be set in
|
---|
| 178 | each can be found in <ulink
|
---|
| 179 | url="file:///usr/share/doc/postgresql/html/index.html"/>.</para>
|
---|
| 180 |
|
---|
| 181 | <para>Install the <filename>/etc/rc.d/init.d/postgresql</filename>
|
---|
[78d0e3c] | 182 | init script included in the <xref linkend="intro-important-bootscripts"/>
|
---|
| 183 | package.</para>
|
---|
| 184 |
|
---|
[08254fc] | 185 | <screen><userinput><command>make install-postgresql</command></userinput></screen>
|
---|
| 186 |
|
---|
| 187 | </sect3>
|
---|
| 188 |
|
---|
| 189 | </sect2>
|
---|
| 190 |
|
---|
| 191 | <sect2>
|
---|
| 192 | <title>Contents</title>
|
---|
| 193 |
|
---|
[78d0e3c] | 194 | <para>The <application>Postgre<acronym>SQL</acronym></application> package
|
---|
| 195 | contains <command>clusterdb</command>,
|
---|
[08254fc] | 196 | <command>createdb</command>,
|
---|
| 197 | <command>createlang</command>,
|
---|
| 198 | <command>createuser</command>,
|
---|
| 199 | <command>dropdb</command>,
|
---|
| 200 | <command>droplang</command>,
|
---|
| 201 | <command>dropuser</command>,
|
---|
| 202 | <command>ecpg</command>,
|
---|
| 203 | <command>initdb</command>,
|
---|
| 204 | <command>initlocation</command>,
|
---|
| 205 | <command>ipcclean</command>,
|
---|
| 206 | <command>pg_config</command>,
|
---|
| 207 | <command>pg_controldata</command>,
|
---|
| 208 | <command>pg_ctl</command>,
|
---|
| 209 | <command>pg_dump</command>,
|
---|
| 210 | <command>pg_dumpall</command>,
|
---|
| 211 | <command>pg_encoding</command>,
|
---|
| 212 | <command>pg_id</command>,
|
---|
| 213 | <command>pg_resetxlog</command>,
|
---|
| 214 | <command>pg_restore</command>,
|
---|
| 215 | <command>pgtclsh</command>,
|
---|
| 216 | <command>pgtksh</command>,
|
---|
| 217 | <command>pltcl_delmod</command>,
|
---|
| 218 | <command>pltcl_listmod</command>,
|
---|
| 219 | <command>pltcl_loadmod</command>,
|
---|
| 220 | <command>postgres</command>,
|
---|
| 221 | <command>postmaster</command>,
|
---|
| 222 | <command>psql</command>,
|
---|
| 223 | <command>vacuumdb</command>,
|
---|
| 224 | <filename class="libraryfile">libecpg</filename>,
|
---|
| 225 | <filename class="libraryfile">libpgtcl</filename>,
|
---|
| 226 | <filename class="libraryfile">libpgtypes</filename>,
|
---|
| 227 | <filename class="libraryfile">libpq</filename> and various charset
|
---|
| 228 | modules.</para>
|
---|
| 229 |
|
---|
| 230 | </sect2>
|
---|
| 231 |
|
---|
| 232 | <sect2><title>Description</title>
|
---|
| 233 |
|
---|
| 234 | <sect3><title>clusterdb</title>
|
---|
| 235 | <para><command>clusterdb</command> is a utility for reclustering tables
|
---|
| 236 | in a <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 237 | database.</para></sect3>
|
---|
| 238 |
|
---|
| 239 | <sect3><title>createdb</title>
|
---|
| 240 | <para><command>createdb</command> creates a new
|
---|
[78d0e3c] | 241 | <application>Postgre<acronym>SQL</acronym></application> database.</para>
|
---|
| 242 | </sect3>
|
---|
[08254fc] | 243 |
|
---|
| 244 | <sect3><title>createlang</title>
|
---|
| 245 | <para><command>createlang</command> defines a new
|
---|
| 246 | <application>Postgre<acronym>SQL</acronym></application> procedural
|
---|
| 247 | language.</para></sect3>
|
---|
| 248 |
|
---|
| 249 | <sect3><title>createuser</title>
|
---|
| 250 | <para><command>createuser</command> defines a new
|
---|
[78d0e3c] | 251 | <application>Postgre<acronym>SQL</acronym></application> user account.</para>
|
---|
| 252 | </sect3>
|
---|
[08254fc] | 253 |
|
---|
| 254 | <sect3><title>dropdb</title>
|
---|
| 255 | <para><command>dropdb</command> removes a
|
---|
[78d0e3c] | 256 | <application>Postgre<acronym>SQL</acronym></application> database.</para>
|
---|
| 257 | </sect3>
|
---|
[08254fc] | 258 |
|
---|
| 259 | <sect3><title>droplang</title>
|
---|
| 260 | <para><command>droplang</command> removes a
|
---|
| 261 | <application>Postgre<acronym>SQL</acronym></application> procedural
|
---|
| 262 | language.</para></sect3>
|
---|
| 263 |
|
---|
| 264 | <sect3><title>dropuser</title>
|
---|
| 265 | <para><command>dropuser</command> removes a
|
---|
[78d0e3c] | 266 | <application>Postgre<acronym>SQL</acronym></application> user account.</para>
|
---|
| 267 | </sect3>
|
---|
[08254fc] | 268 |
|
---|
| 269 | <sect3><title>ecpg</title>
|
---|
[78d0e3c] | 270 | <para><command>ecpg</command> is the embedded <acronym>SQL</acronym>
|
---|
| 271 | preprocessor.</para></sect3>
|
---|
[08254fc] | 272 |
|
---|
| 273 | <sect3><title>initdb</title>
|
---|
| 274 | <para><command>initdb</command> create a new database cluster.</para></sect3>
|
---|
| 275 |
|
---|
| 276 | <sect3><title>initlocation</title>
|
---|
| 277 | <para><command>initlocation</command> creates a secondary database storage
|
---|
| 278 | area.</para></sect3>
|
---|
| 279 |
|
---|
| 280 | <sect3><title>ipcclean</title>
|
---|
[78d0e3c] | 281 | <para><command>ipcclean</command> removes shared memory and semaphores left
|
---|
| 282 | over by an aborted database server.</para></sect3>
|
---|
[08254fc] | 283 |
|
---|
| 284 | <sect3><title>pg_config</title>
|
---|
| 285 | <para><command>pg_config</command> retrieves
|
---|
| 286 | <application>Postgre<acronym>SQL</acronym></application> version
|
---|
| 287 | information.</para></sect3>
|
---|
| 288 |
|
---|
| 289 | <sect3><title>pg_controldata</title>
|
---|
| 290 | <para><command>pg_controldata</command> returns information initialized during
|
---|
| 291 | <command>initdb</command>, such as the catalog version and server
|
---|
| 292 | locale.</para></sect3>
|
---|
| 293 |
|
---|
| 294 | <sect3><title>pg_ctl</title>
|
---|
| 295 | <para><command>pg_ctl</command> controls stopping and starting the database
|
---|
| 296 | server.</para></sect3>
|
---|
| 297 |
|
---|
| 298 | <sect3><title>pg_dump</title>
|
---|
[78d0e3c] | 299 | <para><command>pg_dump</command> dumps database data and metadata into scripts
|
---|
| 300 | which are used to recreate the database.</para></sect3>
|
---|
[08254fc] | 301 |
|
---|
| 302 | <sect3><title>pg_dumpall</title>
|
---|
| 303 | <para><command>pg_dumpall</command> recursively calls
|
---|
| 304 | <command>pg_dump</command> for each database in a
|
---|
| 305 | cluster.</para></sect3>
|
---|
| 306 |
|
---|
| 307 | <sect3><title>pg_resetxlog</title>
|
---|
[78d0e3c] | 308 | <para><command>pg_resetxlog</command> clears the write-ahead log and optionally
|
---|
| 309 | resets some fields in the <filename>pg_control</filename> file.</para></sect3>
|
---|
[08254fc] | 310 |
|
---|
| 311 | <sect3><title>pg_restore</title>
|
---|
| 312 | <para><command>pg_restore</command> creates databases from dump files created by
|
---|
| 313 | <command>pg_dump</command>.</para></sect3>
|
---|
| 314 |
|
---|
| 315 | <sect3><title>pgtclsh</title>
|
---|
| 316 | <para><command>pgtclsh</command> is a <application>Tcl</application>
|
---|
| 317 | shell interface extended with
|
---|
| 318 | <application>Postgre<acronym>SQL</acronym></application> database access
|
---|
| 319 | functions.</para></sect3>
|
---|
| 320 |
|
---|
| 321 | <sect3><title>pgtksh</title>
|
---|
| 322 | <para><command>pgtksh</command> is a
|
---|
| 323 | <application>Tcl</application>/<application>Tk</application> shell
|
---|
| 324 | interface extended with
|
---|
| 325 | <application>Postgre<acronym>SQL</acronym></application> database access
|
---|
| 326 | functions.</para></sect3>
|
---|
| 327 |
|
---|
| 328 | <sect3><title>postgres</title>
|
---|
[78d0e3c] | 329 | <para><command>postgres</command> is a single user database server, generally
|
---|
| 330 | used for debugging.</para></sect3>
|
---|
[08254fc] | 331 |
|
---|
| 332 | <sect3><title>postmaster</title>
|
---|
[78d0e3c] | 333 | <para><command>postmaster</command> is the multi-user database daemon.</para>
|
---|
| 334 | </sect3>
|
---|
[08254fc] | 335 |
|
---|
| 336 | <sect3><title>psql</title>
|
---|
| 337 | <para><command>psql</command> is a console based database shell.</para></sect3>
|
---|
| 338 |
|
---|
| 339 | <sect3><title>vacuumdb</title>
|
---|
[78d0e3c] | 340 | <para><command>vacuumdb</command> compacts databases and generates statistics
|
---|
| 341 | for the query analyzer.</para></sect3>
|
---|
[08254fc] | 342 |
|
---|
| 343 | </sect2>
|
---|
[458342f] | 344 |
|
---|
| 345 | </sect1>
|
---|