home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre2.z / postgre2 / doc / postgres-setup < prev    next >
Encoding:
Text File  |  1992-08-27  |  34.4 KB  |  1,150 lines

  1. .\" 
  2. .\" POSTGRES Data Base Management System
  3. .\" 
  4. .\" Copyright (c) 1988 Regents of the University of California
  5. .\" 
  6. .\" Permission to use, copy, modify, and distribute this software and its
  7. .\" documentation for educational, research, and non-profit purposes and
  8. .\" without fee is hereby granted, provided that the above copyright
  9. .\" notice appear in all copies and that both that copyright notice and
  10. .\" this permission notice appear in supporting documentation, and that
  11. .\" the name of the University of California not be used in advertising
  12. .\" or publicity pertaining to distribution of the software without
  13. .\" specific, written prior permission.  Permission to incorporate this
  14. .\" software into commercial products can be obtained from the Campus
  15. .\" Software Office, 295 Evans Hall, University of California, Berkeley,
  16. .\" Ca., 94720.  The University of California makes no representations
  17. .\" about the suitability of this software for any purpose.  It is
  18. .\" provided "as is" without express or implied warranty.
  19. .\" 
  20. .\" ----------------------------------------------------------------
  21. .\"    POSTGRES version 4.0.1 setup instructions
  22. .\"
  23. .\" ----------------------------------------------------------------
  24. .de RV
  25. .ie "\\$2"" \
  26. \{\
  27. .    ds VT "<No Title>
  28. .    ds VN "<Unaudited Revision>
  29. .    ds VD \*(td
  30. .\}
  31. .el \
  32. \{\
  33. .    ds VT \\$7
  34. .    ds VD \\$4
  35. .    ds VN \\$3
  36. .\}
  37. ..
  38. .hx
  39. .fo ''%''
  40. .ce 99
  41. .ps 18
  42. .b
  43. POSTGRES INSTALLATION INSTRUCTIONS
  44. .r
  45. .ps 14
  46. .sp 0.25v
  47. C-Only Release 4.0.1
  48. .sp 0.25v
  49. .ce 0
  50. .sp
  51. .\" ----------------
  52. .tm    Document Overview
  53. .\" ----------------
  54. .ds PG "\\s-2POSTGRES\\s+2
  55. .sh 0 "Document Overview"
  56. .(l
  57.     Document Overview
  58.     Introduction
  59.     Site Requirements
  60.     Hardware
  61.     Software
  62.     Distribution Tape
  63.     Expertise
  64.     Configuration
  65.         Operating System
  66.         Disk Partition
  67.         Swap Partition
  68.         Kernel
  69.         Lisp
  70.     Installing \*(PG
  71.     Overview
  72.     Preparation
  73.         Finding Space for \*(PG
  74.         Creating /usr/postgres
  75.         Creating the \*(lqpostgres\*(rq user
  76.     Loading
  77.         Loading \*(PG
  78.     Configuration
  79.         Kernel reconfiguration
  80.         Configuring \*(PG
  81.     Compiling
  82.         Compiling \*(PG
  83.         Creating the initial database
  84.     Testing
  85.         Testing \*(PG
  86.     Running \*(PG
  87.     The \*(PG Postmaster
  88.     The \*(PG Terminal Monitor
  89.     The \*(PG Backend
  90.     \*(PG Support Programs
  91.     Optional Installation
  92.     Installing LIBPQ, the \*(PG frontend library
  93.     Performance Tuning
  94.     Demo Database
  95.     Minimal Installation
  96.     Documentation
  97.     Printing the Manual and Reference
  98.         If you do not have a Postscript printer
  99.     Printing the Technical Reports and Tutorials
  100.         If the directory has a makefile
  101.     Miscellaneous
  102.     Bug Reports
  103.     Known Bug List
  104.     Consulting
  105.     Postgres BBS
  106. .)l
  107. .bp
  108. .\" ----------------
  109. .tm    Introduction
  110. .\" ----------------
  111. .sh 1 "Introduction"
  112. .pp
  113. This document gives installation instructions for the \*(PG
  114. database system under development at the University of
  115. California, Berkeley.
  116. \*(PG is distributed in source code format and is the
  117. property of the Regents of the University of California.
  118. However, the University will grant unlimited commercialization
  119. rights for any derived work on the condition that it
  120. obtain an educational license to the derived work.
  121. For further information, consult the Berkeley Campus
  122. Software Office, 295 Evans Hall, University of
  123. California, Berkeley, CA 94720.
  124. .pp
  125. The University and the \*(PG development group
  126. provide no warranty as to the fitness of the code for
  127. any purpose whatsoever,
  128. and cannot guarantee to assist in fixing problems.
  129. This is *unsupported* software.
  130. .\" ----------------
  131. .tm    Site Requirements
  132. .\" ----------------
  133. .sh 1 "Site Requirements"
  134. .pp
  135. .sh 2 "Hardware"
  136. .pp
  137. \*(PG currently has been tested by the Postgres development team on Sun
  138. Microsystems 3/xx family of
  139. processors with SunOS 3.4, or 3.5, and 4.0, and Sparc architecture machines
  140. (Sparcstation and Sun 4) running SunOS 4.0 and higher.  Postgres is also
  141. supported on DECstations 3100's and 5000's running Ultrix 4.0 and higher.
  142. Tested but unsupported ports for DECstation Ultrix lower than 4.0
  143. are included.  These ports are unsupported for
  144. the following reasons: the old Ultrix dynamic loader is quite buggy.
  145. In order to use \*(PG,
  146. your machine should have at least 8 megabytes of memory
  147. and you will require at least 45 megabytes of disk space
  148. to hold source,
  149. binaries,
  150. and user databases.
  151. If you choose to compile \*(PG for source-level debugging,
  152. you will need roughly twice as much disk space.
  153. See the section on compilation for details.
  154. .pp
  155. The DECstation version requires a kernel which allows 4 megabytes of
  156. shared memory.
  157. .sh 2 "Software"
  158. .pp
  159. This implementation of \*(PG is completely in C.
  160. The distribution contains no Lisp or C++ code.
  161. .sh 2 "Distribution tape"
  162. .pp
  163. These instructions assume you have a \*(PG Version 4.0.1
  164. distribution tape (in either 9 track, SCSI cartridge, or TK50 cartridge
  165. format)
  166. or a \*(PG tar file.
  167. .sh 2 "Expertise"
  168. .pp
  169. Once a site is properly configured and \*(PG is properly installed,
  170. very little UNIX expertise is required to maintain things.
  171. However,
  172. initially setting things up for your site to run \*(PG
  173. may be difficult and we advise that the person installing
  174. \*(PG be familiar with the various system administration
  175. procedures.
  176. Also note that various
  177. steps require superuser authority on the system,
  178. so we advise
  179. that your site's system administrator read this document also.
  180. .sh 2 "Configuration"
  181. .pp
  182. This section briefly describes the configuration you
  183. need to run \*(PG.
  184. Read this to familiarize
  185. yourself with the procedure.
  186. Detailed instructions for making
  187. appropriate modifications to your system are given later in this
  188. document.
  189. .sh 3 "Operating System"
  190. .pp
  191. \*(PG expects things to be configured for BSD by default.
  192. If the default on your site is to use the SunOS SysV compiler
  193. and libraries then you may have to make some changes to this
  194. procedure before compiling \*(PG.
  195. .pp
  196. One exception to this rule is that we use Sun's SysV-compatible
  197. .i make
  198. to build the system.
  199. This is the version of
  200. .i make
  201. that is installed in both the BSD and SysV environments on Suns,
  202. so this should pose no problems on these platforms.  We have no
  203. problems on DECstations either.
  204. .sh 3 "Disk Partition"
  205. .pp
  206. \*(PG requires 45 megabytes of disk space,
  207. preferably on a single partition.
  208. If you don't have enough space,
  209. it is still possible to compile and run \*(PG but you will have to
  210. modify the installation scripts.
  211. .sh 3 "Kernel"
  212. .pp
  213. \*(PG makes use of the optional System V shared memory operations
  214. provided by SunOS, DEC Ultrix, and Dynix,
  215. which require a properly configured kernel which is in general different
  216. than the factory-shipped "generic" kernel.
  217. See the section on kernel configuration for details.
  218. .\" ----------------
  219. .tm    Installation
  220. .\" ----------------
  221. .sh 1 "Installing \*(PG"
  222. .pp
  223. \*(PG installation consists of the following steps:
  224. .ip \0\0\0\(bu
  225. Preparation
  226. .ip \0\0\0\(bu
  227. Loading
  228. .ip \0\0\0\(bu
  229. Configuration
  230. .ip \0\0\0\(bu
  231. Compilation
  232. .ip \0\0\0\(bu
  233. Testing
  234. .lp
  235. Each of these steps is described below.
  236. It is advised that you read over
  237. each of these steps carefully before beginning the installation.
  238. .\" ----------------
  239. .tm    Preparation
  240. .\" ----------------
  241. .sh 2 "Step 1 \- Preparation"
  242. .pp
  243. Some of the tasks involved in this step normally fall in
  244. the domain of the site's system administrator and may require
  245. superuser authority.
  246. If possible,
  247. we advise you to have your
  248. system administrator perform these steps.
  249. .sh 3 "Find a good place for \*(PG"
  250. .pp
  251. You should locate a disk partition with
  252. at least 45 megabytes of free space available for \*(PG.
  253. If you haven't any single partition with 25 megabytes free,
  254. you might have to spread apart the \*(PG directories across several
  255. partitions,
  256. and glue them together with symbolic links.
  257. .sh 3 "Creating the \*(PG directory"
  258. .pp
  259. Once you have located a partition with enough space,
  260. create a directory called
  261. .q postgres
  262. someplace on this partition.
  263. Then \fBcd\fR to this directory and type \fBpwd\fR.
  264. This is the full
  265. path of the directory you will install postgres in.
  266. Write it down in preparation for the next step.
  267. For example:
  268. .sp
  269. .(l
  270. # \fBdf\fR
  271. Filesystem    kbytes    used    avail    capacity  Mounted on
  272. /dev/xy0a      8421      6703      875       88%        /
  273. /dev/xy0f     10829      6743     3003       69%      /pub.MC68020
  274. /dev/xy2h    110811   81181  18548       81%      /usr3
  275. /dev/xy2g    221279  167405  31746       84%      /b
  276. /dev/xy1g    221279  138365  60786       69%      /public
  277. /dev/xy1a      8179       944     6417       13%      /tmp
  278. /dev/xy0h    119999  101623     6376       94%      /usr.MC68020
  279. /dev/xy0g    156033  135499     4930       96%      /usr2
  280. /dev/rf0d    539421  465026  20452       96%      /a
  281. .i
  282.     /public looks like a good place (it has 60 megs free) so we decide
  283.     to create the postgres directory there...
  284. .r
  285. # \fBcd /public\fR
  286. # \fBmkdir postgres\fR
  287. # \fBcd postgres\fR
  288. # \fBpwd\fR
  289. /public/postgres
  290. #
  291. .)l
  292. .sh 2 "Creating /usr/postgres"
  293. .pp
  294. \*(PG expects to be
  295. .i logically
  296. installed in a directory
  297. called
  298. .q /usr/postgres ,
  299. so you must create a symbolic link
  300. from /usr/postgres to whatever directory you created in the
  301. previous step.
  302. In our example,
  303. we would now type:
  304. .sp
  305. .(l
  306. # \fBln -s  /public/postgres  /usr/postgres\fR
  307. .)l
  308. .sh 2 "Creating the \*(lqpostgres\*(rq user"
  309. .pp
  310. Finally, we need to create a user called \*(lqpostgres\*(rq whose
  311. shell is /bin/csh and whose home directory is /usr/postgres.
  312. This can be done using the "adduser" procedures particular to your
  313. platform and site.  See your system administration manual for details.
  314. .lp
  315. .b Note:
  316. .pp
  317. Due to a bug in this release, the "postgres" user must be user 6 (six).
  318. Otherwise, you may encounter problems with backends hanging, etc.
  319. See the 
  320. .b Release
  321. .b Notes
  322. (described in Section 6.2 of this document)
  323. for instructions on how to get around this problem
  324. if it causes problems at your site.  If it is not convienent for you to make
  325. the "postgres" user userid 6, complete the below instructions on
  326. .b Loading
  327. \*(PG,
  328. but read the 
  329. .b Release
  330. .b Notes
  331. notes on how to get around this problem
  332. .b before
  333. continuing on to the
  334. .b Configuration
  335. section.
  336. .pp
  337. .\" ----------------
  338. .tm    Loading
  339. .\" ----------------
  340. .sh 2 "Step 2 - Loading \*(PG"
  341. .pp
  342. After completing step 1 (Preparation),
  343. you should be ready to load
  344. the \*(PG files onto your system.
  345. To do this,
  346. you will need either
  347. a distribution tape or a \*(PG tar file.
  348. .pp
  349. If you are loading \*(PG from a tape, follow these instructions;
  350. if you are loading from a tar file obtained via FTP, skip to the
  351. section "Loading \*(PG from a Tar File".
  352. .sh 3 "Loading \*(PG from a Tape"
  353. .pp
  354. Login as postgres.
  355. .pp
  356. 3.  Run "tar" with the "extract, verbose, file" options:
  357. .pp
  358. % tar xvf <tape-device>
  359. .sp
  360. where <tape-device> is the name for your tape device, i.e.,
  361. /dev/rmt0, /dev/rst8, etc.
  362. .pp
  363. The file "postgres-v4r0r1.tar.Z" will appear in your \*(PG home directory.
  364. You may need to re-wind your tape to get it out of your tape
  365. drive - see your system administrator for instructions.
  366. .pp
  367. Please proceed to the section "Loading \*(PG from a Tar File".
  368. .pp
  369. .sh 2 "Loading \*(PG from a Tar File"
  370. .pp
  371. If you are not logged in as \*(PG already, log in as \*(PG.
  372. Make sure your current working directory is the \*(PG home
  373. directory, and that the \*(PG tar file is there.
  374. For the purpose of this discussion, the \*(PG tar file will be called
  375. .pp
  376. postgres-v4r0r1.tar.Z
  377. .pp
  378. Uncompress the tar file.
  379. .pp
  380. % uncompress postgres-v4r0r1.tar.Z
  381. .pp
  382. A larger file should now be in the \*(PG home directory, and the '.Z'
  383. ending should be gone, so it is now named
  384. .pp
  385. postgres-v4r0r1.tar
  386. .pp
  387. Extract \*(PG from the tar file, using the "extract, verbose, file"
  388. options:
  389. .pp
  390. % tar xvf postgres-v4r0r1.tar
  391. .pp
  392. Lots of file names and such should appear on the screen.
  393. This step may take several minutes.
  394. .pp
  395. Now do an "ls":
  396. .pp
  397. The output of the ls should look something like:
  398. .(l
  399. COPYRIGHT    bench/    demo/    newconf/    src/
  400. README    doc/    ref/    test/    sample/    video/
  401. .)l
  402. .pp
  403. At this point you have loaded the \*(PG files.
  404. Other directories will be created by the installation process.
  405. .sp
  406. .\" ----------------
  407. .tm    Configuration
  408. .\" ----------------
  409. .sh 2 "Step 3 - Configuration"
  410. .pp
  411. This step requires familiarity with configuring a UNIX kernel.
  412. If you are unfamiliar with this procedure,
  413. we advise you to read the
  414. section on configuring a kernel in the SunOS or DEC system administration
  415. manual carefully.
  416. This task requires superuser authority and should
  417. probably not be done without the assistance of your system administrator.
  418. We assume that whoever undergoes this procedure has an understanding
  419. of the process and procedures involved.
  420. .pp
  421. \*(PG uses shared memory segments which must be compiled into the
  422. kernel of the host which will act as the \*(PG server.
  423. If you try to run a postgres backend process on a machine without enough
  424. shared memory, the backend will abort with an error message.
  425. .pp
  426. This is by far the most complicated part of the installation
  427. so these steps should be performed by someone with system administration
  428. experience.  Again, we advise you to consult
  429. the system administration section of your manual
  430. before doing this step.
  431. .pp
  432. For a brief discussion of shared memory,
  433. you may want to consult the Man pages for \fIshmget()\fR,
  434. \fIshmop()\fR, \fIshmctl()\fR, etc.  Now proceed to the appropriate
  435. section for your machine.
  436. .pp
  437. .sh 3 "Kernel reconfiguration for Suns and Sparcs"
  438. .pp
  439. In order to reconfigure Sun or Sparc kernel, you will have to become root
  440. and add some lines to /usr/sys/conf (your kernel config file)
  441. and /usr/sys/conf/param.c (your kernel parameters file).
  442. We
  443. .i strongly
  444. advise you to make a spare copy of your system's original config
  445. and parameter files before you make any changes.
  446. .lp
  447. The following lines should be added to /usr/sys/conf/KERNEL:
  448. .sp
  449. .(l
  450. options        IPCMESSAGE        # SystemV IPC Message Facility 
  451. options        IPCSEMAPHORE    # SystemV IPC Semaphore Facility
  452. options        IPCSHMEM        # SystemV IPC Shared-Memory Facility
  453. options        EMOREIPCS    # more semaphores and shared memory (for 8M)
  454. .)l
  455. .sp
  456. .lp
  457. At Berkeley, we substitute the line: 
  458. .(l 
  459. options        EMOREIPCS    # more semaphores and shared memory (for 8M)
  460. .)l
  461. .lp
  462. with the line:
  463. .(l
  464. options        TTMOREIPCS    # more semaphores and shared memory (for 32M)
  465. .)l
  466. .lp
  467. to allocate more shared memory so that we can run more \*(PG backends
  468. at the same time.  Either of the lines will result in a kernel that
  469. has enough shared memory allocated.
  470. .lp
  471. Also add the following lines to the \fItop\fR of /usr/sys/conf/param.c:
  472. .sp
  473. .(l
  474. /*
  475.  * LOCAL DEFINITIONS START
  476.  */
  477.  
  478. #ifdef    EMORESEMS
  479. #define EMOREIPCS
  480. #endif    /* defined(EMORESEMS) */
  481.  
  482. #ifdef    TTMORESEMS
  483. #define TTMOREIPCS
  484. #endif    /* defined(TTMORESEMS) */
  485.  
  486. #ifdef    EMOREIPCS
  487. #define SEMMNI        30    /* # of semaphore identifiers */
  488. #define SEMMNS        180    /* # of semaphores in system */
  489. #define SEMUME        10    /* max # of undo entries per process */
  490. #define SEMMNU        30    /* # of undo structures in system */
  491.  
  492. #define SHMPOOL     1536        /* max total shared memory system wide (in Kbytes) */
  493. #define SHMSEG        6    /* max attached shared memory segments per process */
  494. #define SHMMNI        100    /* # of shared memory identifiers */
  495. #endif    /* defined(EMOREIPCS) */
  496.  
  497. #ifdef    TTMOREIPCS
  498. #define SEMMNI        60    /* # of semaphore identifiers */
  499. #define SEMMNS        384    /* # of semaphores in system */
  500. #define SEMUME        10    /* max # of undo entries per process */
  501. #define SEMMNU        30    /* # of undo structures in system */
  502.  
  503. #define SHMPOOL     8192        /* max total shared memory system wide (in Kbytes) */
  504. #define SHMSEG        6    /* max attached shared memory segments per process */
  505. #define SHMMNI        100    /* # of shared memory identifiers */
  506. #endif                /* defined(TTMOREIPCS) */
  507.  
  508. /*
  509.  * LOCAL DEFINITIONS END
  510.  */
  511. .)l
  512. .pp
  513. After adding these lines,
  514. run config over the config file,
  515. install the new kernel,
  516. and reboot.
  517. .sp
  518. .sh 3 "Kernel reconfiguration for DECs"
  519. .pp
  520. In order to reconfigure your DECstation 3100 or 5000 Ultrix kernel,
  521. you will have to become root and add some lines to /usr/sys/conf
  522. (your kernel config file).
  523. .sp
  524. The following lines should be added to /usr/sys/conf/KERNEL:
  525. .sp
  526. .(l
  527. smmax           256
  528. smseg           12
  529. smbrk           1024
  530. .)l
  531. .pp
  532. After adding these lines, run 
  533. .i config
  534. over the configuration file,
  535. install the new kernel, and reboot.
  536. .sp
  537. .\" ----------------
  538. .tm    Compiling
  539. .\" ----------------
  540. .sh 2 "Configuring \*(PG"
  541. .pp
  542. This release of \*(PG
  543. may require some configuration.
  544. For performance reasons, Postgres is by default compiled with the optimizer
  545. enabled and internal debugging assertions disabled.  If you plan to modify
  546. Postgres, you may want to enable debugging (note that this will take Postgres
  547. up to about 50 megs from about 45 megs otherwise), and enable internal
  548. debugging assertions.
  549. .pp
  550. To enable compiler directives, 
  551. read the file ./newconf/CONFIG/README
  552. for instructions on what to change.
  553. Now to edit the configuration file,
  554. .(l
  555. .sp 0.5v
  556. % \fBcd /usr/postgres/newconf/CONFIG\fP
  557. .sp 0.5v
  558. % \fBvi config.mk.<port>\fP
  559. .)l
  560. .pp
  561. where
  562. .i <port> is the following:
  563. .(l
  564. dec    \- DS3100 running Ultrix LOWER than 4.0
  565. ultrix4    \- DS3100, 5000, 5500, etc. running Ultrix 4.0 or higher
  566. sun    \- Sun 3 running SunOS 3.4 or 3.5
  567. sunos4    \- Sun 3 running SunOS 4.0 or higher
  568. sparc    \- Sparcstation or Sun 4
  569. .)l
  570. The
  571. .i only
  572. thing we recommend changing is the
  573. GCFLAGS variable.  Remember the
  574. .b port
  575. .b name
  576. used here as it is necessary for Step 4.
  577. .pp
  578. .sh 2 "Step 4 - Compiling and Installing \*(PG"
  579. Now you are ready to install Postgres.  To do so,
  580. simply execute the following commands:
  581. .(l
  582. % \fBcd ~postgres/newconf\fR
  583. % \fBsetenv POSTGRESHOME ~postgres\fR
  584. % \fB./Make install\fR
  585. .)l
  586. .pp
  587. .lp
  588. .i Make
  589. .i install
  590. will ask you for the port you wish to use.  Use the port name that you
  591. used in 
  592. .b Configuring
  593. \*(PG.
  594. You will also be asked for the name of the object tree directory;
  595. the default is ~postgres/obj.<port>.  (throughout the rest of this document
  596. obj.<port> refers to the object tree directory).  This step will take from
  597. about 40 minutes on Sparc II or DEC 5000 class machines to several hours
  598. on Sun 3's.
  599. The POSTGRESHOME environment variable is the home directory of the Postgres
  600. user.  In the course of the installation process, the Postgres
  601. .b bin
  602. and 
  603. .b data
  604. directories will be created and populated.
  605. .pp
  606. .i Make
  607. is a C shell script that runs
  608. .i make
  609. with Makefiles that are constructed on the fly.
  610. If you have problems at this point,
  611. it is possible that your
  612. .i \&.cshrc
  613. file does strange things \*-
  614. changes directories,
  615. sets or unsets environment variables,
  616. and so on.
  617. .pp
  618. You should see no errors during this phase, except possibly for warnings
  619. (which can be ignored) when compiling the output of
  620. .i yacc
  621. and
  622. .i lex.
  623. .sh 3 "Creating the initial database"
  624. .pp
  625. \*(PG databases are stored in the directory ~postgres/data.
  626. After you have compiled \*(PG,
  627. you will need to create the
  628. initial database.
  629. To do this,
  630. type 
  631. .(l
  632. % \fBsetenv POSTGRESHOME ~postgres\fR
  633. % \fB~postgres/bin/postmaster &\fR
  634. % \fB~postgres/bin/createdb postgres\fR
  635. % \fBkill %~postgres/bin/postmaster\fR
  636. .)l
  637. This will create the bootstrap template database, from which
  638. the database 
  639. .q postgres
  640. will be generated.  The
  641. .i postmaster
  642. program will be discussed later - however, you must have it running in order
  643. to run 
  644. .i createdb.
  645. If several users wish to use \*(PG,
  646. we advise you to create additional databases,
  647. one for each user.
  648. This can be done by running
  649. .i createdb
  650. with the username as the first argument.
  651. For example,
  652. to create a database for the user \*(lqbill\*(rq,
  653. type
  654. .(l
  655. % \fB~postgres/bin/createdb bill\fR
  656. .)l
  657. .\" ----------------
  658. .tm    Testing
  659. .\" ----------------
  660. .sh 2 "Step 4 - Testing"
  661. .sh 3 "Testing \*(PG"
  662. .pp
  663. After compiling the \*(PG backend and support programs and
  664. creating the initial database,
  665. you should test your compilation
  666. with the following.
  667. Commands you should type appear in \fBboldface\fP.
  668. .(l
  669. \fB% ~postgres/bin/postgres\fR
  670. .ft CW
  671.     ---debug info---
  672.     Quiet =        f
  673.     Noversion =    f
  674.     override  =    f
  675.     DatabaseName = [postgres]
  676.     ----------------
  677.  
  678.     **** Transaction System Active ****
  679.     InitPostgres()..
  680.  
  681. POSTGRES backend interactive interface
  682. $Revision: 1.25 $ $Date: 1992/08/27 06:08:25 $
  683.     StartTransactionCommand() at Thu Nov  2 15:43:35 1989
  684. .ft
  685. > \fBretrieve (pg_user.all)\fP
  686. .ft CW
  687.  now in make_Var
  688. relation = pg_user, attr = usecatupd
  689. vnum = 1
  690.     ...
  691. .ft
  692.     \fIlots of debugging output...\fP
  693. .ft CW
  694.  
  695. ----     parser outputs :
  696. ((1 retrieve nil (("pg_user" 86 0 nil nil ))0 nil )((#S(resdom :resno 1
  697. :restype 19 :reslen 16 :resname "usename" :reskey 0 :reskeyop 0)#S(var
  698.     ...
  699. .ft
  700.     \fIlots more debugging output...\fP
  701.  
  702. .ft CW
  703.     ProcessQuery() at Thu Nov  2 15:43:50 1989
  704.  
  705. blank
  706.      1: usename    (typeid = 19, len = 16, byval = f)
  707.      2: usesysid    (typeid = 21, len = 2, byval = t)
  708.      3: usecreatedb    (typeid = 16, len = 1, byval = t)
  709.      4: usetrace    (typeid = 16, len = 1, byval = t)
  710.      5: usesuper    (typeid = 16, len = 1, byval = t)
  711.      6: usecatupd    (typeid = 16, len = 1, byval = t)
  712.     ----
  713.      1: usename = "postgres"    (typeid = 19, len = 16, byval = f)
  714.      2: usesysid = "6"    (typeid = 21, len = 2, byval = t)
  715.      3: usecreatedb = "t"    (typeid = 16, len = 1, byval = t)
  716.      4: usetrace = "t"    (typeid = 16, len = 1, byval = t)
  717.      5: usesuper = "t"    (typeid = 16, len = 1, byval = t)
  718.      6: usecatupd = "t"    (typeid = 16, len = 1, byval = t)
  719.     ----
  720.      1: usename = "goh"    (typeid = 19, len = 16, byval = f)
  721.      2: usesysid = "234"    (typeid = 21, len = 2, byval = t)
  722.      3: usecreatedb = "t"    (typeid = 16, len = 1, byval = t)
  723.      4: usetrace = "t"    (typeid = 16, len = 1, byval = t)
  724.      5: usesuper = "t"    (typeid = 16, len = 1, byval = t)
  725.      6: usecatupd = "t"    (typeid = 16, len = 1, byval = t)
  726.     ----
  727.      ...
  728.  
  729.     CommitTransactionCommand() at Thu Nov  2 15:43:51 1989
  730.  
  731.     StartTransactionCommand() at Thu Nov  2 15:43:51 1989
  732. .ft
  733.     \fIIt works!\fP
  734.  
  735. \fI
  736.     The above response is an example of the raw output
  737.     generated by the backend.  Your actual output may be slightly
  738.     different.  Normally, you would use a
  739.     terminal monitor to talk to the backend instead.
  740.     To leave the backend, type <ctrl-D>:
  741. \fR
  742. > ^D
  743. %
  744. .)l
  745. .sp
  746. .\" ----------------
  747. .tm    Running
  748. .\" ----------------
  749. .sh 1 "Running \*(PG"
  750. .pp
  751. \*(PG is designed to be a multiuser system.
  752. In practice,
  753. \*(PG consists of three (or more) processes:
  754. .ip \0\0\0\(bu
  755. the postmaster,
  756. .ip \0\0\0\(bu
  757. the terminal monitor,
  758. and
  759. .ip \0\0\0\(bu
  760. the backend.
  761. .lp
  762. Users are expected to use the terminal monitor.
  763. The terminal monitor
  764. sends commands to the postmaster which forwards commands to a backend.
  765. If you just completed step 3,
  766. then you have already been introduced to the \*(PG backend,
  767. so we'll talk about the other two processes now.
  768. .sh 2 "The \*(PG Postmaster"
  769. .pp
  770. The postmaster is a process which manages communication between the
  771. user's terminal monitor and a \*(PG backend.
  772. Without a running postmaster,
  773. the terminal monitor will not be able to connect to a backend.
  774. To start the postmaster, type:
  775. .(l
  776. % \fBcd ~postgres/bin\fR
  777. % \fBsetenv POSTGRESHOME ~postgres\fR
  778. % \fBpostmaster &\fR
  779. .)l
  780. Here we are using the default parameters for the postmaster.  For more
  781. details, consult the Reference.
  782. .sh 2 "The \*(PG Terminal Monitor"
  783. .pp
  784. The \*(PG terminal monitor is a front-end user interface to the
  785. \*(PG backend.
  786. To start a terminal monitor,
  787. type
  788. .(l
  789. % \fBmonitor <database>\fR
  790. .)l
  791. .pp
  792. \fIDatabase\fR is the name of the database you want to use. 
  793. Now we will run the monitor:
  794. .(l
  795. .ft CW
  796. Welcome to the C POSTGRES terminal monitor
  797.  
  798. Go 
  799. *
  800. .ft
  801.  
  802. \fI
  803. The ``*'' is the terminal monitor prompt.  We are now
  804. talking to the backend, so let's send a simple test
  805. query:  list the names and user ids of the postgres users.
  806. We terminate the query with a \eg \*- the ``go'' command
  807. to the terminal monitor.
  808. \fR
  809.  
  810. *\fBretrieve (u.usename, u.usesysid) from u in pg_user
  811. \eg\fP
  812.  
  813. .ft CW
  814. Query sent to backend is "retrieve (u.usename, u.usesysid) from u in pg_user"
  815.  -----------------------------
  816.  | usename     | usesysid    |
  817.  -----------------------------
  818.  | postgres    | 6           |
  819.  -----------------------------
  820.  | mike        | 799         |
  821.  -----------------------------
  822.  | sp          | 1511        |
  823.  -----------------------------
  824.  | jhingran    | 943         |
  825.  -----------------------------
  826.  | cimarron    | 2359        |
  827.  -----------------------------
  828.  | goh         | 1994        |
  829.  -----------------------------
  830.  | ong         | 2802        |
  831.  -----------------------------
  832.  | hong        | 2469        |
  833.  -----------------------------
  834.  | mao         | 1806        |
  835.  -----------------------------
  836.  | margo       | 2697        |
  837.  -----------------------------
  838.  | sullivan    | 1517        |
  839.  -----------------------------
  840.  | kemnitz     | 3491        |
  841.  -----------------------------
  842.  | choi        | 3898        |
  843.  -----------------------------
  844.  | mer         | 3665        |
  845.  -----------------------------
  846.  
  847. Go 
  848. .ft
  849. .ft I
  850. .pp
  851.     Okay, this worked, too.  Now we'll quit.
  852. .pp
  853. *\fB\eq\fP
  854. .ft CW
  855. I live to serve you.
  856. .ft
  857. %
  858. .)l
  859. .sh 2 "The \*(PG Backend"
  860. .pp
  861. The \*(PG backend is the process which does all the \*(lqreal\*(rq
  862. work.
  863. This process is started by the postmaster when the postmaster
  864. receives a connection from a terminal monitor,
  865. so you should not normally need to start up the backend yourself.
  866. Should you wish to
  867. start the backend and talk to it directly (without a terminal monitor)
  868. you can do this by typing:
  869. .(l
  870. % \fB~postgres/bin/postgres\fR \fIdatabase\fR
  871. .)l
  872. .lp
  873. where \fIdatabase\fR is the name of the database you wish to use.
  874. If you run a backend in this manner,
  875. you will be talking to the backend parser directly.
  876. We recommend using the terminal monitor; if you are using Postgres as a
  877. multiuser system, running the backend can result in locking failures
  878. and corrupt databases, as the Postmaster handles shared resources such
  879. as semaphores and shared memory.
  880. In addition, returned tuples are displayed more usefully
  881. and input is buffered better.  
  882. The backend is used interactively primarily during debugging.
  883. .sh 2 "\*(PG Support Programs"
  884. .pp
  885. Included in \*(PG are a handful of support programs.
  886. Most of these are used internally by the system but here is a list of
  887. them for your information.
  888. .(l
  889. initdb        \- creates the initial template database
  890. createdb        \- creates new postgres databases
  891. createdb.sh    \- creates new postgres databases - old version
  892. destroydb    \- destroys postgres databases
  893. ipcclean        \- frees up garbage shared memory from failed backends
  894. pg_version    \- make version numbers for createdb
  895. pg_id        \- gets user id's for createdb
  896. pg_uid        \- gets postgres user id for initializing the template database
  897. pagedoc        \- disk page doctor
  898. shmemdoc        \- shared memory buffer pool doctor
  899. .)l
  900. .sh 1 "Optional Installation"
  901. .sh 2 "Installing LIBPQ, the \*(PG frontend library"
  902. .pp
  903. The file ~postgres/obj.<port>/libpq.a is created when you
  904. compile the system.
  905. This library contains various 
  906. routines intended for use by frontend programs.
  907. You use this library if you want to execute Postgres queries
  908. from a C program.  If you plan on doing software development,
  909. you may wish to copy this file to
  910. /usr/lib so that the C compiler can reference it with -lpq.
  911. To do this,
  912. type:
  913. .(l
  914. # \fBcp ~postgres/obj.<port>/libpq.a   /usr/lib\fR
  915. .)l
  916. .sh 2 "Demo Database"
  917. .pp
  918. In ~postgres/demo are files to be included by the terminal monitor
  919. to set up a demo database.
  920. Additional files demonstrate inheritance,
  921. historical queries,
  922. abstract data types,
  923. and various other features
  924. of \*(PG.
  925. A description of the demo database can be found
  926. in ~postgres/demo/DEMO-README.
  927. .sh 2 "Video Demo Database"
  928. .pp
  929. In ~postgres/video are files that were used in the 1991 Postgres SIGMOD
  930. video.  These files demonstrate both the instance level and query rewrite
  931. rule systems, views, versions, and spatial queries using R-Tree indices.
  932. A description of the video database can be found in
  933. ~postgres/video/VIDEO-README.
  934. .sh 2 "Wisconsin Benchmark Database"
  935. .pp
  936. In ~postgres/bench are files which are the queries used in the Postgres
  937. version of the Wisconsin benchmark.  The Wisconsin benchmark illustrates
  938. "basic" relational performance using B-Tree indices on nontrivial amounts
  939. of data.  Instructions for running the benchmark are in
  940. ~postgres/bench/WISC-README.
  941. .pp
  942. .sh 2 "Minimal Installation"
  943. .pp
  944. The directories (in ~postgres) necessary
  945. for a minimal running system are:
  946. .(l
  947. bin/        the binary programs comprising \*(PG
  948. data/        support files and user created databases
  949. files/        database initialization scripts
  950. .)l
  951. When compiled using the "default" compilation options as shipped, (ie
  952. optimization and no debugging), these directories will take up about 5 Mbytes.
  953. The following directories are necessary if Postgres is to ever be recompiled.
  954. .(l
  955. newconf/    the \*(PG configuration directory
  956. obj.<port>/    compiled \*(PG object files
  957. src/        \*(PG source files
  958. .)l
  959. .pp
  960. When compiled using the "defaults", these directories will use about 16
  961. Mbytes.
  962. Additional Postgres directories are as follows:
  963. .(l
  964. demo/        demo database scripts
  965. video/        video demo database scripts
  966. bench/        Wisconsin benchmark database scripts
  967. sample/        Sample LIBPQ application
  968. doc/        postgres technical reports and the \*(PG Manual
  969. ref/        \*(PG Reference source
  970. .)l
  971. .pp
  972. These directories take up about 2 Mbytes, and can be reduced to about
  973. 200 Kbytes if the Postscript files in doc and ref are deleted. 
  974. .pp
  975. We do not recommend deleting these unless absolutely necessary.
  976. .\" ----------------
  977. .tm    Documentation
  978. .\" ----------------
  979. .sh 1 "Documentation"
  980. .sh 2 "Printing the Manual"
  981. .pp
  982. The \*(PG manual is now in the file
  983. .(l
  984. \fB~postgres/doc/manual.me\fR
  985. .)l
  986. This manual replaces the old tutorials, which are no longer distributed.  It
  987. is recommended that you read this manual before making extensive use of 
  988. \*(PG.  A Postscript version of this manual is in
  989. .(l
  990. \fB~postgres/doc/psdump/manual.ps\fR
  991. .)l
  992. .pp
  993. .sh 2 "Printing the Reference"
  994. .pp
  995. The Reference is the document which details the exact syntax used by
  996. \*(PG commands, and provides interface definitions for LIBPQ and large
  997. objects.  It is intended as a reference and should not be read cover to
  998. cover.
  999. .pp
  1000. If you have a Postscript printer, you can print the Reference by
  1001. changing directory to the 
  1002. .(l
  1003. \fB~postgres/ref\fR
  1004. .)l
  1005. directory, where you will find a Postscript file called \fBref.t\fR.
  1006. This file can be simply sent to the printer in whatever fashion your site
  1007. uses to print Postscript files.
  1008. .pp
  1009. If you do not have a Postscript printer, or you have font problems, etc.,
  1010. the \fBref\fR directory contains a /bin/sh script called "genref".  Edit
  1011. this script and set the appropriate parameters for printing at your site
  1012. in this script, and then execute it by typing
  1013. .(l
  1014. % \fBgenref\fR
  1015. .)l
  1016. This script will not actually try to send the job to the printer - rather
  1017. it will create the \fBref.t\fR output file.  You can then print the
  1018. manual by sending this file directly to the printer with the regular printing
  1019. commands used by your site.
  1020. .pp
  1021. If \fBgenref\fR fails, you may not have the \fBgrn\fR preprocessor.  This
  1022. preprocessor for troff allows pictures drawn with the \fBgremlin\fR graphics
  1023. editor to be printed using a "troff" command.  A script called \fBeatgrn\fR is
  1024. provided, which will cause \fBgenref\fR to ignore \fBgrn\fR directives and
  1025. print anyway - this will result in the reference being printed without
  1026. illustrations.  There is only one illustration, so this should not be too
  1027. much of a problem.
  1028. .pp
  1029. .sh 3 "If you do not have a Postscript printer"
  1030. .pp
  1031. If you do not have a Postscript printer, change the \fBpsroff\fR command in
  1032. the \fBgenref\fR script to the
  1033. text formatting command you use at your site, typically \fBnroff\fR,
  1034. \fBtroff\fR, or \fBditroff\fR.
  1035. As stated above, use the \fBeatgrn\fR script if you do not have \fBgrn\fR.
  1036. Output suitable
  1037. for a line-printer can be created using \fBnroff\fR.  
  1038. .pp
  1039. .sh 2 "Printing the Technical Reports and Tutorials"
  1040. .pp
  1041. Postscript versions of the Postgres technical reports, tutorials, and
  1042. release notes are in the directory \fB~postgres/doc/psdump\fR.  Some files
  1043. are not
  1044. included in Postscript form and are simply regular files - read the file
  1045. \fB~postgres/doc/README\fR for details.
  1046. .pp
  1047. The /bin/sh script
  1048. \fB~postgres/doc/print\fR
  1049. contains site-specific printing parameters, and understands the file extension
  1050. protocol used
  1051. in the \fBdoc\fR directory.  Once you set the site-specific parameters for
  1052. printing in this script, you should be able to print all the files in the
  1053. \fBdoc\fR easily, by executing
  1054. .(l
  1055. % \fBprint <filename>\fR
  1056. .)l
  1057. from the \fB~postgres/doc\fR directory.
  1058. .pp
  1059. Unlike the \fBgenref\fR script described above, this
  1060. script will send the job directly to the printer.  If you do not have the
  1061. \fBgrn\fR utility described above, you should use the \fBeatgrn\fR script here
  1062. as well.  For technical reports which require \fBmake\fR, continue to
  1063. the following section.
  1064. .pp
  1065. .sh 3 "If the directory has a makefile"
  1066. .pp
  1067. A couple of the technical reports use makefiles to generate their printable
  1068. versions rather than the \fBprint\fR script.  If the subdirectory has
  1069. a makefile, you will have
  1070. to change the site-specific parameters in the
  1071. makefile, run 
  1072. .(l
  1073. % \fBmake\fR
  1074. .)l
  1075. and then it will either print or create a printable file.  Note that if the
  1076. makefile uses \fBgrn\fR and you do not have access to this utility, you can
  1077. use the \fBeatgrn\fR script here as well.
  1078. .sh 2 "The 4.0.1 Release Notes"
  1079. .pp
  1080. The Postgres 4.0.1 Release Notes are in the file
  1081. \fB~postgres/doc/release4.0.1.me\fR.
  1082. Before working extensively with Postgres, you should read this file to
  1083. find new features, known bugs, and other useful information about this
  1084. release.
  1085. .pp
  1086. As described above, you can print this file by typing
  1087. .pp
  1088. .(l
  1089. % \fBprint ~postgres/doc/release4.0.1.me\fR
  1090. .)l
  1091. .\" ----------------
  1092. .tm    Miscellaneous
  1093. .\" ----------------
  1094. .sh 1 "Miscellaneous"
  1095. .sh 2 "Bug reports"
  1096. .pp
  1097. If you find a bug with \*(PG,
  1098. please send mail to
  1099. .(l
  1100. \0\0\0\0\0bug-postgres@postgres.Berkeley.EDU
  1101. or
  1102. \0\0\0\0\0(ucbvax!postgres!bug-postgres)
  1103. .)l
  1104. describing as precisely as possible the command that caused
  1105. the problem,
  1106. instructions on how to repeat the bug,
  1107. and a script showing the bug. 
  1108. .sh 2 "Known Bugs List"
  1109. .pp
  1110. A Known Bugs List with suggested workarounds is maintained on the machine
  1111. \fBpostgres.berkeley.edu\fR in the file \fBpub/postgres-v4r0r1.bugs\fR.  The
  1112. Internet address of this machine is \fB128.32.149.1\fR, and if you cannot
  1113. access Postgres, this file can be sent to you via e-mail.
  1114. .sh 2 "Consulting"
  1115. .pp
  1116. This software is unsupported,
  1117. public domain software.
  1118. Although we are interested in feedback,
  1119. it is impossible for us to make any
  1120. commitment to support in a research environment. 
  1121. .pp
  1122. If you do want to talk directly to the Postgres
  1123. group, electronic mail is strongly preferred.
  1124. We can be reached via the Internet as
  1125. .(l
  1126. \0\0\0\0\0post_questions@postgres.Berkeley.EDU
  1127. or
  1128. \0\0\0\0\0(ucbvax!postgres!post_questions)
  1129. .)l
  1130. We can also be reached at (415) 642-7520,
  1131. Monday through Friday,
  1132. between 1 and 4 PM Pacific Time.
  1133. .pp
  1134. .sh 2 "Postgres BBS"
  1135. A mailing list for Postgres announcements and discussion
  1136. is available for anyone who is interested.  If you wish
  1137. to subscribe to this mailing list, send mail to
  1138. .(l
  1139. \0\0\0\0\0postgres-request@postgres.Berkeley.EDU
  1140. .)l
  1141. with "Add" as the subject.  Note that mail sent to this address is processed
  1142. .b electronically.
  1143. .pp
  1144. The mailing list itself is called 
  1145. .(l
  1146. \0\0\0\0\0postgres@postgres.Berkeley.EDU
  1147. .)l
  1148. and all mail sent to this address will be 
  1149. will be routed to the mailing list membership.
  1150.