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