[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">
|
---|
| 9 | <!ENTITY postgresql-size "9.7 MB">
|
---|
| 10 | <!ENTITY postgresql-buildsize "80 MB">
|
---|
| 11 | <!ENTITY postgresql-time "1.21 SBU">
|
---|
| 12 | ]>
|
---|
| 13 |
|
---|
[458342f] | 14 | <sect1 id="postgresql" xreflabel="PostgreSQL-&postgresql-version;">
|
---|
[00bb024c] | 15 | <?dbhtml filename="postgresql.html"?>
|
---|
[458342f] | 16 | <title>Postgre<acronym>SQL</acronym>-&postgresql-version;</title>
|
---|
| 17 |
|
---|
[08254fc] | 18 | <sect2>
|
---|
| 19 | <title>Introduction to <application>Postgre<acronym>SQL</acronym></application></title>
|
---|
| 20 |
|
---|
| 21 | <para><application>Postgre<acronym>SQL</acronym></application> is an advanced object-relational
|
---|
| 22 | database management system (<acronym>ORDBMS</acronym>), derived from the
|
---|
| 23 | Berkeley Postgres database management system.</para>
|
---|
| 24 |
|
---|
| 25 | <sect3><title>Package information</title>
|
---|
| 26 | <itemizedlist spacing='compact'>
|
---|
| 27 | <listitem><para>Download (HTTP): <ulink url="&postgresql-download-http;"/></para></listitem>
|
---|
| 28 | <listitem><para>Download (FTP): <ulink url="&postgresql-download-ftp;"/></para></listitem>
|
---|
| 29 | <listitem><para>Download size: &postgresql-size;</para></listitem>
|
---|
| 30 | <listitem><para>Estimated Disk space required: &postgresql-buildsize;</para></listitem>
|
---|
| 31 | <listitem><para>Estimated build time: &postgresql-time;</para></listitem></itemizedlist>
|
---|
| 32 | </sect3>
|
---|
| 33 |
|
---|
| 34 | <!--
|
---|
| 35 | <note><para>The C++ and ODBC bindings have been removed from the main
|
---|
| 36 | source distribution. They can be found at the
|
---|
| 37 | <application>Postgre<acronym>SQL</acronym></application> Projects Web
|
---|
| 38 | Site at: <ulink url="http://gborg.postgresql.org" />.</para></note>
|
---|
| 39 | -->
|
---|
| 40 |
|
---|
| 41 | <sect3><title><application>Postgre<acronym>SQL</acronym></application> dependencies</title>
|
---|
| 42 | <sect4><title>Optional</title>
|
---|
| 43 | <para>
|
---|
| 44 | <xref linkend="readline"/>,
|
---|
| 45 | <xref linkend="Python"/>,
|
---|
| 46 | <xref linkend="tcl"/>,
|
---|
| 47 | <xref linkend="tk"/>,
|
---|
| 48 | <xref linkend="openssl"/>,
|
---|
| 49 | <xref linkend="Linux_PAM"/>,
|
---|
| 50 | <ulink url="http://www.pdc.kth.se/kth-krb/">krb4</ulink>,
|
---|
| 51 | <xref linkend="mitkrb"/> or <xref linkend="heimdal"/>,
|
---|
| 52 | <ulink url="http://ant.apache.org/">Ant</ulink> and
|
---|
| 53 | <ulink url="http://rendezvous.sourceforge.net/">Rendezvous</ulink>
|
---|
| 54 | </para></sect4>
|
---|
| 55 | </sect3>
|
---|
| 56 |
|
---|
| 57 | </sect2>
|
---|
| 58 |
|
---|
| 59 | <sect2>
|
---|
| 60 | <title>Installation of <application>Postgre<acronym>SQL</acronym></application></title>
|
---|
| 61 |
|
---|
| 62 | <para>Install <application>Postgre<acronym>SQL</acronym></application> with the following commands: </para>
|
---|
| 63 |
|
---|
| 64 | <screen><userinput><command>./configure --prefix=/usr &&
|
---|
| 65 | make &&
|
---|
| 66 | make install</command></userinput></screen>
|
---|
| 67 |
|
---|
[11404f5] | 68 | <para>The standard installation provides only the header files needed
|
---|
| 69 | for client application development. Server-side applications require
|
---|
| 70 | the entire <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 71 | include tree which can be installed using the following command:</para>
|
---|
| 72 |
|
---|
| 73 | <screen><userinput><command>make install-all-headers</command></userinput></screen>
|
---|
| 74 |
|
---|
[08254fc] | 75 | <note><para>If you are upgrading an existing system and are going to
|
---|
| 76 | install the new files over the old ones, then you should
|
---|
| 77 | back up your data, shut down the old server and follow the
|
---|
| 78 | instructions in <ulink
|
---|
| 79 | url="http://www.postgresql.org/docs/7.4/static/install-upgrading.html">the
|
---|
| 80 | official <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 81 | documentation</ulink>.</para></note>
|
---|
| 82 |
|
---|
| 83 | <para>Initialize a database cluster with the following commands:</para>
|
---|
| 84 |
|
---|
| 85 | <screen><userinput><command>mkdir -p /var/pgsql/data &&
|
---|
| 86 | useradd -d /var/pgsql/data postgres &&
|
---|
| 87 | chown postgres /var/pgsql/data &&
|
---|
| 88 | su - postgres -c '/usr/bin/initdb -D /var/pgsql/data'</command></userinput></screen>
|
---|
| 89 |
|
---|
| 90 | <para>Start the database server with the following command:</para>
|
---|
| 91 |
|
---|
| 92 | <screen><userinput><command>su - postgres -c '/usr/bin/postmaster -D /var/pgsql/data > \
|
---|
| 93 | /var/pgsql/data/logfile 2>&1 &'</command></userinput></screen>
|
---|
| 94 |
|
---|
| 95 | <para>Create a database and verify the installation:</para>
|
---|
| 96 |
|
---|
| 97 | <screen><userinput><command>su - postgres -c '/usr/bin/createdb test' &&
|
---|
| 98 | echo "create table t1 ( name varchar(20), state_province varchar(20) );" \
|
---|
| 99 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 100 | echo "insert into t1 values ('Billy', 'NewYork');" \
|
---|
| 101 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 102 | echo "insert into t1 values ('Evanidus', 'Quebec');" \
|
---|
| 103 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 104 | echo "insert into t1 values ('Jesse', 'Ontario');" \
|
---|
| 105 | | (su - postgres -c '/usr/bin/psql test ') &&
|
---|
| 106 | echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test')</command></userinput></screen>
|
---|
| 107 |
|
---|
| 108 | </sect2>
|
---|
| 109 |
|
---|
| 110 | <sect2>
|
---|
| 111 | <title>Command explanations</title>
|
---|
| 112 |
|
---|
| 113 | <para><command>useradd -d /var/pgsql/data postgres</command>: Add an unprivileged user to run the database server.</para>
|
---|
| 114 |
|
---|
| 115 | <para><command>createdb test, create table t1 , insert into t1 values..., select *
|
---|
| 116 | from t1</command>: Create a database, add a table to it, insert some rows into the table
|
---|
| 117 | and select them to verify that the installation is working
|
---|
| 118 | properly.</para>
|
---|
| 119 |
|
---|
| 120 | </sect2>
|
---|
| 121 |
|
---|
| 122 | <sect2>
|
---|
| 123 | <title>Configuring <application>Postgre<acronym>SQL</acronym></application></title>
|
---|
| 124 |
|
---|
| 125 | <sect3>
|
---|
| 126 | <title>Config files</title>
|
---|
| 127 |
|
---|
| 128 | <para><filename>$PGDATA/pg_ident.con</filename>, <filename>$PGDATA/pg_hba.conf</filename>, <filename>$PGDATA/postgresql.conf</filename></para>
|
---|
| 129 |
|
---|
| 130 | <para>The <envar>PGDATA</envar> environment variable is used to distinguish database
|
---|
| 131 | clusters from one another by setting it to the value of the directory
|
---|
| 132 | which contains the cluster desired. The three configuration files
|
---|
| 133 | exist in every <filename class="directory">PGDATA/</filename> directory.
|
---|
| 134 | Details on the format of the files and the options that can be set in
|
---|
| 135 | each can be found in <ulink
|
---|
| 136 | url="file:///usr/share/doc/postgresql/html/index.html"/>.</para>
|
---|
| 137 |
|
---|
| 138 | <para>Install the <filename>/etc/rc.d/init.d/postgresql</filename>
|
---|
| 139 | init script included in the <xref linkend="intro-important-bootscripts"/> package.</para>
|
---|
| 140 |
|
---|
| 141 | <screen><userinput><command>make install-postgresql</command></userinput></screen>
|
---|
| 142 |
|
---|
| 143 | </sect3>
|
---|
| 144 |
|
---|
| 145 | </sect2>
|
---|
| 146 |
|
---|
| 147 | <sect2>
|
---|
| 148 | <title>Contents</title>
|
---|
| 149 |
|
---|
| 150 | <para>The <application>Postgre<acronym>SQL</acronym></application> package contains
|
---|
| 151 | <command>clusterdb</command>,
|
---|
| 152 | <command>createdb</command>,
|
---|
| 153 | <command>createlang</command>,
|
---|
| 154 | <command>createuser</command>,
|
---|
| 155 | <command>dropdb</command>,
|
---|
| 156 | <command>droplang</command>,
|
---|
| 157 | <command>dropuser</command>,
|
---|
| 158 | <command>ecpg</command>,
|
---|
| 159 | <command>initdb</command>,
|
---|
| 160 | <command>initlocation</command>,
|
---|
| 161 | <command>ipcclean</command>,
|
---|
| 162 | <command>pg_config</command>,
|
---|
| 163 | <command>pg_controldata</command>,
|
---|
| 164 | <command>pg_ctl</command>,
|
---|
| 165 | <command>pg_dump</command>,
|
---|
| 166 | <command>pg_dumpall</command>,
|
---|
| 167 | <command>pg_encoding</command>,
|
---|
| 168 | <command>pg_id</command>,
|
---|
| 169 | <command>pg_resetxlog</command>,
|
---|
| 170 | <command>pg_restore</command>,
|
---|
| 171 | <command>pgtclsh</command>,
|
---|
| 172 | <command>pgtksh</command>,
|
---|
| 173 | <command>pltcl_delmod</command>,
|
---|
| 174 | <command>pltcl_listmod</command>,
|
---|
| 175 | <command>pltcl_loadmod</command>,
|
---|
| 176 | <command>postgres</command>,
|
---|
| 177 | <command>postmaster</command>,
|
---|
| 178 | <command>psql</command>,
|
---|
| 179 | <command>vacuumdb</command>,
|
---|
| 180 | <filename class="libraryfile">libecpg</filename>,
|
---|
| 181 | <filename class="libraryfile">libpgtcl</filename>,
|
---|
| 182 | <filename class="libraryfile">libpgtypes</filename>,
|
---|
| 183 | <filename class="libraryfile">libpq</filename> and various charset
|
---|
| 184 | modules.</para>
|
---|
| 185 |
|
---|
| 186 | </sect2>
|
---|
| 187 |
|
---|
| 188 | <sect2><title>Description</title>
|
---|
| 189 |
|
---|
| 190 | <sect3><title>clusterdb</title>
|
---|
| 191 | <para><command>clusterdb</command> is a utility for reclustering tables
|
---|
| 192 | in a <application>Postgre<acronym>SQL</acronym></application>
|
---|
| 193 | database.</para></sect3>
|
---|
| 194 |
|
---|
| 195 | <sect3><title>createdb</title>
|
---|
| 196 | <para><command>createdb</command> creates a new
|
---|
| 197 | <application>Postgre<acronym>SQL</acronym></application> database.</para></sect3>
|
---|
| 198 |
|
---|
| 199 | <sect3><title>createlang</title>
|
---|
| 200 | <para><command>createlang</command> defines a new
|
---|
| 201 | <application>Postgre<acronym>SQL</acronym></application> procedural
|
---|
| 202 | language.</para></sect3>
|
---|
| 203 |
|
---|
| 204 | <sect3><title>createuser</title>
|
---|
| 205 | <para><command>createuser</command> defines a new
|
---|
| 206 | <application>Postgre<acronym>SQL</acronym></application> user account.</para></sect3>
|
---|
| 207 |
|
---|
| 208 | <sect3><title>dropdb</title>
|
---|
| 209 | <para><command>dropdb</command> removes a
|
---|
| 210 | <application>Postgre<acronym>SQL</acronym></application> database.</para></sect3>
|
---|
| 211 |
|
---|
| 212 | <sect3><title>droplang</title>
|
---|
| 213 | <para><command>droplang</command> removes a
|
---|
| 214 | <application>Postgre<acronym>SQL</acronym></application> procedural
|
---|
| 215 | language.</para></sect3>
|
---|
| 216 |
|
---|
| 217 | <sect3><title>dropuser</title>
|
---|
| 218 | <para><command>dropuser</command> removes a
|
---|
| 219 | <application>Postgre<acronym>SQL</acronym></application> user account.</para></sect3>
|
---|
| 220 |
|
---|
| 221 | <sect3><title>ecpg</title>
|
---|
| 222 | <para><command>ecpg</command> is the embedded <acronym>SQL</acronym> preprocessor.</para></sect3>
|
---|
| 223 |
|
---|
| 224 | <sect3><title>initdb</title>
|
---|
| 225 | <para><command>initdb</command> create a new database cluster.</para></sect3>
|
---|
| 226 |
|
---|
| 227 | <sect3><title>initlocation</title>
|
---|
| 228 | <para><command>initlocation</command> creates a secondary database storage
|
---|
| 229 | area.</para></sect3>
|
---|
| 230 |
|
---|
| 231 | <sect3><title>ipcclean</title>
|
---|
| 232 | <para><command>ipcclean</command> removes shared memory and semaphores left over by an
|
---|
| 233 | aborted database server.</para></sect3>
|
---|
| 234 |
|
---|
| 235 | <sect3><title>pg_config</title>
|
---|
| 236 | <para><command>pg_config</command> retrieves
|
---|
| 237 | <application>Postgre<acronym>SQL</acronym></application> version
|
---|
| 238 | information.</para></sect3>
|
---|
| 239 |
|
---|
| 240 | <sect3><title>pg_controldata</title>
|
---|
| 241 | <para><command>pg_controldata</command> returns information initialized during
|
---|
| 242 | <command>initdb</command>, such as the catalog version and server
|
---|
| 243 | locale.</para></sect3>
|
---|
| 244 |
|
---|
| 245 | <sect3><title>pg_ctl</title>
|
---|
| 246 | <para><command>pg_ctl</command> controls stopping and starting the database
|
---|
| 247 | server.</para></sect3>
|
---|
| 248 |
|
---|
| 249 | <sect3><title>pg_dump</title>
|
---|
| 250 | <para><command>pg_dump</command> dumps database data and metadata into scripts which are
|
---|
| 251 | used to recreate the database.</para></sect3>
|
---|
| 252 |
|
---|
| 253 | <sect3><title>pg_dumpall</title>
|
---|
| 254 | <para><command>pg_dumpall</command> recursively calls
|
---|
| 255 | <command>pg_dump</command> for each database in a
|
---|
| 256 | cluster.</para></sect3>
|
---|
| 257 |
|
---|
| 258 | <sect3><title>pg_resetxlog</title>
|
---|
| 259 | <para><command>pg_resetxlog</command> clears the write-ahead log and optionally resets some
|
---|
| 260 | fields in the <filename>pg_control</filename> file.</para></sect3>
|
---|
| 261 |
|
---|
| 262 | <sect3><title>pg_restore</title>
|
---|
| 263 | <para><command>pg_restore</command> creates databases from dump files created by
|
---|
| 264 | <command>pg_dump</command>.</para></sect3>
|
---|
| 265 |
|
---|
| 266 | <sect3><title>pgtclsh</title>
|
---|
| 267 | <para><command>pgtclsh</command> is a <application>Tcl</application>
|
---|
| 268 | shell interface extended with
|
---|
| 269 | <application>Postgre<acronym>SQL</acronym></application> database access
|
---|
| 270 | functions.</para></sect3>
|
---|
| 271 |
|
---|
| 272 | <sect3><title>pgtksh</title>
|
---|
| 273 | <para><command>pgtksh</command> is a
|
---|
| 274 | <application>Tcl</application>/<application>Tk</application> shell
|
---|
| 275 | interface extended with
|
---|
| 276 | <application>Postgre<acronym>SQL</acronym></application> database access
|
---|
| 277 | functions.</para></sect3>
|
---|
| 278 |
|
---|
| 279 | <sect3><title>postgres</title>
|
---|
| 280 | <para><command>postgres</command> is a single user database server, generally used for
|
---|
| 281 | debugging.</para></sect3>
|
---|
| 282 |
|
---|
| 283 | <sect3><title>postmaster</title>
|
---|
| 284 | <para><command>postmaster</command> is the multi-user database daemon.</para></sect3>
|
---|
| 285 |
|
---|
| 286 | <sect3><title>psql</title>
|
---|
| 287 | <para><command>psql</command> is a console based database shell.</para></sect3>
|
---|
| 288 |
|
---|
| 289 | <sect3><title>vacuumdb</title>
|
---|
| 290 | <para><command>vacuumdb</command> compacts databases and generates statistics for the
|
---|
| 291 | query analyzer.</para></sect3>
|
---|
| 292 |
|
---|
| 293 | </sect2>
|
---|
[458342f] | 294 |
|
---|
| 295 | </sect1>
|
---|