home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 11 / IOPROG_11.ISO / docs / databa~1 < prev    next >
Encoding:
Text File  |  1997-09-14  |  97.2 KB  |  2,529 lines

  1.   Linux Database HOWTO (PostgreSQL Relational Database System)
  2.   Al Dev (Alavoor Vasudevan)        deepav@pol.net
  3.   v1.0, 19 July 1997
  4.  
  5.   This document is about HOW-TO setup a International Standard/ANSI
  6.   Relational SQL Database "PostgreSQL" on your unix system which can be
  7.   used as Application Database Server or a Web Database Server. This
  8.   document also gives information on the interface programs for the
  9.   database like Front End GUIs, RAD tools (Rapid Application Develop¡
  10.   ment), programming languages interfaces ("C", "C++", Java, Perl),
  11.   ODBC, JDBC drivers and Web Database Tools and Interface programs.
  12.   Information given here applies to all other unix platforms. The infor¡
  13.   mation given hereby will be very useful for persons who are new to
  14.   PostgreSQL, Databases and SQL language.
  15.  
  16.   1.  Introduction
  17.  
  18.   Every computer system needs a database to store/retrieve the
  19.   information. The primary reason for the invention of computer is to
  20.   store, retrieve and process information and do all these very quickly.
  21.   The most popular database systems are based on the International
  22.   Standard Organisation (ISO) SQL specifications which are also based on
  23.   ANSI SQL (american) standards.  Current specifications generally used
  24.   are ANSI SQL 92 and ANSI SQL 89. Popular database like Oracle, Sybase
  25.   and Informix systems are based on these standards.
  26.  
  27.   The world's most popular FREE Database which is ISO SQL, ANSI SQL/92
  28.   and ANSI SQL/89 compliant RDBMS is PostgreSQL, also known as pgsql
  29.   (pronounced as "pee-gee-sequel").  PostgreSQL is the only free RDBMS
  30.   in the world which supports ANSI SQL standards. This document will
  31.   tell you how-to install the database and also all the packages related
  32.   to databases, how to set up the Web database, application database,
  33.   front end GUIs and interface programs.  It is strongly advised that
  34.   you MUST write your database applications 100 % compliant to standards
  35.   of ISO/ANSI SQL, ODBC, JDBC so that your application is portable
  36.   across multiple databases like PostgreSQL, Oracle, Sybase, Informix
  37.   etc.
  38.  
  39.   2.  What is PostgreSQL ?
  40.  
  41.   PostgreSQL Version 6.1.1 is free database, complete source code is
  42.   given to you and is a Relational Database System compliant with ANSI
  43.   SQL92 and SQL89 and runs on diverse hardware platforms and Operating
  44.   systems.  Millions of PostgreSQL is installed as Data servers,
  45.   Datacenter servers, Web databases, WWW http database servers and
  46.   Application servers. It is much more advanced and is a object oriented
  47.   relational database (ORDBMS).  PostgreSQL can store more data types
  48.   than traditional datatypes like integer, characters, images, etc. - it
  49.   can store complex object datatypes like objects and classes (Version
  50.   7.0 will make this capabilities more advanced).  PostgreSQL runs on
  51.   Solaris, SunOS, HPUX, AIX, Linux, Irix, Digital Unix, BSDi,NetBSD,
  52.   FreeBSD, SCO unix, NEXTSTEP, Unixware and all and every flavor of
  53.   Unix. Port to Windows 95/NT is underway.
  54.  
  55.   ╖  Title:             PostgreSQL ANSI SQL92/ANSI SQL89 RDBMS Database
  56.      (Relational Database Management System)
  57.  
  58.   ╖  Current Version:   6.1.1
  59.  
  60.   ╖  Age:               PostgreSQL is 12 years old. Developed since 1985
  61.  
  62.   ╖  Authors:           Developed by millions/universities/companies on
  63.      internet for the past 12 YEARS
  64.  
  65.   3.  Where to get it?
  66.  
  67.   The primary Web site is given as below :
  68.  
  69.   ╖  "Binaries only" distribution of PostgreSQL : You can run PostgreSQL
  70.      without compiling the source. Get binaries for Intel-Linux from
  71.      <http://www.redhat.com/pub/contrib/i386/> file is
  72.      postgresql-6.1-6.i386.rpm. This is in the redhat package 'rpm'
  73.      format and it contains both source and binaries for PostgreSQL.
  74.  
  75.   ╖  Primary Web site:   <http://www.postgresql.org/>
  76.  
  77.   ╖  Secondary Web site:      <http://logical.thought.net/postgres95/>
  78.  
  79.   ╖  <http://www.itm.tu-clausthal.de/mirrors/postgres95/>
  80.  
  81.   ╖  <http://s2k-ftp.cs.berkeley.edu:8000/postgres95/>
  82.  
  83.   The ftp sites are listed below :-
  84.  
  85.   ╖  "Binaries only" distribution of PostgreSQL : You can run PostgreSQL
  86.      without compiling the source. Get binaries for Intel-Linux from
  87.      <ftp://ftp.redhat.com/pub/contrib/i386/> file is
  88.      postgresql-6.1-6.i386.rpm. This is in the redhat package 'rpm'
  89.      format and it contains both source and binaries for PostgreSQL.
  90.  
  91.   ╖  Primary FTP:        <ftp://ftp.postgresql.org/pub>
  92.  
  93.   ╖  Secondary FTP:      <ftp://ftp.chicks.net/pub/postgresql>
  94.  
  95.   ╖  <ftp://ftp.emsi.priv.at/pub/postgres/>
  96.  
  97.   ╖  <ftp://ftp.itm.tu-clausthal.de/pub/mirrors/postgres95>
  98.  
  99.   ╖  <ftp://rocker.sch.bme.hu/pub/mirrors/postgreSQL>
  100.  
  101.   ╖  <ftp://ftp.jaist.ac.jp/pub/dbms/postgres95>
  102.  
  103.   ╖  <ftp://ftp.luga.or.at/pub/postgres95>
  104.  
  105.   ╖  <ftp://postgres95.vnet.net:/pub/postgres95>
  106.  
  107.   4.  Regression Test Package to validate PostgreSQL against ISO/ANSI
  108.   SQL Standards
  109.  
  110.   Regression test package is included in the distribution and let your
  111.   computer do the verfication for you to check if all the ANSI SQL 92
  112.   /ISO SQL commands run as per technical specifications.  It is better
  113.   to check always, but never guess! Advantage is that computer can
  114.   rapidly test thousands of SQL tests in a very short time. The test
  115.   package already contains hundreds of SQL test programs. You can add
  116.   more tests just in case you need to, and can upload to the primary
  117.   PostgreSQL web site if you feel that will be useful for others on
  118.   internet.
  119.  
  120.   5.  GUI FrontEnd Tool for PostgreSQL (Graphical User Interface)
  121.  
  122.   PostgreSQL has TCL/TK interface library in the distribution called
  123.   'pgtcl'. TCL/TK is a Rapid Application Development tool and is a very
  124.   powerful scripting language. Develop once and run it everywhere on NT,
  125.   Win 95, Linux and all unixes! TCL/TK is also widely used as a Internet
  126.   script language. So you will have only one language for all your needs
  127.   - applications and internet. TCL stands for 'Tool Command Language'
  128.   and TK is 'Tool Kit'.  TCL/TK is usually shipped with every linux
  129.   cdrom. Also you can get it from these sites -
  130.  
  131.   ╖  <http://sunscript.sun.com/>
  132.  
  133.   ╖  <http://sunscript.sun.com/TclTkCore/>
  134.  
  135.   ╖  <ftp://ftp.sunlabs.com/pub/tcl/tcl8.0a2.tar.Z>
  136.  
  137.   ╖  Reference text book: Many textbooks on TCL/TK are available in the
  138.      market.
  139.  
  140.   6.  ODBC Drivers for PostgreSQL
  141.  
  142.   ODBC stands for 'Open DataBase Connectivity' is a popular standard for
  143.   accessing information from various databases from different vendors.
  144.   Applications written using the ODBC drivers are guaranteed to work
  145.   with various databases like PostgreSQL, Oracle, Sybase, Informix etc..
  146.  
  147.   ╖  <http://www.ids.net/~bjepson/freeODBC/> This is a cost free version
  148.      of ODBC.
  149.  
  150.   ╖  <http://www.openlinksw.com> Open Link Software Corporation is
  151.      selling ODBC for PostgreSQL and other databases.
  152.  
  153.   7.  UDBC Drivers for PostgreSQL
  154.  
  155.   UDBC is a static version of ODBC independent of driver managers and
  156.   DLL support, used to embed database connectivity support directly into
  157.   applications.
  158.  
  159.   ╖  <http://www.openlinksw.com> Open Link Software Corporation is
  160.      selling UDBC for PostgreSQL and other databases.
  161.  
  162.   8.  JDBC Drivers for PostgreSQL
  163.  
  164.   JDBC stands for 'Java DataBase Connectivity'. Java is a platform
  165.   independent programming language developed by Sun Microsystems. Java
  166.   programmers are encouraged to write database applications using the
  167.   JDBC to facilitate portability across databases like PostgreSQL,
  168.   Oracle, informix, etc. If you write Java applications you can get JDBC
  169.   drivers for PostgreSQL from the following sites:
  170.  
  171.   ╖  <http://www.demon.co.uk/finder/postgres/index.html> Sun's Java
  172.      connectivity to PostgreSQL
  173.  
  174.   ╖  <ftp://ftp.ai.mit.edu/people/rst/rst-jdbc.tar.gz>
  175.  
  176.   ╖  <http://www.openlinksw.com> Open Link Software Corporation is
  177.      selling JDBC for PostgreSQL and other databases.
  178.  
  179.   9.  Kanchenjunga - Java RAD Tool for PostgreSQL
  180.  
  181.   Kanchenjunga is a Java Rapid Application Tool for PostgreSQL. You can
  182.   use this tool to develop rapidly the java application interfacing
  183.   PostgreSQL.
  184.  
  185.   ╖  <http://www.man.ac.uk/~whaley/kj/kanch.html>
  186.  
  187.   10.  Java Classes for PostgreSQL
  188.  
  189.   Java programmers can find these classes for PostgreSQL very useful.
  190.  
  191.   ╖  <ftp://www.blackdown.org/pub/Java/Java-Postgres95>
  192.  
  193.   ╖  <http://www.blackdown.org>
  194.  
  195.   11.  Perl 5 interface for PostgreSQL
  196.  
  197.   It included in the distribution of PostgreSQL. Check in
  198.   src/pgsql_perl5 directory.
  199.  
  200.   ╖  Email: E.Mergl@bawue.de
  201.  
  202.   ╖  Another source from -
  203.  
  204.   ╖  Perl Home page :
  205.  
  206.   12.  Windows Interactive Query Tool for PostgreSQL (WISQL)
  207.  
  208.   Identical to Microsoft SQL server WISQL! It has nice GUI and has
  209.   history of commands. Also you can cut and paste and it has other nice
  210.   features to improve your productivity.
  211.  
  212.   ╖  <http://www.troubador.com/~keidav/index.html>
  213.  
  214.   ╖  Email: keidav@whidbey.com
  215.  
  216.   ╖  <http://www.ucolick.org/~de/> in file tcl_syb/wisql.html
  217.  
  218.   ╖  <http://www.troubador.com/~keidav/index.html>
  219.  
  220.   ╖  Email: de@ucolick.org
  221.  
  222.   13.  Interactive Query Tool - ISQL for PostgreSQL
  223.  
  224.   ISQL is For Character command line terminals.  This is included in the
  225.   distribution, and is called PSQL. Very similar to Sybase ISQL, Oracle
  226.   SQLplus. At unix prompt give command 'psql' which will put you in
  227.   psql> prompt. Type /h to see help of commands. Very user friendly and
  228.   easy to use. Also very useful for shell scripting in Bourne, Korn and
  229.   C-shells.
  230.  
  231.   14.  Problem/Project Tracking System Application Tool for PostgreSQL
  232.  
  233.   This is at
  234.  
  235.   ╖  <http://www.homeport.org/~shevett/pts/>
  236.  
  237.   15.  PostgreSQL 4GL for web database applications - AppGEN Development
  238.   System
  239.  
  240.   AppGEN can be downloaded from
  241.  
  242.   <http://www.man.ac.uk/~whaley/ag/appgen.html>
  243.  
  244.   <ftp://ftp.mcc.ac.uk/pub/linux/ALPHA/AppGEN>.
  245.  
  246.   Extract from the home page of AppGEN is given below:-
  247.  
  248.   AppGEN is a high level fourth generation language and application
  249.   generator for producing World Wide Web (WWW) based applications. These
  250.   applications are typically used over the internet or within a
  251.   corporate intranet. AppGEN applications are implemented as C scripts
  252.   conforming to the Common Gateway Interface (CGI) standard supported by
  253.   most Web Servers.
  254.  
  255.   To use AppGEN you will need the following :-
  256.  
  257.   PostgresSQL, relational database management system
  258.  
  259.   A CGI compatible web server such as NCSA's HTTPD
  260.  
  261.   An ansi C compiler such as GCC
  262.  
  263.   AppGEN consists of the following Unix (Linux) executables :-
  264.  
  265.   ╖  defgen, which produces a basic template application from a logical
  266.      data structure. The applications are capable of adding, updating,
  267.      deleting and searching for records within the database whilst
  268.      automatically maintaining referential integrity.
  269.  
  270.   ╖  appgen, the AppGEN compiler which compiles the appgen source code
  271.      into CGI executable C source and HTML formatted documents ready for
  272.      deployment on a web server.
  273.  
  274.   ╖  dbf2sql, a utility fo converting dBase III compatible .dbf files
  275.      into executable SQL scripts. This enables data stored in most
  276.      DOS/Windows based database packages to be migrated to a SQL server
  277.      such as PostgresSQL.
  278.  
  279.   ╖  In addition, AppGEN comprises of a collection of HTML documents,
  280.      GIF files and Java applets which are used at runtime by the system.
  281.      And of course, like all good software, the full source code is
  282.      included.
  283.  
  284.   The author, Andrew Whaley, can be contacted on
  285.   andrew@arthur.smuht.nwest.nhs.uk and would appreciate any comments or
  286.   suggestions about the software.
  287.  
  288.   16.  Web Database Design/Implementation tool for PostgreSQL - EARP
  289.  
  290.   <http://www.oswego.edu/Earp>
  291.  
  292.   <ftp://ftp.oswego.edu> in the directory 'pub/unix/earp'.
  293.  
  294.   The extract from the home page of EARP is given below:-
  295.  
  296.   The "Easily Adjustable Response Program" (EARP) created by David
  297.   Dougherty
  298.  
  299.   16.1.  What is EARP?
  300.  
  301.   EARP is a Web Database Design/Implementation tool, built on top of the
  302.   Postgres95 database system. Its functionality includes:
  303.  
  304.   ╖  A Visual Design System.
  305.  
  306.   ╖  A sendmail interface. (can handle incoming and outgoing mail)
  307.  
  308.   ╖  An Enhanced Security Mechanism.
  309.  
  310.   ╖  A cgi driver.
  311.  
  312.   16.2.  Implementation
  313.  
  314.   The main implementation of EARP is a CGI binary which runs under the
  315.   http daemon to provide access to the database server. All of the
  316.   design tools are built into the driver, no design takes place over
  317.   anything but the web. The tools themselves require a graphical
  318.   browser, the compatability of objects designed with the tools is
  319.   implementation independent, based on designing individuals
  320.   preferences.
  321.  
  322.   16.3.  What you need to run EARP
  323.  
  324.   EARP will likely run on a variety of platforms with little or no
  325.   porting. The known working platforms consist of the following:
  326.  
  327.   ╖  Solaris 2.5
  328.  
  329.   ╖  Linux 1.2.13+
  330.  
  331.   ╖  GNU C++
  332.  
  333.   ╖  Postgres95 (Version 1.01 / 1.02)
  334.  
  335.   ╖  netsite server
  336.  
  337.   ╖  NCSA httpd
  338.  
  339.   ╖  GNU C++
  340.  
  341.   ╖  Postgres95 (Version 1.01 / 1.02)
  342.  
  343.   ╖  NCSA httpd
  344.  
  345.   ╖  Apache httpd
  346.  
  347.   16.4.  News Flash
  348.  
  349.   The current (1.3) release of Earp was designed on top of the libpq
  350.   release that came with Postgres95 v1.01/1.02.  If you are using a more
  351.   recent version of Postgres, expect that the program will require some
  352.   porting to work correctly. In the development version (Earp 2.0),
  353.   libpq support is being incorperated as a module, and thus will support
  354.   as many versions of postgres as we have time to write the modules. The
  355.   development release is expected to become public near mid-spring(97).
  356.  
  357.   16.5.  How does it work?
  358.  
  359.   One of the main features of EARP is that it uses an Object Oriented
  360.   approach to producing html pages which interface to the database. Most
  361.   pages will consist of several objects. Each object is produced by some
  362.   sort of tool and given a name, objects are then linked together in a
  363.   callable sequence by the page tool. Objects are also reusable across
  364.   multiple pages.  Basic tools exist for HTML, Querys, Grabbing input
  365.   from forms, Extendable Formatting of Query and Input objects, and
  366.   Linking together of objects into other objects. More advanced tools
  367.   include the mail tool and the multithreaded query tool.
  368.  
  369.   Another feature of EARP is advanced security. Access to various areas
  370.   of the EARP system can be limited in a variety of ways. To facilitate
  371.   its advanced security, EARP performs checks for each connection to the
  372.   system, determining what ids and groups the connecting agent belongs
  373.   to. Access to areas is defined seperately, and the combination decides
  374.   if access to a specific area of Earp is allowed. Moreover, all that is
  375.   required to implement the security features is an http server that
  376.   supports basic (or better) user authentication.
  377.  
  378.   16.6.  Some online examples
  379.  
  380.   As part of the ICC Help Database, the Catalog Search Page is an EARP
  381.   document which runs several queries.  The selection boxes are
  382.   generated by the EARP program from listings in the database.
  383.  
  384.   As another example of what can be done using EARP... now you can look
  385.   at the List of Objects in the Help Database.
  386.  
  387.   Creating the three interfaces for the link took me less than 15
  388.   minutes.
  389.  
  390.   16.7.  Where do I get it?
  391.  
  392.   EARP is available via anonymous ftp from  <ftp://ftp.oswego.edu> in
  393.   the directory 'pub/unix/earp'. The version as of this writing is 1.3.1
  394.  
  395.   Please, once you've retrieved EARP and gotten it to work, drop me a
  396.   line and tell me your success or failure story.
  397.  
  398.   16.8.  Available Documentation
  399.  
  400.   All documentation has been moved to the User Docs and Tutorials index
  401.   page.
  402.  
  403.   16.9.  A History of EARP
  404.  
  405.   Earp 0.1 began in Fall of 1995 as program I was working on to build a
  406.   dynamically configurable web accessable guest book.  At that point it
  407.   was a bunch of cgi programs that all did different but usefull things
  408.   and were held together with SSI glue, and a little sneaky c
  409.   programming. What I soon realized though is that I was doing a lot of
  410.   repetitive work, and that most of what I was doing had to be run in
  411.   many windows at once (netscape, emacs, shell, mail) for it to make any
  412.   sense, and that debugging was quickly becomming a nightmare. At that
  413.   time I was also being approached by my friend and boss Don Michaels,
  414.   who was interested in automating a large hunk of our user support, and
  415.   keeping a historical database of requests and responses.
  416.  
  417.   Soon, I had worked out the initial scheme for what is now quickly
  418.   becomming our help database, only I balked at the idea of building a
  419.   help database with what was at that point a very primitive set of
  420.   utilities. When spring classes were occuring(96) I started it anyway,
  421.   mainly out of boredom, but also because I was in a database design
  422.   class and a wanted to flex a few brain muscles. After a while I had a
  423.   reasonable prototype up and running, which made Don very happy as he
  424.   had basically given up on the idea of anyone every really creating a
  425.   help database for him. (The protoype is still running on one of my
  426.   servers...(june96)) The prototype did some very interesting things,
  427.   but by april I was again getting discouraged... Everytime I wanted to
  428.   change something, I had to go through a lengthy process of
  429.   recompilation, or find an entry in a text file full of distractions.
  430.   Also, there was no way for me to use the building block idea which is
  431.   so usefull in EARP... I did a lot of huge cutting and pasting. About
  432.   the time that classes where ending I had again given up on the current
  433.   scheme of things, and decided that what I needed was a better set of
  434.   tools for what I was doing. Additionally, I also wanted to make my
  435.   prototype work on top of a REAL realtional database, and I wasn't
  436.   cherishing the idea of reworking all those hard coded accesses, links,
  437.   and output methods.
  438.  
  439.   I had a break for a short while, if you want to call it that. We
  440.   sponsored the SUNY CIT Conference and I was so busy for about a week
  441.   and a half that I got distnaced from most of what I had written for
  442.   the prototype help database, except the ideas I had had when I wrote
  443.   the initial series of utilities, and what my biggest peeves were about
  444.   the current state of things.
  445.  
  446.   Shortly after the conference, I began the prototype for the current
  447.   version of EARP(may96), using the postgres95 database as my relational
  448.   backend. By the middle of June, the prototype had evolved into a
  449.   fairly nice integrated suite of tool prototypes, with the primary
  450.   advantage that they all ran over html, and stored their initialization
  451.   information in the database. Most of the second half of june was spent
  452.   debugging and working out the kinks in the code, and playing with the
  453.   interface.( within those two weeks I accessed our web server over 5000
  454.   times.) By the end of June I had most of the major bugs blasted out of
  455.   EARP, and a large enough number of objects in the "new" help database
  456.   to officially announce it to our help support staff.
  457.  
  458.   Incidentally, I also kept a journal during the development of EARP,
  459.   and myself and Don Michaels are presenting a paper describing the Help
  460.   Database at the Chicago ACM/SIGUCCS conference in September of this
  461.   year.
  462.  
  463.   17.  WWW Web interface for PostgresSQL - dbengine
  464.  
  465.   <http://www.cis-computer.com/dbengine/ >
  466.  
  467.   The extract from the home page of dbengine is given below:-
  468.  
  469.   dbengine a plug 'n play Web interface for Postgres95 created by Ingo
  470.   Ciechowski
  471.  
  472.   Version 0.82 alpha Documentation as of 11/23/96
  473.  
  474.   About dbengine
  475.  
  476.   dbengine is an interface between the WWW and Postgres95 which provides
  477.   simple access to any existing database within just a few minues.
  478.  
  479.   This little Perl program was born after I've tried quite a lot of
  480.   already available packages like AppGen, , PHP-FI and more. So why did
  481.   I kind of re-invent the wheel ?
  482.  
  483.   Well, PHP-FI gives you a Perl like language in your documents, but no
  484.   real Perl while AppGen and wdb-p95 require that you create some
  485.   configuration file for each of your databases -- sound's like you'll
  486.   first of all have to learn some sort of new mata language before you
  487.   can get started.
  488.  
  489.   That was the point when I started to feel more familiar with a small
  490.   Perl applet of my own... and now my dbengine became a tool that I
  491.   think at is ready to be shared with others.
  492.  
  493.   Unlike other tools you don't have to learn any special programming or
  494.   scripting language to get started with dbengine. Also there's no
  495.   configuration file for each database, so you don't have to get
  496.   familiar with such a new structure.  However - in case you want to
  497.   gain access to the full features of dbengine it'd be a good idea to
  498.   know the Perl language.
  499.  
  500.   The whole system can be configured by simple manipulations of an
  501.   additional database that contains closer information about how to
  502.   visualize your database access.   You can even specify virtual Fields
  503.   which are calculated on the fly right before they're displayed on the
  504.   screen.
  505.  
  506.   License
  507.  
  508.   dbengine is free software under the same terms as Perl. Read its
  509.   licence if you aren't sure what you can or can't do. The bottom line
  510.   is that this is a kinder and gentler version of the GNU licence -- one
  511.   that doesn't infect your work if you care to borrow from dbengine or
  512.   package up pieces of it as part of a commercial product!
  513.  
  514.   18.  Apache Webserver Module for PostgreSQL - NeoSoft NeoWebScript
  515.  
  516.   Apache is a well-known Web Server. And a module to interface
  517.   PostgreSQL to Apache Webserver is at -
  518.   <http://www.neosoft.com/neowebscript/>
  519.  
  520.   The extract from the home page of NeoWebScript is given below:-
  521.  
  522.   NeoWebScript is a programming language that allows both simple and
  523.   complex programs to be embedded into HTML files.
  524.  
  525.   When an HTML page containing embedded NeoWebScript is requested, the
  526.   NeoWebScript-enabled webserver executes the embedded script(s),
  527.   producing a webpage containing customized content created by the
  528.   program.
  529.  
  530.   NeoWebScript is a fast, secure, easy to learn way to do powerful,
  531.   server-based interactive programming directly in the HTML code in web
  532.   pages. With NeoWebScript, counters, email forms, graffiti walls, guest
  533.   books and visitor tracking are all easy, even for a beginning
  534.   programmer. See how well NeoWebScript holds its' own vs. PERL and
  535.   JavaScript.
  536.  
  537.   NeoWebScript 2.2 just released!  On June 24, 1997, NeoSoft released
  538.   NeoWebScript 2.2, integrating it with the new Apache 1.2.0 server.
  539.  
  540.   If you're on a webserver that has NeoWebScript installed and you would
  541.   like to started with it, we have a lot of User Info available.  Our
  542.   New User FAQ has the basic answers to get you started. The Tutorials
  543.   guide you through learning the language, while the Demos give you
  544.   prebuilt applications you can download and modify.  Commands and
  545.   Variables are the complete language references, and Troubleshooting
  546.   contains hints and tips to help you get past any problems.
  547.  
  548.   If you'd like to install NeoWebScript on your webserver, your
  549.   Webmaster needs to read our Sysop FAQ to get started. Theory of
  550.   Operations will explain how NeoWebScript works, while installation
  551.   will take them through the steps. Management deals with configuration
  552.   issues and running the server, tests let you verify correct
  553.   NeoWebScript operation, and troubleshooting deals with server
  554.   problems.
  555.  
  556.   Hey, wait a minute you ask, how much do you want for all this great
  557.   software, huh? There is no cost to you to use NeoWebScript-2.2 for
  558.   your ISP, your intranet, or your extranet.  You'll see a full license
  559.   when you register to download, but the gist is we'd like a whopping $
  560.   99 if you want to embed it in your own product or use it in a commerce
  561.   (eg. SSL) server.
  562.  
  563.   NeoWebScript is a module for the Apache webserver that allows you to
  564.   embed the Tcl/Tk programming language in your webpages as a scripting
  565.   tool. It was invented by Karl Lehenbauer, NeoSoft's Chief Technical
  566.   Officer, and documented, enhanced and extended by NeoSoft's
  567.   programmers and technical writers.
  568.  
  569.   The Apache webserver is the world's most popular webserver, accounting
  570.   for 42 % of the 1,044,163 sites polled by the May 1997 Netcraft Web
  571.   Server survey. The next largest entry were the various Microsoft
  572.   servers, reporting in with slightly over 16 %, or a difference of over
  573.   270,000 servers.
  574.  
  575.   Tcl/Tk is the powerful, free, cross-platform scripting language
  576.   developed by Dr. John Ousterhout, now a Sun Distinguished Engineer. In
  577.   his own words
  578.  
  579.   "Tcl/Tk lets software developers get the job done ten times faster
  580.   than with toolkits based on C or C++. It's also a great glue language
  581.   for making existing applications work together and making them more
  582.   graphical and Internet-aware."
  583.  
  584.   With a developer community of over 500,000 worldwide, and thousands of
  585.   commercial applications, Sun has just announced a new business group
  586.   called SunScript, to support this community with an integrated
  587.   development environment and to develop a suite of products to link Tcl
  588.   to the Web and Java.
  589.  
  590.   Karl Lehenbauer, Founder and Chief Technical Officer of NeoSoft, has
  591.   been part of Tcl/Tk development from the very beginning.  Together
  592.   with Mark Diehkans, they authored Extended Tcl, also known as TclX or
  593.   NeoSoft Tcl, a powerful set of extensions to the language. Many of the
  594.   current core Tcl commands originated in Extended Tcl, and were then
  595.   imported into the core language by Dr.  Ousterhout.
  596.  
  597.   NeoSoft Inc., 1770 St. James Place, Suite 500, Houston, TX 77056 USA
  598.  
  599.   19.  PHP/FI Server-side html-embedded scripting language for Post¡
  600.   greSQL
  601.  
  602.   WWW Interface Tool  <http://www.vex.net/php>
  603.  
  604.   Questions e-mail to : rasmus@lerdorf.on.ca
  605.  
  606.   The extract from the home page of PHP/FI is given below:-
  607.  
  608.   PHP/FI is a server-side html-embedded scripting language. It lets you
  609.   write simple scripts right in your .HTML files much like JavaScript
  610.   does, except, unlike JavaScript PHP/FI is not browser-dependant.
  611.   JavaScript is a client-side html-embedded language while PHP/FI is a
  612.   server-side language. PHP/FI is similar in concept to Netscape's
  613.   LiveWire Pro product. If you have the money, you run Netscape's
  614.   Commerce Server and you run one of the supported operating systems,
  615.   you should probably have a look at LiveWire Pro. If you like free
  616.   fast-moving software that comes with full source code you will
  617.   probably like PHP/FI.
  618.  
  619.   19.1.  Major Features
  620.  
  621.   Standard CGI, FastCGI and Apache module Support As a standard CGI
  622.   program, PHP/FI can be installed on any Unix machine running any Unix
  623.   web server. With support for the new FastCGI standard, PHP/FI can take
  624.   advantage of the speed improvements gained through this mechanism. As
  625.   an Apache module, PHP/FI becomes an extremely powerful and lightning
  626.   fast alternative to CGI programmimg.
  627.  
  628.   ╖  Access Logging With the access logging capabilities of PHP/FI,
  629.      users can maintain their own hit counting and logging. It does not
  630.      use the system's central access log files in any way, and it
  631.      provides real-time access monitoring. The Log Viewer Script
  632.      provides a quick summary of the accesses to a set of pages owned by
  633.      an individual user. In addition to that, the package can be
  634.      configured to generate a footer on every page which shows access
  635.      information. See the bottom of this page for an example of this.
  636.  
  637.   ╖  Access Control A built-in web-based configuration screen handles
  638.      access control configuration. It is possible to create rules for
  639.      all or some web pages owned by a certain person which place various
  640.      restrictions on who can view these pages and how they will be
  641.      viewed. Pages can be password protected, completely restricted,
  642.      logging disabled and more based on the client's domain, browser, e-
  643.      mail address or even the referring document.
  644.  
  645.   ╖  Postgres Support Postgres is an advanced free RDBMS. PHP/FI
  646.      supports embedding Postgres95 and PostgreSQL SQL queries directly
  647.      in .html files.
  648.  
  649.   ╖  RFC-1867 File Upload Support File Upload is a new feature in
  650.      Netscape 2.0. It lets users upload files to a web server. PHP/FI
  651.      provides the actual Mime decoding to make this work and also
  652.      provides the additional framework to do something useful with the
  653.      uploaded file once it has been received.
  654.  
  655.   ╖  HTTP-based authentication control PHP/FI can be used to create
  656.      customized HTTP-based authentication mechanisms for the Apache web
  657.      server.
  658.  
  659.   ╖  Variables, Arrays, Associative Arrays PHP/FI supports typed
  660.      variables, arrays and even Perl-like associative arrays. These can
  661.      all be passed from one web page to another using either GET or POST
  662.      method forms.
  663.  
  664.   ╖  Conditionals, While Loops PHP/FI supports a full-featured C-like
  665.      scripting language.  You can have if/then/elseif/else/endif
  666.      conditions as well as while loops and switch/case statements to
  667.      guide the logical flow of how the html page should be displayed.
  668.  
  669.   ╖  Extended Regular Expressions Regular expressions are heavily used
  670.      for pattern matching, pattern substitutions and general string
  671.      manipulation. PHP/FI supports all common regular expression
  672.      operations.
  673.  
  674.   ╖  Raw HTTP Header Control The ability to have web pages send
  675.      customized raw HTTP headers based on some condition is essential
  676.      for high-level web site design. A frequent use is to send a
  677.      Location: URL header to redirect the calling client to some other
  678.      URL. It can also be used to turn off cacheing or manipulate the
  679.      last update header of pages.
  680.  
  681.   ╖  On-the-fly GIF image creation PHP/FI has support for Thomas
  682.      Boutell's GD image library which makes it possible to generate GIF
  683.      images on the fly.
  684.  
  685.   ╖  ISP "Safe Mode" support PHP/FI supports a unique "Safe Mode" which
  686.      makes it safe to have multiple users run PHP scripts on the same
  687.      server.
  688.  
  689.   ╖  It's Free!  One final essential feature. The package is completely
  690.      free.  It is licensed under the GPL which allows you to use the
  691.      software for any purpose, commercial or otherwise. See the GNU
  692.      Public License document for complete details.
  693.  
  694.   19.2.  Credits
  695.  
  696.   * Large parts of this code were developed at and for the University of
  697.   Toronto. Many thanks to Lee Oattes of the Network Development
  698.   Department at the university for constant constructive criticism.
  699.  
  700.   * The Postgres95 support code was written by Adam Sussman
  701.   asussman@vidya.com
  702.  
  703.   * Countless others have helped test and debug the package.
  704.  
  705.   PHP/FI Version 2.0
  706.  
  707.   19.3.  Brief History
  708.  
  709.   PHP began life as a simple little cgi wrapper written in Perl. I wrote
  710.   it in an afternoon during a period between contracts when I needed a
  711.   quick tool to get an idea of who was reading my online resume. It was
  712.   never intended to go beyond my own private use. The web server where I
  713.   had my resume was extremely overloaded and had constant problems
  714.   forking processes. I rewrote the Perl wrapper in C to get rid of the
  715.   considerable overhead of having to fork Perl each time my resume was
  716.   accessed.
  717.  
  718.   Eventually other people on the same web server came across my wrapper
  719.   and asked if they could use it. Then, as inevitably happens, they
  720.   started asking for more features. I added more features and finally
  721.   put together a semi-complete distribution along with documentation, a
  722.   mailing-list and a FAQ. The name of this first package was Personal
  723.   Home Page Tools, which later became Personal Home Page Construction
  724.   Kit.
  725.  
  726.   At the same time I started playing with databases and wrote a tool to
  727.   easily embed SQL queries into web pages. It was basically another CGI
  728.   wrapper that parsed SQL queries and made it easy to create forms and
  729.   tables based on these queries. This tool was named FI (Form
  730.   Interpreter).
  731.  
  732.   PHP/FI version 2.0 is a complete rewrite of these two packages
  733.   combined into a single program. It has now evolved to the point where
  734.   it is a simple programming language embedded inside HTML files. The
  735.   original acronym, PHP, has stuck. It isn't really appropriate any
  736.   longer. PHP/FI is used more for entire web sites today than for small
  737.   Personal Home Page setups. By whatever name, it eliminates the need
  738.   for numerous small Perl cgi programs by allowing you to place simple
  739.   scripts directly in your HTML files. This speeds up the overall
  740.   performance of your web pages since the overhead of forking Perl
  741.   several times has been eliminated. It also makes it easier to manage
  742.   large web sites by placing all components of a web page in a single
  743.   html file. By including support for various databases, it also makes
  744.   it trivial to develop database enabled web pages. Many people find the
  745.   embedded nature much easier to deal with than trying to create
  746.   separate HTML and CGI files.
  747.  
  748.   Throughout this documentation any references to PHP, FI or PHP/FI all
  749.   refer to the same thing. The difference between PHP and FI is only a
  750.   conceptual one. Both are built from the same source distribution. When
  751.   I build the package without any access logging or access restriction
  752.   support, I call my binary FI. When I build with these options, I call
  753.   it PHP.
  754.  
  755.   19.4.  So, what can I do with PHP/FI?
  756.  
  757.   The first thing you will notice if you run a page through PHP/FI is
  758.   that it adds a footer with information about the number of times your
  759.   page has been accessed (if you have compiled access logging into the
  760.   binary). This is just a very small part of what PHP/FI can do for you.
  761.   It serves another very important role as a form interpreter cgi, hence
  762.   the FI part of the name. For example, if you create a form on one of
  763.   your web pages, you need something to process the information on that
  764.   form. Even if you just want to pass the information to another web
  765.   page, you will have to have a cgi program do this for you. PHP/FI
  766.   makes it extremely easy to take form data and do things with it.
  767.  
  768.   19.5.  A simple example
  769.  
  770.   Suppose you have a form:
  771.  
  772.        <FORM ACTION="/cgi-bin/php.cgi/~userid/display.html" METHOD=POST>
  773.        <INPUT TYPE="text" name="name">
  774.        <INPUT TYPE="text" name="age">
  775.        <INPUT TYPE="submit">
  776.        <FORM>
  777.  
  778.   Your display.html file could then contain something like:
  779.  
  780.   < ?echo "Hi $ name, you are $ age years old!
  781.  
  782.   " >
  783.  
  784.   It's that simple! PHP/FI automatically creates a variable for each
  785.   form input field in your form. You can then use these variables in the
  786.   ACTION URL file.
  787.  
  788.   The next step once you have figured out how to use variables is to
  789.   start playing with some logical flow tags in your pages. For example,
  790.   if you wanted to display different messages based on something the
  791.   user inputs, you would use if/else logic. In our above example, we can
  792.   display different things based on the age the user entered by changing
  793.   our display.html to:
  794.  
  795.        <?
  796.            if($age>50);
  797.                echo "Hi $name, you are ancient!<p>";
  798.            elseif($age>30);
  799.                echo "Hi $name, you are very old!<p>";
  800.            else;
  801.                echo "Hi $name.";
  802.            endif;
  803.        >
  804.  
  805.   PHP/FI provides a very powerful scripting language which will do much
  806.   more than what the above simple example demonstrates. See the section
  807.   on the PHP/FI Script Language for more information.
  808.  
  809.   You can also use PHP/FI to configure who is allowed to access your
  810.   pages.  This is done using a built-in configuration screen. With this
  811.   you could for example specify that only people from certain domains
  812.   would be allowed to see your pages, or you could create a rule which
  813.   would password protect certain pages. See the Access Control section
  814.   for more details.
  815.  
  816.   PHP/FI is also capable of receiving file uploads from any RFC-1867
  817.   compliant web browser. This feature lets people upload both text and
  818.   binary files. With PHP/FI's access control and logical functions, you
  819.   have full control over who is allowed to upload and what is to be done
  820.   with the file once it has been uploaded. See the File Upload section
  821.   for more details.
  822.  
  823.   PHP/FI has support for the Postgres95 database package. It supports
  824.   embedded SQL queries in your .HTML files. See the section on
  825.   Postgres95 Support for more information.
  826.  
  827.   PHP/FI also has support for the mysql database package. It supports
  828.   embedded SQL queries in your .HTML files. See the section on mysql
  829.   Support for more information.
  830.  
  831.   19.6.  CGI Redirection
  832.  
  833.   Apache 1.0.x Notes
  834.  
  835.   A good way to run PHP/FI is by using a cgi redirection module with the
  836.   Apache server. Please note that you do not need to worry about
  837.   redirection modules if you are using the Apache module version of
  838.   PHP/FI. There are two of these redirection modules available. One is
  839.   developed by Dave Andersen angio@aros.net and it is available at
  840.   ftp://ftp.aros.net/pub/util/apache/mod_cgi_redirect.c and the other
  841.   comes bundled with Apache and is called mod_actions.c. The modules are
  842.   extremely similar. They differ slightly in their usage. Both have been
  843.   tested and both work with PHP/FI.
  844.  
  845.   One large caveat at the time of this writing (Apr.20/96) is that the
  846.   current official Apache release (1.0.5) has a severe limitation which
  847.   prevents cgi redirected requests from having any post-method data
  848.   associated with them. I have tracked this down and fixed it in my
  849.   version of Apache, and there is an official patch available in the
  850.   File Archives on the PHP Home Page.
  851.  
  852.   A second rather large caveat with Apache 1.0.x is that it does not
  853.   align double types correctly on most architectures. You find find
  854.   yourself getting strange bus errors from your httpd when using
  855.   mod_php, either upgrade to Apache 1.1 or edit the alloc.c Apache
  856.   source file. In this file you will find the following piece of code:
  857.  
  858.   union align { /* Types which are likely to have the longest RELEVANT
  859.   alignment * restrictions... we don't do much with doubles.  */
  860.  
  861.   char *cp; void (*f)(); long l; FILE *fp; };
  862.  
  863.   You will need to add a double to this line and recompile your Apache
  864.   server. The correct block of code is:
  865.  
  866.   union align { /* Types which are likely to have the longest RELEVANT
  867.   alignment * restrictions... we don't do much with doubles.  */
  868.  
  869.   char *cp; void (*f)(); long l; FILE *fp; double d; };
  870.  
  871.   Check the Apache documentation on how to add a module. Generally you
  872.   add the module name to a file called Configuration. The line to be
  873.   added if you want to use the mod_actions module is:
  874.  
  875.   Module action_module mod_actions.o
  876.  
  877.   If you are using the mod_cgi_redirect.c module add this line:
  878.  
  879.   Module cgi_redirect_module mod_cgi_redirect.o
  880.  
  881.   Then compile your httpd and install it. To configure the cgi
  882.   redirection you need to either create a new mime type in your
  883.   mime.types file or you can use the AddType command in your srm.conf
  884.   file to add the mime type. The mime type to be added should be
  885.   something like this:
  886.  
  887.   application/x-httpd-php phtml
  888.  
  889.   If you are using the mod_actions.c module you need to add the
  890.   following line to your srm.conf file:
  891.  
  892.   Action application/x-httpd-php /cgi-bin/php.cgi
  893.  
  894.   If you are using mod_cgi_redirect.c you should add this line to
  895.   srm.conf:
  896.  
  897.   CgiRedirect application/x-httpd-php /cgi-bin/php.cgi
  898.  
  899.   Don't try to use both mod_actions.c and mod_cgi_redirect.c at the same
  900.   time.
  901.  
  902.   Once you have one of these cgi redirection modules installed and
  903.   configured correctly, you will be able to specify that you want a file
  904.   parsed by php/fi simply by making the file's extension .phtml.
  905.   Furthermore, if you add index.phtml to your DirectoryIndex
  906.   configuration line in your srm.conf file then the top-level page in a
  907.   directory will be automatically parsed by php if your index file is
  908.   called index.phtml.
  909.  
  910.   Netscape HTTPD
  911.  
  912.   You can automatically redirect requests for files with a given
  913.   extension to be handled by PHP/FI by using the Netscape Server CGI
  914.   Redirection module. This module is available in the File Archives on
  915.   the PHP/FI Home Page. The README in the package explicitly explains
  916.   how to configure it for use with PHP/FI.
  917.  
  918.   NCSA HTTPD
  919.  
  920.   NCSA does not currently support modules, so in order to do cgi
  921.   redirection with this server you need to modify your server source
  922.   code. A patch to do this with NCSA 1.5 is available in the PHP/FI file
  923.   archives.
  924.  
  925.   19.7.  Running PHP/FI from the command line
  926.  
  927.   If you build the CGI version of PHP/FI, you can use it from the
  928.   command line simply typing: php.cgi filename where filename is the
  929.   file you want to parse. You can also create standalone PHP/FI scripts
  930.   by making the first line of your script look something like:
  931.  
  932.            #!/usr/local/bin/php.cgi -q
  933.  
  934.   The "-q" suppresses the printing of the HTTP headers. You can leave
  935.   off this option if you like.
  936.  
  937.   20.  Python Interface for PostgreSQL
  938.  
  939.   PyGres95 is a python interface for the PostgreSQL. It is available
  940.   from
  941.   <ftp://ftp.via.ecp.fr/pub/python/contrib/Database/PyGres95-1.0b.tar.gz
  942.   >
  943.  
  944.   The extract from the home page of PyGres95 is given below:-
  945.  
  946.   PyGres - v1.0b : Postgres95 module for Python
  947.  
  948.   PyGres95, version 1.0b A Python interface for Postgres95 database.
  949.   Written by Pascal Andre, andre@chimay.via.ecp.fr
  950.  
  951.   Postgres95 is a database system derived from Postgres4.2. It conforms
  952.   to (most of) ANSI SQL and offer many interesting possibilities (C
  953.   dynamic linking for functions or type definition, time travel, ...).
  954.   This package is copyrighted by the Regents of the University of
  955.   California, and is freely distributable.
  956.  
  957.   Python is a interpretated programming langage. It is object oriented,
  958.   simple to use (light syntax, simple and straighforward statements),
  959.   and has many extensions for building GUIs, interfacing with WWW, ...
  960.   An "intelligent" web browser (HotJava like) is currently under
  961.   development (november 1995), and this should open programmers many
  962.   doors. Python is copyrighted by Stichting Mathematisch Centrum,
  963.   Amsterdam, The Netherlands, and is freely distributable.
  964.  
  965.   PyGres95 is a python module that interfaces Postgres95 database. It
  966.   embeds Postgres95 query library to allow an easy use of powerful
  967.   Postgres95 features cooperatively with all the other python modules.
  968.   It has been developed on a Linux 1.3/ELF system, but have been tested
  969.   on a Solaris 2.4 platform. Anyway, it should work on any platform
  970.   where python and postgres95 are available.
  971.  
  972.   20.1.  Where to get ... ?
  973.  
  974.   The home sites of the differents packages are:
  975.  
  976.   ╖  Python :      <ftp.python.org:/pub/python>
  977.  
  978.   ╖  Postgres95 :  <ftp.s2k-ftp.cs.berkeley.edu:/pub/postgres95>
  979.  
  980.   ╖  PyGres95 :    <ftp.via.ecp.fr:/pub/python/contrib>
  981.  
  982.   You should anyway try to find some mirror site closer of your site.
  983.   Refer to the information sources to find these sites. PyGres95 should
  984.   reside in the contrib directories of Python and Postgres95 sites.
  985.  
  986.   20.2.  Information and support
  987.  
  988.   If you need information about these packages please check their web
  989.   sites:
  990.  
  991.   ╖  Python :      <http://www.python.org/>
  992.  
  993.   ╖  Postgres95 :
  994.      <http://epoch.cs.berkeley.edu:8000/postgres95/index.html>
  995.  
  996.   ╖  PyGres95 :    <http://www.via.ecp.fr/via/products/pygres.html>
  997.  
  998.   For support :
  999.  
  1000.   ╖  Python :     newsgroup comp.lang.python
  1001.  
  1002.   ╖  Postgres95 : mailing list (see package documentation for
  1003.      information)
  1004.  
  1005.   ╖  PyGres95 :   contact me andre@via.ecp.fr for bug reports, ideas,
  1006.      remarks
  1007.  
  1008.      I will try to answer as long as my free time allow me to do that.
  1009.  
  1010.   21.  Gateway between PostgreSQL and the WWW - WDB-P95
  1011.  
  1012.   WDB-P95 - A Web interface to Postgres95 Databases.  It is at
  1013.   <http://www.eol.ists.ca/~dunlop/wdb-p95/>
  1014.  
  1015.   The extract from the home page of WDB-P95 is given below:-
  1016.  
  1017.   Version 1.4b2 beta - Created by J. Douglas Dunlop
  1018.  
  1019.   About wdb-p95
  1020.  
  1021.   This is a modified version of wdb-1.3a2 which provides a gateway to a
  1022.   the WWW for Postgres95. This version also requires a Browser that is
  1023.   capable of handling HTML Tables for the tabular output. This is not
  1024.   required by the original wdb and can be fairly easily reverted.  (I
  1025.   only wanted tables because the < pre > stuff just didn't agree with
  1026.   me!)
  1027.  
  1028.   You can try out my CASI Tape and Image Query. You can have a peek at
  1029.   the Form Definition File (FDF) that I used to create the CASI Tape and
  1030.   Image Query too, which includes a JOIN of 2 tables.
  1031.  
  1032.   This release contains all files necessary to install and run WDB-P95
  1033.   as an interface to your Postgres95 databases. To port this system to
  1034.   other database should be relatively easy - provided that it supports
  1035.   standard SQL and has a Perl interface.
  1036.  
  1037.   21.1.  Does the Postgres95 server,pgperl, and httpd have to be on the
  1038.   same host?
  1039.  
  1040.   No - the Postgres95 server does not have to be on the same host. As
  1041.   WDB-P95 is called by the http daemon, they have to be on the same
  1042.   host. - And as WDB-P95 was written to use Pg.pm - pgperl has to be on
  1043.   the same host too.  Pgperl was written using the libpq library, so it
  1044.   will be able to access any Postgres95 server anywhere in the net, just
  1045.   like any other Postgres95 client. As illustrated below
  1046.  
  1047.   {WWW Client (Netscape)} => {HTTP Server (NCSA's http) + WDB-P95 +
  1048.   pgperl + libpq}=> {Postgres95 server}
  1049.  
  1050.   Curly brackets {} represent machines.
  1051.  
  1052.   Each machine can be of a different type : NT, SUN, HP, ... but you
  1053.   need the libpq interface library for the machine type where you plan
  1054.   to use WDB-P95, as you need it to compile pgperl. (The system was
  1055.   designed to use HTML tables so a recent WWW client is best)
  1056.  
  1057.   21.2.  New Version
  1058.  
  1059.   New versions of the software and the above pages are always available
  1060.   from the WDB-P95 Home page.  <http://www.eol.ists.ca/~dunlop/wdb-p95/>
  1061.  
  1062.   For questions or to join Mailing lists contact dunlop@eol.ists.ca
  1063.  
  1064.   22.  C" language Interface for PostgreSQL
  1065.  
  1066.   Included in distribution and is called 'libpq'. Similar to Oracle OCI,
  1067.   Sybase DB-lib, Informix CLI libraries.
  1068.  
  1069.   23.  C++" language Interface for PostgreSQL
  1070.  
  1071.   Included in distribution and is called 'libpq++'.
  1072.  
  1073.   24.  ESQL/C for PostgreSQL
  1074.  
  1075.   Embedded C Pre-compiler for PostgreSQL ESQL/C like Oracle Pro*C,
  1076.   Informix ESQL/C:
  1077.  
  1078.   ╖  <ftp://ftp.lysator.liu.se/pub/linus>
  1079.  
  1080.   ╖  Email : linus@epact.se
  1081.  
  1082.   The PostgreSQL ESQL/C is an SQL application-programming interface
  1083.   (API) enables the C programmer to create custom applications with
  1084.   database-management capabilities. The PostgreSQL ESQL/C allows you to
  1085.   use a third-generation language with which you are familiar and still
  1086.   take advantage of the Structured Query Language (SQL).
  1087.  
  1088.   ESQL/C consists of the following pieces of software:
  1089.  
  1090.   ╖  The ESQL/C libraries of C functions provide access to the database
  1091.      server.
  1092.  
  1093.   ╖  The ESQL/C header files provide definitions for the data
  1094.      structures, constants, and macros useful to the ESQL/C program.
  1095.  
  1096.   ╖  The ESQL/C preprocessor, is a source-code preprocessor that
  1097.      converts a C file containing SQL statements into an executable
  1098.      file.
  1099.  
  1100.   25.  Japanese Kanji Code for PostgreSQL
  1101.  
  1102.   Very useful for Japanese people.  It is at the following site
  1103.   <ftp://ftp.sra.co.jp/pub/cmd/postgres/>
  1104.  
  1105.   26.  PostgreSQL Port to Windows 95/Windows NT
  1106.  
  1107.   Port to Windows 95/Windows NT is underway.  Porting is being done
  1108.   using gcc, gmake for Win NT/95. To compile source code on win32 gnu-
  1109.   win32 program is used.  GNU gcc is available for win32. Check this
  1110.   site -
  1111.  
  1112.   ╖  <http://www.cygnus.com/misc/gnu-win32>
  1113.  
  1114.      At this site and get the file cdk.exe (self-extractor file for gnu-
  1115.      win32)
  1116.  
  1117.   Porting can also be done using the following "Unix-Emulator on NT"
  1118.   tool from
  1119.  
  1120.   ╖  <http://www.softway.com>
  1121.  
  1122.   27.  Mailing Lists
  1123.  
  1124.   See the Mailing Lists Item on the main web page at :
  1125.   <http://www.postgresql.org/>
  1126.  
  1127.   ╖  Email questions to: pgsql-questions@postgresql.org
  1128.  
  1129.   ╖  Developers pgsql-hackers@postgresql.org
  1130.  
  1131.   ╖  Port specific questions pgsql-ports@postgresql.org
  1132.  
  1133.   ╖  Documentation questions pgsql-docs@postgresql.org
  1134.  
  1135.      You will get the answers/replies back by e-mail in less than a
  1136.      day!!
  1137.  
  1138.   You can also subscribe to mailing lists.  To subscribe or unsubscribe
  1139.   from the list, send mail to
  1140.  
  1141.   ╖  pgsql-questions-request@postgresql.org
  1142.  
  1143.   ╖  pgsql-hackers-request@postgresql.org
  1144.  
  1145.   ╖  pgsql-ports-request@postgresql.org
  1146.  
  1147.   ╖  pgsql-docs-request@postgresql.org
  1148.  
  1149.      The body of the message should contain the single line
  1150.  
  1151.   subscribe
  1152.  
  1153.   (or)
  1154.  
  1155.   unsubscribe
  1156.  
  1157.   Also mailing lists are archived in html format at the following
  1158.   location -
  1159.  
  1160.   ╖  <ftp://ftp.postgresql.org> directory is /pub/majordomo
  1161.  
  1162.   28.  Documentations and Books
  1163.  
  1164.   Included in the distribution is the
  1165.  
  1166.   ╖
  1167.  
  1168.   ╖
  1169.  
  1170.   ╖  Online manuals.
  1171.  
  1172.   ╖  Online manuals in HTML formats.
  1173.  
  1174.   ╖  Also manuals in Postscript format for printing hard copies.
  1175.  
  1176.   Reference docs: Useful reference textbooks :
  1177.  
  1178.   ╖  "Understanding the New SQL: A Complete Guide" - by Jim Melton and
  1179.      Alan R.Simon Morgan Kaufman Publisher is one of best SQL books.
  1180.  
  1181.   ╖  "A Guide to THE SQL STANDARD" - by C.J.Date Addison-Wesley
  1182.      Publishing company is also a good book
  1183.  
  1184.      Hundreds of other titles on SQL are available! Check out a
  1185.      bookstore.
  1186.  
  1187.   29.  Technical support for PostgreSQL
  1188.  
  1189.   ╖  You can e-mail your technical questions or problems you face to:
  1190.      pgsql-questions@postgresql.org
  1191.  
  1192.      and you will get back e-mail answer in less than a day.
  1193.  
  1194.   You can also purchase technical support from the following
  1195.   companies/corporations -
  1196.  
  1197.   ╖  <http://www.redhat.com>
  1198.  
  1199.   ╖  <http://www.caldera.com>
  1200.  
  1201.   ╖  <http://www.wgs.com>
  1202.  
  1203.   ╖  <http://www.yggdrasil.com>
  1204.  
  1205.   30.  Economic and Business Aspects
  1206.  
  1207.   Commercial databases pay federal state taxes, sales tax, employment
  1208.   taxes, social security taxes, health care for employees, bunch of
  1209.   benefits for employees, marketing and advertisement costs. All these
  1210.   costs do not go directly for the development of the database. When you
  1211.   buy a commercial database, about 60% of amount goes to taxes+benefits,
  1212.   20% for marketing, 10% for profit margin and the balance 10% for
  1213.   actual database R&D costs. Hence the real worth of the database is
  1214.   much less.
  1215.  
  1216.   Also commercial databases have to pay for buildings/real-estates and
  1217.   purchase Unix machines, install and maintain them. All of these costs
  1218.   are passed onto customers.
  1219.  
  1220.   PostgreSQL has the advantage over commercial databases as there is no
  1221.   direct tax since it is made on the internet. A very vast group of
  1222.   companies contribute to the development of the PostgreSQL. For
  1223.   example, if there are one million companies in U.S.A and each
  1224.   contribute about $ 10 (worth of software to PostgreSQL) than each and
  1225.   every company will get ten million dollars!! This is the magic of
  1226.   software development on internet.
  1227.  
  1228.   Currently, PostgreSQL source code is about 2,00,000 lines of "C",
  1229.   "C++" code. If cost of each line of "C" code is $ 10 than the total
  1230.   cost of PostgreSQL as of today is $ 2,000,000 (two million dollars!!).
  1231.  
  1232.   Many companies already develop in-house vast amount of "C", "C++"
  1233.   code. Hence by taking in the source code of PostgreSQL and
  1234.   collaborating with other companies on internet will greatly benefit
  1235.   the company saving time and efforts.
  1236.  
  1237.   31.  Conclusion
  1238.  
  1239.   After researching all the available databases which are free and
  1240.   source code is available, it was found that ONLY PostgreSQL is the
  1241.   MOST mature, most widely used and robust RDBMS SQL free database in
  1242.   the world. PostgreSQL is very appealing as lot of work had already
  1243.   been done and it has ODBC, JDBC drivers using these it is possible to
  1244.   write applications independent of the databases. The applications
  1245.   written in PostgreSQL using ODBC, JDBC drivers are easily portable to
  1246.   other databases like Oracle, Sybase and Informix. And applications
  1247.   written for Oracle, Sybase and Informix using ODBC, JDBC drivers are
  1248.   easily portable to PostgreSQL database.
  1249.  
  1250.   32.  FAQ - Questions on PostgreSQL
  1251.  
  1252.   32.1.  Frequently Asked Questions (FAQ) for PostgreSQL
  1253.  
  1254.   Last updated: Wed Jun 11 10:44:40 EDT 1997 Version: 6.1.1
  1255.  
  1256.   Current maintainer: Bruce Momjian (maillist@candle.pha.pa.us)
  1257.  
  1258.   The most recent version of this document can be viewed at the
  1259.   postgreSQL Web site,  <http://www.postgreSQL.org>
  1260.  
  1261.   Linux-specific questions are answered in
  1262.   <http://www.postgreSQL.org/docs/FAQ-Linux.phtml>
  1263.   Irix-specific questions are answered in
  1264.   <http://www.postgreSQL.org/docs/FAQ-Irix.phtml>
  1265.  
  1266.   Changes in this version (* = modified, + = new):
  1267.  
  1268.   * 3.42) What is Genetic Query Optimization?  * 3.43) I am running
  1269.   Solaris and my dates display wrong. Why?
  1270.  
  1271.   ---------------------------------------------------------------------------
  1272.  
  1273.   32.2.  What is PostgreSQL?
  1274.  
  1275.   PostgreSQL is an enhancement of the POSTGRES database management
  1276.   system, a next-generation DBMS research prototype. While PostgreSQL
  1277.   retains the powerful data model and rich data types of POSTGRES, it
  1278.   replaces the PostQuel query language with an extended subset of SQL.
  1279.   PostgreSQL is free and the complete source is available.
  1280.  
  1281.   PostgreSQL development is being performed by a team of Internet
  1282.   developers who all subscribe to the PostgreSQL development mailing
  1283.   list. The current coordinator is Marc G. Fournier
  1284.   (scrappy@postgreSQL.org). (See below on how to join). This team is now
  1285.   responsible for all current and future development of PostgreSQL.
  1286.  
  1287.   The authors of PostgreSQL 1.01 were Andrew Yu and Jolly Chen. Many
  1288.   others have contributed to the porting, testing, debugging and
  1289.   enhancement of the code. The original Postgres code, from which
  1290.   PostgreSQL is derived, was the effort of many graduate students,
  1291.   undergraduate students, and staff programmers working under the
  1292.   direction of Professor Michael Stonebraker at the University of
  1293.   California, Berkeley.
  1294.  
  1295.   The original name of the software at Berkeley was Postgres. When SQL
  1296.   functionality was added in 1995, its name was changed to Postgres95.
  1297.   The name was changed at the end of 1996 to PostgreSQL.
  1298.  
  1299.   32.3.  What does PostgreSQL run on?
  1300.  
  1301.   The authors have compiled and tested PostgreSQL on the following
  1302.   platforms(some of these compiles require gcc 2.7.0):
  1303.  
  1304.   * aix - IBM on AIX 3.2.5
  1305.  
  1306.   * alpha - DEC Alpha AXP on OSF/1 2.0
  1307.  
  1308.   * BSD44_derived - OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)
  1309.  
  1310.   * bsdi - BSD/OS 2.0, 2.01, 2.1, 3.0
  1311.  
  1312.   * dgux - DG/UX 5.4R3.10
  1313.  
  1314.   * hpux - HP PA-RISC on HP-UX 9.0
  1315.  
  1316.   * i386_solaris - i386 Solaris
  1317.  
  1318.   * irix5 - SGI MIPS on IRIX 5.3
  1319.  
  1320.   * linux - Intel x86 on Linux 1.2 and Linux ELF (For non-ELF Linux, see
  1321.   LINUX_ELF below).
  1322.  
  1323.   * sparc_solaris - SUN SPARC on Solaris 2.4
  1324.  
  1325.   * sunos4 - SUN SPARC on SunOS 4.1.3
  1326.  
  1327.   * svr4 - Intel x86 on Intel SVR4 * ultrix4 - DEC MIPS on Ultrix 4.4
  1328.  
  1329.   The following platforms have known problems/bugs:
  1330.  
  1331.   * nextstep - Motorola MC68K or Intel x86 on NeXTSTEP 3.2
  1332.  
  1333.   32.4.  Where can I get PostgreSQL?
  1334.  
  1335.   The primary anonymous ftp site for PostgreSQL is:
  1336.  
  1337.   *  <ftp://ftp.postgreSQL.org/pub>
  1338.  
  1339.   A mirror site exists at:
  1340.  
  1341.   *  <ftp://postgres95.vnet.net/pub/postgres95> *
  1342.   <ftp://ftp.luga.or.at/pub/postgres95> *
  1343.   <ftp://cal011111.student.utwente.nl/pub/postgres95> *  <ftp://ftp.uni-
  1344.   trier.de/pub/database/rdbms/postgres/postgres95> *
  1345.   <ftp://rocker.sch.bme.hu>
  1346.  
  1347.   32.5.  What's the copyright on PostgreSQL?
  1348.  
  1349.   PostgreSQL is subject to the following COPYRIGHT.
  1350.  
  1351.   PostgreSQL Data Base Management System
  1352.  
  1353.   Copyright (c) 1994-6 Regents of the University of California
  1354.  
  1355.   Permission to use, copy, modify, and distribute this software and its
  1356.   documentation for any purpose, without fee, and without a written
  1357.   agreement is hereby granted, provided that the above copyright notice
  1358.   and this paragraph and the following two paragraphs appear in all
  1359.   copies.
  1360.  
  1361.   IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  1362.   FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
  1363.   INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND
  1364.   ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN
  1365.   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1366.  
  1367.   THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  1368.   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  1369.   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
  1370.   PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
  1371.   CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
  1372.   UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  1373.  
  1374.   32.6.  Support for PostgreSQL
  1375.  
  1376.   There is no official support for PostgreSQL from the original
  1377.   maintainers or from University of California, Berkeley. It is
  1378.   maintained through volunteer effort only.
  1379.  
  1380.   The main mailing list is: questions@postgreSQL.org. It is available
  1381.   for discussion o f matters pertaining to PostgreSQL, including but not
  1382.   limited to bug reports and fixes. For info on how to subscribe, send a
  1383.   mail with the lines in the body (not the subject line)
  1384.   subscribe end
  1385.  
  1386.   to questions-request@postgreSQL.org.
  1387.  
  1388.   There is also a digest list available. To subscribe to this list, send
  1389.   email to: questions-digest-request@postgreSQL.org with a BODY of:
  1390.  
  1391.   subscribe end
  1392.  
  1393.   Digests are sent out to members of this list whenever the main list
  1394.   has received around 30k of messages.
  1395.  
  1396.   There is a bugs mailing list available. To subscribe to this list,
  1397.   send email to bugs-request@postgreSQL.org with a BODY of:
  1398.  
  1399.   There is also a developers discussion mailing list available. To
  1400.   subscribe to this list, send email to hackers-request@postgreSQL.org
  1401.   with a BODY of:
  1402.  
  1403.   subscribe end
  1404.  
  1405.   Additional information about PostgreSQL can be found via the
  1406.   PostgreSQL WWW home page at:
  1407.  
  1408.   <http://www.postgreSQL.org>
  1409.  
  1410.   32.7.  Latest release of PostgreSQL
  1411.  
  1412.   The latest release of PostgreSQL is version 6.0, which was released on
  1413.   January 31, 1997. 6.1 is scheduled for release soon. For information
  1414.   about what is new in 6.1, see our TODO list on our WWW page.
  1415.  
  1416.   We expect a 7.0 release in several months that will remove time-travel
  1417.   and reduce by 50 % the size of on-disk system columns maintained for
  1418.   each row in a table. This release will also require a dump and
  1419.   restore.
  1420.  
  1421.   32.8.  Is there a commercial version of PostgreSQL?
  1422.  
  1423.   Illustra Information Technology (a wholly owned subsidiary of Informix
  1424.   Software, Inc.) sells an object-relational DBMS called Illustra that
  1425.   was originally based on postgres. Illustra has cosmetic similarities
  1426.   to PostgreSQL but has more features, is more robust, performs better,
  1427.   and offers real documentation and support. On the flip side, it costs
  1428.   money.  For more information, contact sales@illustra.com
  1429.  
  1430.   32.9.  What documentation is available for PostgreSQL?
  1431.  
  1432.   A user manual, manual pages, and some small test examples are included
  1433.   in the distribution. The sql and built-in manual pages are
  1434.   particularly important.
  1435.  
  1436.   The www page contains pointers to an implementation guide and five
  1437.   papers written about postgres design concepts and features.
  1438.  
  1439.   32.10.  What version of SQL does PostgreSQL use?
  1440.  
  1441.   PostgreSQL supports a subset of SQL-92. It has most of the important
  1442.   constructs but lacks some of the functionality. The most visible
  1443.   differences are:
  1444.  
  1445.   * no support for nested subqueries * no HAVING clause under a GROUP BY
  1446.  
  1447.   On the other hand, you get to create user-defined types, functions,
  1448.   inheritance etc. If you're willing to help with PostgreSQL coding,
  1449.   eventually we can also add the missing features listed above.
  1450.  
  1451.   32.11.  Does PostgreSQL work with databases from earlier versions of
  1452.   postgres?
  1453.  
  1454.   PostgreSQL v1.09 is compatible with databases created with v1.01.
  1455.   Those upgrading from 1.0 should read the directions in the
  1456.   MIGRATION_1.0_TO_1.02 directory.
  1457.  
  1458.   Upgrading to 6.0 requires a dump and restore from previous releases.
  1459.  
  1460.   Upgrading to 6.1 requires a dump and restore from previous releases.
  1461.  
  1462.   Those ugrading from versions earlier than 1.09 must upgrade to 1.09
  1463.   first without a dump/reload, then dump the data from 1.09, and then
  1464.   load it into 6.0 or 6.1.
  1465.  
  1466.   32.12.  How many people use PostgreSQL?
  1467.  
  1468.   Since we don't have any licensing or registration scheme, it's
  1469.   impossible to tell. We do know hundreds copies of PostgreSQL v1.* have
  1470.   been downloaded, and that there many hundreds of subscribers to the
  1471.   mailing lists.
  1472.  
  1473.   ---------------------------------------------------------------------------
  1474.  
  1475.   33.  FAQ - Installation Questions
  1476.  
  1477.   33.1.  Initdb doesn't run
  1478.  
  1479.   * check to see that you have the proper paths set * check that the
  1480.   'postgres' user owns all the right files * ensure that there are files
  1481.   in  $ PGDATA/files, and that they are non-empty. If they aren't, then
  1482.   "gmake install" failed for some reason
  1483.  
  1484.   33.2.  When I start up the postmaster, I get "FindBackend- could not
  1485.   find a backend to execute..." "postmaster- could not find backend to
  1486.   execute..."
  1487.  
  1488.   You probably do not have the right path set up. The 'postgres'
  1489.   executable needs to be in your path.
  1490.  
  1491.   33.3.  The system seems to be confused about commas, decimal points,
  1492.   and date formats.
  1493.  
  1494.   Check your locale configuration. PostgreSQL uses the locale settings
  1495.   of the user that ran the postmaster process. Set those accordingly for
  1496.   your operating environment.
  1497.  
  1498.   33.4.  How do I install PostgreSQL somewhere other than
  1499.   /usr/local/pgsql?
  1500.  
  1501.   You need to edit Makefile.global and change POSTGRESDIR accordingly,
  1502.   or create a Makefile.custom and define POSTGRESDIR there.
  1503.  
  1504.   33.5.  When I run postmaster, I get a Bad System Call core dumped mes¡
  1505.   sage.
  1506.  
  1507.   It could be a variety of problems, but first check to see that you
  1508.   have system V extensions installed on your kernel. PostgreSQL requires
  1509.   kernel support for shared memory.
  1510.  
  1511.   33.6.  When I try to start the postmaster, I get IpcMemoryCreate
  1512.   errors.
  1513.  
  1514.   You either do not have shared memory configured properly in kernel or
  1515.   you need to enlarge the shared memory available in the kernel. The
  1516.   exact amount you need depends on your architecture and how many
  1517.   buffers you configure postmaster to run with. For most systems, with
  1518.   default buffer sizes, you need a minimum of  ~ 760K.
  1519.  
  1520.   33.7.  I have changed a source file, but a recompile does not see the
  1521.   change?
  1522.  
  1523.   The Makefiles do not have the proper dependencies for include files.
  1524.   You have to do a 'make clean' and then another 'make'.
  1525.  
  1526.   ---------------------------------------------------------------------------
  1527.  
  1528.   34.  FAQ - PostgreSQL Features
  1529.  
  1530.   34.1.  How do I specify a KEY or other constraints on a column?
  1531.  
  1532.   Column constraints are not supported in PostgreSQL. As a consequence,
  1533.   the system does not check for duplicates.
  1534.  
  1535.   Under 6.0, create a unique index on the column. Attempts to create
  1536.   duplicate of that column will report an error.
  1537.  
  1538.   34.2.  Does PostgreSQL support nested subqueries?
  1539.  
  1540.   Subqueries are not implemented, but they can be simulated using sql
  1541.   functions.
  1542.  
  1543.   34.3.  How do I define a unique indices?
  1544.  
  1545.   PostgreSQL 6.0 supports unique indices.
  1546.  
  1547.   34.4.  I've having a lot of problems using rules.
  1548.  
  1549.   Currently, the rule system in PostgreSQL is mostly broken. It works
  1550.   enough to support the view mechanism, but that's about it. Use
  1551.   PostgreSQL rules at your own peril.
  1552.  
  1553.   34.5.  I can't seem to write into the middle of large objects reli¡
  1554.   ably.
  1555.  
  1556.   The Inversion large object system in PostgreSQL is also mostly broken.
  1557.   It works well enough for storing large wads of data and reading them
  1558.   back out, but the implementation has some underlying problems. Use
  1559.   PostgreSQL large objects at your own peril.
  1560.  
  1561.   34.6.  Does PostgreSQL have a graphical user interface? A report gen¡
  1562.   erator? A embedded query language interface?
  1563.  
  1564.   No. No. No. Not in the official distribution at least. Some users have
  1565.   reported some success at using 'pgbrowse' and 'onyx' as frontends to
  1566.   PostgreSQL. Several contributions are working on tk based frontend
  1567.   tools.  Ask on the mailing list.
  1568.  
  1569.   34.7.  How can I write client applications to PostgreSQL?
  1570.  
  1571.   PostgreSQL supports a C-callable library interface called libpq as
  1572.   well as a Tcl-based library interface called libtcl.
  1573.  
  1574.   Others have contributed a perl interface and a WWW gateway to
  1575.   PostgreSQL.  See the PostgreSQL home pages for more details.
  1576.  
  1577.   34.8.  How do I prevent other hosts from accessing my PostgreSQL back¡
  1578.   end?
  1579.  
  1580.   Use host-based authentication by modifying the file  $ PGDATA/pg_hba
  1581.   accordingly.
  1582.  
  1583.   34.9.  How do I set up a pg_group?
  1584.  
  1585.   Currently, there is no easy interface to set up user groups. You have
  1586.   to explicitly insert/update the pg_group table. For example:
  1587.  
  1588.           jolly=> insert into pg_group (groname, grosysid, grolist)
  1589.           jolly=>     values ('posthackers', '1234', '5443, 8261');
  1590.           INSERT 548224
  1591.           jolly=> grant insert on foo to group posthackers;
  1592.           CHANGE
  1593.           jolly=>
  1594.  
  1595.   The fields in pg_group are:
  1596.  
  1597.   * groname: the group name. This a char16 and should be purely
  1598.   alphanumeric. Do not include underscores or other punctuation.  *
  1599.   grosysid: the group id. This is an int4. This should be unique for
  1600.   each group.  * grolist: the list of pg_user id's that belong in the
  1601.   group.
  1602.  
  1603.           This is an int4[].
  1604.  
  1605.   34.10.  What is the exact difference between binary cursors and normal
  1606.   cursors?
  1607.  
  1608.   Normal cursors return data back in ASCII format. Since data is stored
  1609.   natively in binary format, the system must do a conversion to produce
  1610.   the ASCII format. In addition, ASCII formats are often large in size
  1611.   than binary format. Once the attributes come back in ASCII, often the
  1612.   client application then has to convert it to a binary format to
  1613.   manipulate it anyway.
  1614.  
  1615.   Binary cursors give you back the data in the native binary
  1616.   representation.  Thus, binary cursors will tend to be a little faster
  1617.   since there's less overhead of conversion.
  1618.  
  1619.   However, ASCII is architectural neutral whereas binary representation
  1620.   can differ between different machine architecture. Thus, if your
  1621.   client machine uses a different representation than you server
  1622.   machine, getting back attributes in binary format is probably not what
  1623.   you want. Also, if your main purpose is displaying the data in ASCII,
  1624.   then getting it back in ASCII will save you some effort on the client
  1625.   side.
  1626.  
  1627.   34.11.  Why doesn't the != operator work?
  1628.  
  1629.   SQL specifies < > as the inequality operator, and that is what we have
  1630.   defined for the built-in types.
  1631.  
  1632.   In 6.0, != is equivalent to < > .
  1633.  
  1634.   34.12.  What is a R-tree index and what is it used for?
  1635.  
  1636.   An r-tree index is used for indexing spatial data. A hash index can't
  1637.   handle range searches. A B-tree index only handles range searches in a
  1638.   single dimension. R-tree's can handle multi-dimensional data. For
  1639.   example, if a R-tree index can be built on an attribute of type
  1640.   'point', the system can more efficient answer queries like select all
  1641.   points within a bounding rectangle.
  1642.  
  1643.   The canonical paper that describes the original R-Tree design is:
  1644.  
  1645.   Guttman, A. "R-Trees: A Dynamic Index Structure for Spatial
  1646.   Searching."  Proc of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data,
  1647.   45-57.
  1648.  
  1649.   You can also find this paper in Stonebraker's "Readings in Database
  1650.   Systems"
  1651.  
  1652.   34.13.  What is the maximum size for a tuple?
  1653.  
  1654.   Tuples are limited to 8K bytes. Taking into account system attributes
  1655.   and other overhead, one should stay well shy of 8,000 bytes to be on
  1656.   the safe side. To use attributes larger than 8K, try using the large
  1657.   objects interface.
  1658.  
  1659.   Tuples do not cross 8k boundaries so a 5k tuple will require 8k of
  1660.   storage.
  1661.  
  1662.   34.14.  I defined indices but my queries don't seem to make use of
  1663.   them. Why?
  1664.  
  1665.   PostgreSQL does not automatically maintain statistics. One has to make
  1666.   an explicit 'vacuum' call to update the statistics. After statistics
  1667.   are updated, the optimizer has a better shot at using indices. Note
  1668.   that the optimizer is limited and does not use indices in some
  1669.   circumstances (such as OR clauses).
  1670.  
  1671.   If the system still does not see the index, it is probably because you
  1672.   have created an index on a field with the improper *_ops type. For
  1673.   example, you have created a CHAR(4) field, but have specified a
  1674.   char_ops index type_class.
  1675.  
  1676.   See the create_index manual page for information on what type classes
  1677.   are available. It must match the field type.
  1678.  
  1679.   Postgres does not warn the user when the improper index is created.
  1680.  
  1681.   Indexes not used for ORDER BY operations.
  1682.  
  1683.   34.15.  Are there ODBC drivers for PostgreSQL?
  1684.  
  1685.   There are two ODBC drivers available, PostODBC and OpenLink ODBC.
  1686.  
  1687.   For all people being interested in PostODBC, there are now two mailing
  1688.   lists devoted to the discussion of PostODBC. The mailing lists are:
  1689.  
  1690.   * postodbc-users@listserv.direct.net * postodbc-
  1691.   developers@listserv.direct.net
  1692.  
  1693.   these lists are ordinary majordomo mailing lists. You can subscribe by
  1694.   sending a mail to:
  1695.  
  1696.   * majordomo@listserv.direct.net
  1697.  
  1698.   OpenLink ODBC is currently in beta under Linux. You can get it from
  1699.   <http://www.openlinksw.com/postgres.html> It works with our standard
  1700.   ODBC client software so you'll have Postgres ODBC available on every
  1701.   client platform we support (Win, Mac, Unix, VMS).
  1702.  
  1703.   We will probably be selling this product to people who need
  1704.   commercial-quality support, but a freeware version will always be
  1705.   available. Questions to postgres95@openlink.co.uk.
  1706.  
  1707.   34.16.  How do I use postgres for multi-dimensional indexing (> 2
  1708.   dimensions)?
  1709.  
  1710.   Builtin R-Trees can handle polygons and boxes. In theory, R-trees can
  1711.   be extended to handle higher number of dimensions. In practice,
  1712.   extending R-trees require a bit of work and we don't currently have
  1713.   any documentation on how to do it.
  1714.  
  1715.   34.17.  How do I do regular expression searches? case-insensitive reg¡
  1716.   exp searching?
  1717.  
  1718.        PostgreSQL supports the SQL LIKE syntax as well as more general regular
  1719.        expression searching with the ~ operator. The !~ is the negated regexp
  1720.        operator. ~* and !~* are the case-insensitive regular expression operators.
  1721.  
  1722.   34.18.  I can't access the database as the 'root' user.
  1723.  
  1724.   You should not create database users with user id 0(root). They will
  1725.   be unable to access the database. This is a security precaution
  1726.   because of the ability of any user to dynamically link object modules
  1727.   into the database engine.
  1728.  
  1729.   34.19.  I experienced a server crash during a vacuum. How do I remove
  1730.   the lock file?
  1731.  
  1732.   If the server crashes during a vacuum command, chances are it will
  1733.   leave a lock file hanging around. Attempts to re-run the vacuum
  1734.   command result in
  1735.  
  1736.   WARN:can't create lock file -- another vacuum cleaner running?
  1737.  
  1738.   If you are sure that no vacuum is actually running, you can remove the
  1739.   file called "pg_vlock" in your database directory (which is $
  1740.   PGDATA/base/< dbName >)
  1741.  
  1742.   34.20.  What is the difference between the various character types?
  1743.  
  1744.   Type            Internal Name   Notes
  1745.  
  1746.   --------------------------------------------------
  1747.  
  1748.   CHAR            char            1 character
  1749.  
  1750.   CHAR2           char2           2 characters
  1751.  
  1752.   CHAR4           char4           4 characters   optimized for a fixed length
  1753.  
  1754.   CHAR8           char8           8 characters
  1755.  
  1756.   CHAR16          char16          16 characters
  1757.  
  1758.   CHAR(#)         bpchar          blank padded to the specified fixed length
  1759.  
  1760.   VARCHAR(#)      varchar         size specifies maximum length, no padding
  1761.  
  1762.   TEXT            text            length limited only by maximum tuple length
  1763.  
  1764.   BYTEA           bytea           variable-length array of bytes
  1765.  
  1766.   Remember, you need to use the internal name when creating indexes on these
  1767.   fields or when doing other internal operations.
  1768.  
  1769.   The last four types above are "varlena" types (i.e. the first four bytes is
  1770.   the length, followed by the data). CHAR(#) and VARCHAR(#) allocate the
  1771.   maximum number of bytes no matter how much data is stored in the field.
  1772.   TEXT and BYTEA are the only character types that have variable length on
  1773.   the disk.
  1774.  
  1775.   34.21.  In a query, how do I detect if a field is NULL?
  1776.  
  1777.   PostgreSQL has two builtin keywords, "isnull" and "notnull" (note no
  1778.   spaces). Version 1.05 and later and 6.* understand IS NULL and IS NOT
  1779.   NULL.
  1780.  
  1781.   34.22.  How do I see how the query optimizer is evaluating my query?
  1782.  
  1783.   Place the word 'EXPLAIN' at the beginning of the query, for example:
  1784.  
  1785.   EXPLAIN SELECT * FROM table1 WHERE age = 23;
  1786.  
  1787.   34.23.  How do I create a serial field?
  1788.  
  1789.   Postgres does not allow the user to specifiy a user column as type
  1790.   SERIAL.  Instead, you can use each row's oid field as a unique value.
  1791.   However, if you need to dump and reload the database, you need to be
  1792.   using postgres version 1.07 or later or 6.* with pgdump's -o option or
  1793.   COPY's WITH OIDS option to preserver the oids.
  1794.  
  1795.   Another valid way of doing this is to create a function:
  1796.  
  1797.   create table my_oids (f1 int4);
  1798.  
  1799.   insert into my_oids values (1);
  1800.  
  1801.   create function new_oid () returns int4 as language 'sql';
  1802.  
  1803.   then:
  1804.  
  1805.   create table my_stuff (my_key int4, value text);
  1806.  
  1807.   insert into my_stuff values (new_oid(), 'hello');
  1808.  
  1809.   However, keep in mind there is a race condition here where one server
  1810.   could do the update, then another one do an update, and they both
  1811.   could select the same new id. This statement should be performed
  1812.   within a transaction.
  1813.  
  1814.   Sequences are implemented in 6.1
  1815.  
  1816.   34.24.  How do I create a multi-column index?
  1817.  
  1818.   In 6.0, you can not directly create a multi-column index using create
  1819.   index. You need to define a function which acts on the multiple
  1820.   columns, then use create index with that function.
  1821.  
  1822.   In 6.1, this feature is available.
  1823.  
  1824.   34.25.  What are the temp_XXX files in my database directory?
  1825.  
  1826.   They are temp_ files generated by the query executor. For example, if
  1827.   a sort needs to be done to satisfy an ORDER BY, some temp files are
  1828.   generated as a result of the sort.
  1829.  
  1830.   If you have no transactions or sorts running at the time, it is safe
  1831.   to delete the temp_ files.
  1832.  
  1833.   34.26.  Why are my table files not getting any smaller after a delete?
  1834.  
  1835.   If you run vacuum in pre-6.0, unused rows will be marked for reuse,
  1836.   but the file blocks are not released.
  1837.  
  1838.   In 6.0, vacuum properly shrinks tables.
  1839.  
  1840.   34.27.  Why can't I connect to my database from another machine?
  1841.  
  1842.   The default configuration allows only connections from tcp/ip host
  1843.   localhost. You need to add a host entry to the file pgsql/data/pg_hba.
  1844.  
  1845.   34.28.  I get the error 'default index class unsupported' when creat¡
  1846.   ing an index. How do I do it?
  1847.  
  1848.   You probably used:
  1849.  
  1850.   create index idx1 on person using btree (name);
  1851.  
  1852.   PostgreSQL indexes are extensible, and therefore in pre-6.0, you must
  1853.   specify a class_type when creating an index. Read the manual page for
  1854.   create index (called create_index).
  1855.  
  1856.   Version 6.0, if you do not specify a class_type, it defaults to the
  1857.   proper type for the column.
  1858.  
  1859.   34.29.  Why does creating an index crash the backend server?
  1860.  
  1861.   You have probably defined an incorrect *_ops type class for the field
  1862.   you are indexing.
  1863.  
  1864.   34.30.  How do I find out what indexes or operations are defined in
  1865.   the database?
  1866.  
  1867.   Run the file pgsql/src/tutorial/syscat.source. It illustrates many of
  1868.   the
  1869.  
  1870.   34.31.  Why do statements require an extra character at the end? Why
  1871.   does 'createuser' return 'unexpected last match in input()'? Why does
  1872.   pg_dump fail?
  1873.  
  1874.   You have compile postgres with flex version 2.5.3. There is bug in
  1875.   this version of flex. Use flex version 2.5.2 or flex 2.5.4 instead.
  1876.   There is a doc/README.flex file which will properly patch the flex
  1877.   2.5.3 source code.
  1878.  
  1879.   34.32.  All my servers crash under concurrent table access. Why?
  1880.  
  1881.   This problem can be caused by a kernel that is not configured to
  1882.   support semaphores.
  1883.  
  1884.   34.33.  What tools are available for hooking postgres to Web pages?
  1885.  
  1886.   For web integration, PHP/FI is an excellent interface. The URL for
  1887.   that is <http://www.vex.net/php/>
  1888.  
  1889.   PHP is great for simple stuff, but for more complex stuff, some still
  1890.   use the perl interface and CGI.pm.
  1891.  
  1892.   An example of using WWW with C to talk to Postgres is can be tried at:
  1893.  
  1894.   *  <http://www.postgreSQL.org/~mlc>
  1895.  
  1896.   An WWW gatway based on WDB using perl can be downloaded from:
  1897.  
  1898.   *  <http://www.eol.ists.ca/~dunlop/wdb -p95>
  1899.  
  1900.   34.34.  What is the time-warp feature and how does it relate to vac¡
  1901.   uum?
  1902.  
  1903.   PostgreSQL handles data changes differently than most database
  1904.   systems.  When a row is changed in a table, the original row is marked
  1905.   with the time it was changed, and a new row is created with the
  1906.   current data. By default, only current rows are used in a table. If
  1907.   you specify a date/time after the table name in a FROM clause, you can
  1908.   access the data that was current at that time, i.e.
  1909.  
  1910.   SELECT * FROM employees 'July 24, 1996 09:00:00'
  1911.  
  1912.   displays employee rows in the table at the specified time. You can
  1913.   specify intervals like date,date, date,, ,date, or ,. This last option
  1914.   accesses all rows that ever existed.
  1915.  
  1916.   INSERTed rows get a timestamp too, so rows that were not in the table
  1917.   at the desired time will not appear.
  1918.  
  1919.   Vacuum removes rows that are no longer current. This time-warp feature
  1920.   is used by the engine for rollback and crash recovery. Expiration
  1921.   times can be set with purge.
  1922.  
  1923.   In 6.0, once a table is vacuumed, the creation time of a row may be
  1924.   incorrect, causing time-traval to fail.
  1925.  
  1926.   The time-travel feature will be removed in 7.0.
  1927.  
  1928.   34.35.  How do I tune the database engine for better performance?
  1929.  
  1930.   There are two things that can be done. You can use Openlink's option
  1931.   to disable fsync() by starting the postmaster with a '-o -F' option.
  1932.   This will prevent fsync()'s from flushing to disk after every
  1933.   transaction.
  1934.  
  1935.   You can also use the postmaster -B option to increase the number of
  1936.   shared memory buffers shared among the backend processes. If you make
  1937.   this parameter too high, the process will not start or crash
  1938.   unexpectedly. Each buffer is 8K and the defualt is 64 buffers.
  1939.  
  1940.   34.36.  What debugging features are available in PostgreSQL?
  1941.  
  1942.   PostgreSQL has several features that report status information that
  1943.   can be valuable for debugging purposes.
  1944.  
  1945.   First, by compiling with DEBUG defined, many assert()'s monitor the
  1946.   progress of the backend and halt the program when something unexpected
  1947.   occurs.
  1948.  
  1949.   Both postmaster and postgres have several debug options available.
  1950.   First, whenever you start the postmaster, make sure you send the
  1951.   standard output and error to a log file, like:
  1952.  
  1953.                cd /usr/local/pgsql
  1954.                ./bin/postmaster >server.log 2>&1 &
  1955.  
  1956.   This will put a server.log file in the top-level PostgreSQL directory.
  1957.   This file can contain useful information about problems or errors
  1958.   encountered by the server. Postmaster has a -d option that allows even
  1959.   more detailed information to be reported. The -d option takes a number
  1960.   1-3 that specifies the debug level. The query plans in a verbose debug
  1961.   file can be formatted using the 'indent' program. (You may need to
  1962.   remove the '====' lines in 1.*  releases.) Be warned that a debug
  1963.   level greater than one generates large log files in 1.* releases.
  1964.  
  1965.   You can actuall run the postgres backend from the command line, and
  1966.   type your SQL statement directly. This is recommended ONLY for
  1967.   debugging purposes. Note that a newline terminates the query, not a
  1968.   semicolon. If you have compiled with debugging symbols, you can
  1969.   perhaps use a debugger to see what is happening. Because the backend
  1970.   was not started from the postmaster, it is not running in an identical
  1971.   environment and locking/backend interaction problems may not be
  1972.   duplicated. Some operating system can attach to a running backend
  1973.   directly to diagnose problems.
  1974.  
  1975.   The postgres program has a -s, -A, -t options that can be very usefull
  1976.   for debugging and performance measurements.
  1977.  
  1978.   The EXPLAIN command (see this FAQ) allows you to see how PostgreSQL is
  1979.   iterpreting your query.
  1980.  
  1981.   34.37.  What is an oid? What is a tid?
  1982.  
  1983.   Oids are Postgres's answer to unique row ids or serial columns. Every
  1984.   row that is created in Postgres gets a unique oid. All oids generated
  1985.   by initdb are less than 16384 (from backend/access/transam.h). All
  1986.   post-initdb (user-created) oids are equal or greater that this. All
  1987.   these oids are unique not only within a table, or database, but unique
  1988.   within the entire postgres installation.
  1989.  
  1990.   Postgres uses oids in its internal system tables to link rows in
  1991.   separate tables. These oids can be used to identify specific user rows
  1992.   and used in joins. It is recommended you use column type oid to store
  1993.   oid values. See the sql(l) manual page to see the other internal
  1994.   columns.
  1995.  
  1996.   Tids are used to indentify specific physical rows with block and
  1997.   offset values. Tids change after rows are modified or reloaded. They
  1998.   are used by index entries to point to physical rows. They can not be
  1999.   accessed through sql.
  2000.  
  2001.   34.38.  What is the meaning of some of the terms used in Postgres?
  2002.  
  2003.   Some of the source code and older documentation use terms that have
  2004.   more common usage. Here are some:
  2005.  
  2006.   * row, record, tuple * attribute, field, column * table, class *
  2007.   retrieve, select * replace, update * append, insert * oid, serial
  2008.   value * portal, cursor * range variable, table name, table alias
  2009.  
  2010.   Please let me know if you think of any more.
  2011.  
  2012.   34.39.  What is Genetic Query Optimization?
  2013.  
  2014.   The GEQO module in PostgreSQL is intended to solve the query
  2015.   optimization problem of joining many tables by means of a Genetic
  2016.   Algorithm (GA). It allows the handling of large join queries through
  2017.   non-exhaustive search.
  2018.  
  2019.   For further information see README.GEQO utesch@aut.tu-freiberg.de.
  2020.  
  2021.   34.40.  I am running Solaris and my dates display wrong. Why?
  2022.  
  2023.   There was a bug in 6.0 that caused this problem under Solaris with -O2
  2024.   optimization. Upgrade to 6.1.
  2025.   34.41.  How do I enable more than 32 concurrent backends?
  2026.  
  2027.   Edit include/storage/sinvaladt.h, and change the value of
  2028.   MaxBackendId. In the future, we plan to make this a configurable
  2029.   prameter.
  2030.  
  2031.   ---------------------------------------------------------------------------
  2032.  
  2033.   35.  FAQ - Extending PostgreSQL
  2034.  
  2035.   35.1.  core.  I wrote a user-defined function and when I run it in
  2036.   psql, it dumps
  2037.  
  2038.   The problem could be a number of things. Try testing your user-defined
  2039.   function in a stand alone test program first. Also, make sure you are
  2040.   not sending elog NOTICES when the front-end is expecting data, such as
  2041.   during a type_in() or type_out() functions
  2042.  
  2043.   35.2.  I get messages of the type NOTICE-PortalHeapMemoryFree-
  2044.   0x402251d0 not in alloc set!
  2045.  
  2046.   You are pfree'ing something that was not palloc'ed. When writing user-
  2047.   defined functions, do not include the file "libpq-fe.h". Doing so will
  2048.   cause your palloc to be a malloc instead of a free. Then, when the
  2049.   backend pfrees the storage, you get the notice message.
  2050.  
  2051.   35.3.  I've written some nifty new types and functions for PostgreSQL.
  2052.  
  2053.   Please share them with other PostgreSQL users. Send your extensions to
  2054.   mailing list, and they will eventually end up in the contrib/
  2055.   subdirectory.
  2056.  
  2057.   35.4.  How do I write a C function to return a tuple?
  2058.  
  2059.   This requires extreme wizardry, so extreme that the authors have not
  2060.   ever tried it, though in principle it can be done. The short answer is
  2061.   ... you can't. This capability is forthcoming in the future.
  2062.  
  2063.   ---------------------------------------------------------------------------
  2064.  
  2065.   36.  FAQ - Bugs
  2066.  
  2067.   36.1.  How do I make a bug report?
  2068.  
  2069.   Check the current FAQ at  <http://www.postgreSQL.org>
  2070.  
  2071.   Also check out our ftp site  <ftp://ftp.postgreSQL.org/pub> to see if
  2072.   there is a more recent PostgreSQL version.
  2073.  
  2074.   You can also fill out the "bug-template" file and send it to:
  2075.  
  2076.   * bugs@postgreSQL.org
  2077.  
  2078.   This is the address of the developers mailing list.
  2079.  
  2080.   37.  FAQ Linux-PostgreSQL - Compiling PostgreSQL
  2081.  
  2082.   =====================================================
  2083.  
  2084.   Frequently Asked Questions (FAQ) for PostgresSQL V6.0 Linux Specific
  2085.   TO BE READ IN CONJUNCTION WITH THE NORMAL FAQ
  2086.  
  2087.   =====================================================
  2088.  
  2089.   last updated:           Wed Jan 29 20:16:00 GMT 1997
  2090.  
  2091.   current maintainer:     Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
  2092.  
  2093.   original author:        Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
  2094.  
  2095.   37.1.  What changes do I need to make to src/Makefile.global or
  2096.   src/Makefile.custom?
  2097.  
  2098.   These changes are most easily made by running the customize shell
  2099.   script in the src directory which will write a Makefile.custom for
  2100.   you.
  2101.  
  2102.   If you do it by hand, you *must* set the following variable: PORTNAME=
  2103.   linux
  2104.  
  2105.   You will also need to change the following to match your own
  2106.   installation: POSTGRESDIR
  2107.  
  2108.   If you switch on the USE_TCL option, you will need to set these:
  2109.   TCL_INCDIR= TCL_LIBDIR= TCL_LIB= TK_INCDIR= TK_LIBDIR= TK_LIB=
  2110.   X11_INCDIR= X11_LIBDIR= X11_LIB=
  2111.  
  2112.   On my Slackware3.0 system, these are: TCL_INCDIR=     /usr/include/tcl
  2113.   TCL_LIBDIR=     /usr/lib TCL_LIB=        -ltcl TK_INCDIR=
  2114.   /usr/include/tcl TK_LIBDIR=      /usr/lib TK_LIB=         -ltk
  2115.   X11_INCDIR=     /usr/include/X11 X11_LIBDIR=     /usr/X386/lib
  2116.   X11_LIB=        -lX11
  2117.  
  2118.   You may also make any other changes you need as documented in the
  2119.   INSTALL file and in Makefile.global
  2120.  
  2121.   37.2.  Why do I get problems with missing libreadline?
  2122.  
  2123.   Linux systems generally don't come with the GNU readline library
  2124.   installed. Either ensure you do not activate the readline options in
  2125.   src/Makefile.global or src/Makefile.custom or install the GNU readline
  2126.   library.
  2127.  
  2128.   Note that Debian Linux (like FreeBSD) does come with readline
  2129.   installed.
  2130.  
  2131.   37.3.  REDHAT Why do I get problems with missing libdl and dlfcn.h?
  2132.  
  2133.   The libdl library is used for dynamic linking of user-supplied
  2134.   functions at run-time. For some reason this library was missed out
  2135.   from the Redhat distribution. It seems that the latest Redhat 4.0
  2136.   (Colgate) fixes this.
  2137.  
  2138.   RedHat now have a new ld.so RPM package on their FTP site.  Simply
  2139.   grab:
  2140.  
  2141.   <ftp://ftp.redhat.com/pub/redhat/devel/i386/RedHat/RPMS/ld.so-1.7.14-4.i386.rpm>
  2142.  
  2143.   Install the RPM file in the usual way and off you go!
  2144.  
  2145.   There has been one report of a corrupted system resulting from
  2146.   programs accessing these libraries while updating them (not altogether
  2147.   surprising). Consequently it is a good idea to reboot the system
  2148.   before installing the new libraries and to have as little running as
  2149.   possible during this upgrade. Going into single-user mode is probably
  2150.   a good idea!
  2151.  
  2152.   If you want to do it the hard way, you can obtain the library and the
  2153.   header file from:
  2154.  
  2155.   <ftp://tsx-11.mit.edu/pub/linux/packages/GCC/ld.so-1.7.14.tar.gz>
  2156.  
  2157.   Alternatively, you may find precompiled binaries in
  2158.   distributions/debian/buzz/binary-i386/base/ld.so-1.7.14-4.deb on the
  2159.   same site, or follow the instructions given for question 1.2 for
  2160.   correcting the same error with early releases of Slackware 3.1.  Don't
  2161.   use this method unless you know what you are doing!
  2162.  
  2163.   37.4.  SLACKWARE 3.1 Why do I get problems with missing libdl and
  2164.   dlfcn.h?
  2165.  
  2166.   See the answer to question 1.3. Slackware up to version 3.0 was
  2167.   supplied with this library and include file and they seem to be back
  2168.   in again in the latest versions of 3.1, but the early 3.1 releases
  2169.   (before 9th September 1996) had them missing and many CD-ROM versions
  2170.   will have been pressed from the first 3.1 releases.
  2171.  
  2172.   There has been one report of a corrupted system resulting from
  2173.   programs accessing these libraries while updating them (not altogether
  2174.   surprising). Consequently it is a good idea to reboot the system
  2175.   before installing the new libraries and to have as little running as
  2176.   possible during this upgrade. Going into single-user mode is probably
  2177.   a good idea!
  2178.  
  2179.   The easiest fix is to obtain the file ldso.tgz from the a4 disk of a
  2180.   more recent Slackware 3.1 distribution and unpack this file from the
  2181.   root (/) directory, then do
  2182.  
  2183.   sh install/doinst.sh
  2184.  
  2185.   to complete the installation. Follow this with
  2186.  
  2187.   ldconfig
  2188.  
  2189.   If you want to install manually, you must first install the file
  2190.   dlfcn.h in /usr/include.
  2191.  
  2192.   Second, install the file libdl.so.1.7.14 (or whatever the latest
  2193.   release is) in /lib, then do:
  2194.  
  2195.   cd /lib ln -sf libdl.so.1.7.14 libdl.so.1 ln -sf libdl.so.1 libdl.so
  2196.  
  2197.   On some systems (depending on your GCC configuration) it may be
  2198.   necessary to do:
  2199.  
  2200.   cd /usr/lib ln -sf /lib/libdl.so .
  2201.  
  2202.   Finally
  2203.  
  2204.   ldconfig
  2205.  
  2206.   37.5.  My compile of the backend dies complaining about the include
  2207.   file         dlfcn.h missing
  2208.  
  2209.   See the answer to question 1.3/1.4. Don't forget that if you are using
  2210.   an a.out system you must first have installed the dld package (which
  2211.   is not supplied with most a.out systems) to have dlfcn.h at all. See
  2212.   Question 1.11.
  2213.  
  2214.   37.6.  GCC complains about an ignored option -fpic
  2215.  
  2216.   Earlier versions of GCC accepted either -fpic or -fPIC.  It appears
  2217.   that more recent versions (V2.7.2?) require -fPIC.  If you are using
  2218.   an ELF version of Linux, this can safely be ignored as -fPIC is the
  2219.   default.
  2220.  
  2221.   You can correct this by editing src/Makefile.global and changing
  2222.   CFLAGS_SL
  2223.  
  2224.   37.7.  I get warnings of the form         warning- cast from pointer
  2225.   to integer of different size
  2226.  
  2227.   These were seen in earlier versions of Postgres95 and could safely be
  2228.   ignored. PostgreSQL V6.0 should compile with no warnings except those
  2229.   related to system header files (which can also be safely ignored).
  2230.  
  2231.   37.8.  SuSE-Linux 4.2 Where is curses and termcap?
  2232.  
  2233.   SuSE-Linux has ncurses but not curses. Set the value of CURSES_LIB in
  2234.   src/Makefile.custom to -lncurses (or do this through the customize
  2235.   script).
  2236.  
  2237.   SuSE-Linux has the termcap library is in /usr/lib/termcap instead of
  2238.   in /usr/lib. If you have a problem, you need to add the following line
  2239.   to src/Makefile.custom:
  2240.  
  2241.   LDADD_BE+= -L/usr/lib/termcap
  2242.  
  2243.   You may need to edit src/bin/psql/Makefile and comment out the change:
  2244.   ifeq ($(PORTNAME), linux) LD_ADD+= -ltermcap to: ifeq ($(PORTNAME),
  2245.   linux) LD_ADD+=
  2246.  
  2247.   37.9.  Why do I get problems with ld.so?
  2248.  
  2249.   If you get problems with ld.so, another library required under ELF for
  2250.   dynamic loading, then you have messed up your installation or (more
  2251.   likely) upgrade of Linux.
  2252.  
  2253.   See the answers to Question 1.3/1.4. You may need to install
  2254.   ld.so.x.y.z in /lib and run ldconfig.
  2255.  
  2256.   The most recent stable release of the ld package is 1.7.14 At the time
  2257.   of writing, 1.8.x versions of ld are experimental.
  2258.  
  2259.   37.10.  Why do I get `yy_flush_buffer undefined' errors?
  2260.  
  2261.   This isn't really Linux specific, but is common on older Linux
  2262.   installations. You must have a recent version of flex (2.5.2 or later)
  2263.   to compile PostgreSQL. Note that flex 2.5.3 has a bug: see Question
  2264.   3.4.
  2265.  
  2266.   37.11.  How do I compile PostgreSQL on an a.out system?
  2267.  
  2268.   First, you must install the dld library. This may be obtained from
  2269.   Sunsite as: Linux/libs/dld.3.2.7.tar.gz
  2270.  
  2271.   Second, add the following line to src/Makefile.custom: LINUX_ELF= (or
  2272.   use the customize script)
  2273.  
  2274.   37.12.  yacc -d /disk2/PostgreSQL/src/backend/parser/gram.y make-
  2275.   /usr/bin/make- cannot execute binary file Why does make fail with -
  2276.  
  2277.   This was a problem in earlier versions of Postgres95. The default for
  2278.   PostgreSQL is to use bison -y rather than yacc.
  2279.  
  2280.   yacc is generally implemented as a script which invokes bison -y For
  2281.   some reason (certain versions of make? certain versions of bash?) make
  2282.   is unable to execute this script file.
  2283.  
  2284.   To correct this, simply edit src/mk/port/postgres.mk.linux and, at the
  2285.   end of the file, change: # YACC = bison -y to YACC = bison -y
  2286.  
  2287.   37.13.  What are the references in X11_LIB to libsocket and libnsl in
  2288.   src/Makefile.global?
  2289.  
  2290.   This was a problem in 1.08 (they are Sun Solaris specific).  It is
  2291.   fixed in 1.09 and 6.0
  2292.  
  2293.   37.14.  DEBIAN Where is libtermcap?
  2294.  
  2295.   Debian Linux comes without the termcap library and uses ncurses (which
  2296.   uses terminfo instead). There is no need to change the CURSES_LIB
  2297.   variable in src/bin/psql/Makefile since Debian provides a link from
  2298.   libncurses to libcurses (unlike SuSE-Linux --- see Question 1.8).
  2299.  
  2300.   You may need to edit src/bin/psql/Makefile and comment out the change:
  2301.   ifeq ($(PORTNAME), linux) LD_ADD+= -ltermcap to: ifeq ($(PORTNAME),
  2302.   linux) LD_ADD+=
  2303.  
  2304.   38.  FAQ Linux-PostgreSQL - Compiling accessory programs
  2305.  
  2306.   38.1.  The linker fails to find libX11 when compiling pgtclsh
  2307.  
  2308.   Add the following to src/Makefile.custom X11_LIBDIR = /usr/X11R6/lib
  2309.  
  2310.   39.  FAQ Linux-PostgreSQL -  Runtime Problems
  2311.  
  2312.   39.1.  I get an error reporting _fUnKy_POSTPORT_sTuFf_ undefined when
  2313.   running scripts like createuser
  2314.  
  2315.   This is a bug in V1.06-V1.07 of Postgres and is fixed in V1.08 and
  2316.   above.
  2317.  
  2318.   39.2.  I run postmaster and after that system says 'Bad system
  2319.   call(Core         dumped)'
  2320.  
  2321.   This indicates that you have not compiled shared memory support into
  2322.   your kernel. You need to recompile the Linux kernel to add this
  2323.   feature.
  2324.  
  2325.   39.3.  Failed Assertion("!(file != 0)  - (null)", File When I try to
  2326.   start the Postmaster, why do I get an error of the form
  2327.  
  2328.   Failed Assertion("!(file != 0):(null)", File:
  2329.   "/usr/local/PostgreSQL/src/backend/storage/file/fd.c", Line: 257)
  2330.   !(file != 0) (0) initdb: could not create template database initdb:
  2331.   cleaning up.
  2332.  
  2333.   Your permissions on the file /dev/null are wrong.
  2334.  
  2335.   ls -l /dev/null should give you something like:
  2336.  
  2337.   crw-rw-rw-  1 root  wheel    2,   2 Oct  8 18:41 /dev/null
  2338.  
  2339.   Correct the permissions using:
  2340.  
  2341.   chmod a+rw /dev/null
  2342.  
  2343.   39.4.  Why doesn't createuser work?
  2344.  
  2345.   There is a problem with Version 2.5.3 of GNU flex and createuser.
  2346.   Your options are to downgrade flex to V2.5.2, apply a patch to V2.5.3
  2347.   (supplied in doc/README.flex) or wait for V2.5.4 which will fix the
  2348.   bug.
  2349.  
  2350.   39.5.  IpcMemoryCreate- memKey=155356396 , size=760632 , Why do I get
  2351.   an error like-
  2352.  
  2353.   permission=384IpcMemoryCreate: shmget(..., create, ...)  failed:
  2354.   Invalid argument
  2355.  
  2356.   You haven't build IPC support into your Linux kernel. You will have to
  2357.   rebuild the kernel and switch on this option.
  2358.  
  2359.   39.6.  psql- can't load library 'libpq.so.1' Why does psql fail with-
  2360.  
  2361.   Psql has been compiled to link dynamically with the libpq library.
  2362.  
  2363.   To solve this, you should log in as root and edit the file
  2364.   /etc/ld.so.conf Add a single line at the end which gives the name of
  2365.   the PostgreSQL library directory (the lib subdirectory of your
  2366.   PostgreSQL installation) and run /sbin/ldconfig
  2367.  
  2368.   40.  FAQ IRIX-PostgreSQL - Compiling PostgreSQL
  2369.  
  2370.   ===================================================== Frequently Asked
  2371.   Questions (FAQ) for PostgresSQL V6.1 IRIX Specific TO BE READ IN
  2372.   CONJUNCTION WITH THE NORMAL FAQ
  2373.   ===================================================== last updated:
  2374.   Fri Jun 13 09:54:00 BST 1997
  2375.  
  2376.   current maintainer:     Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
  2377.   original author:        Andrew C.R. Martin (martin@biochem.ucl.ac.uk)
  2378.  
  2379.   Changes in this version (* = modified, + = new, - = removed): +1.5)
  2380.   Can I install PostgreSQL under Irix 6.4?
  2381.  
  2382.   This file is divided approximately as follows:
  2383.  
  2384.   ╖  1.*)    Installing Postgres95
  2385.  
  2386.   ╖  2.*)    Uninstalling Postgres95
  2387.  
  2388.   ╖  3.*)    Extending Postgres95
  2389.  
  2390.   41.  FAQ-IRIX Installing Postgres95
  2391.  
  2392.   41.1.  What extra items do I need to install Postgres95 under Irix?
  2393.  
  2394.   You *must* have the following installed:
  2395.  
  2396.   ╖  a) Gnu make (installed as gmake)
  2397.  
  2398.   You are recommended to install the following:
  2399.  
  2400.   ╖  a) GNU install (installed as ginstall)
  2401.  
  2402.   You may choose to install the following:
  2403.  
  2404.   ╖  a) GNU readline library (if you wish psql to have readline
  2405.      support).
  2406.  
  2407.   ╖  b) tcl/tk (if you wish to compile pgtclsh)
  2408.  
  2409.   41.2.  src/Makefile.custom?  What changes do I need to make to
  2410.   src/Makefile.global or
  2411.  
  2412.   The easiest way to do this is to use the customize script in the src
  2413.   directory.
  2414.  
  2415.   You *must* set the following variables: PORTNAME=       irix5
  2416.  
  2417.   You will also need to change the following to match your own
  2418.   installation: POSTGRESDIR
  2419.  
  2420.   If you switch on the USE_TCL option, you will need to set these:
  2421.   TCL_INCDIR= TCL_LIBDIR= TCL_LIB = TK_INCDIR= TK_LIBDIR= TK_LIB =
  2422.  
  2423.   You may also make any other changes you need as documented in the
  2424.   INSTALL file and in Makefile.global
  2425.  
  2426.   41.3.  src/Makefile.global?  What are the references in X11_LIB to
  2427.   libsocket and libnsl in
  2428.  
  2429.   This was a problem in 1.08 (they are Sun Solaris specific).  It is
  2430.   fixed in 1.09 and above.
  2431.  
  2432.   41.4.  Are there any other changes I should make?
  2433.  
  2434.   If you have installed the GNU install program (ginstall), you should
  2435.   add the following line to src/Makefile.custom: CUSTOM_INSTALL=ginstall
  2436.  
  2437.   For an explanation as to why this is a good idea, see Question 2.1
  2438.  
  2439.   41.5.  Can I install PostgreSQL under Irix 6.4?
  2440.  
  2441.   Irix 6.4 has a bug in ld which mishandles the addresses of static
  2442.   procedures when object files are assembled into larger object files
  2443.   using 'ld -r'. This bug has been reported to Silicon Graphics. The
  2444.   following patch should be applied as a workaround. (Supplied by Bob
  2445.   Bruccoleri bruc@bms.com)
  2446.  
  2447.   *** ./backend/Makefile.orig     Thu May 22 00:00:15 1997 ---
  2448.   ./backend/Makefile  Thu Jun  5 16:47:27 1997 *************** *** 54,60
  2449.   **** all: postgres  $ (POSTGRES_IMP) global1.bki.source
  2450.   local1_template1.bki.source
  2451.  
  2452.   postgres:  $ (OBJS) ../utils/version.o !        $ (CC) -o postgres  $
  2453.   (OBJS) ../utils/version.o  $ (LDFLAGS)
  2454.  
  2455.   $ (OBJS):  $ (DIRS:%=%.dir)
  2456.  
  2457.   --- 54,64 ---- all: postgres  $ (POSTGRES_IMP) global1.bki.source
  2458.   local1_template1.bki.source
  2459.  
  2460.   postgres:  $ (OBJS) ../utils/version.o
  2461.  
  2462.   ! #      $ (CC) -o postgres  $ (OBJS) ../utils/version.o  $ (LDFLAGS)
  2463.   !       -rm -f *.o
  2464.   !       find . -name "*.o" -exec cp (flower-brackets) . \;
  2465.  
  2466.   !       rm -f SUBSYS.o !        $ (CC) -o postgres *.o
  2467.   ../utils/version.o  $ (LDFLAGS)
  2468.  
  2469.   $ (OBJS):  $ (DIRS:%=%.dir)
  2470.  
  2471.   42.  FAQ-IRIX Deinstalling Postgres95
  2472.  
  2473.   42.1.  Why can't I move the executable files?
  2474.  
  2475.   By default, the IRIX port uses the BSD compatible version of install
  2476.   from /usr/bin/X11. If you read the man page for this version of
  2477.   install, you will see that it is not meant for end-user use; it has
  2478.   the interesting side-effect of chowning files it installs to root.
  2479.  
  2480.   You should still be able to delete the files as you (the postgres
  2481.   user) will own the directory in which they are stored.
  2482.  
  2483.   The normal IRIX install program cannot be used easily as it takes its
  2484.   arguments in the reverse order. It is therefore recommended to use the
  2485.   GNU version of install (ginstall).  See Question 1.4
  2486.  
  2487.   43.  FAQ-IRIX Extending Postgres95
  2488.  
  2489.   43.1.  Postgres95 How do I compile a C program to create a function
  2490.   for extending
  2491.  
  2492.   Here is a sample command line:
  2493.  
  2494.   cc -I/usr/local/postgres95/include/
  2495.   -I/usr/local/postgres95/src/backend -shared -o funcs.so funcs.c
  2496.  
  2497.   44.  FAQ-IRIX PostgreSQL AUTHOR contacts
  2498.  
  2499.   Dr. Andrew C.R. Martin                             University College
  2500.   London
  2501.  
  2502.   EMAIL: (Work) martin@biochem.ucl.ac.uk
  2503.  
  2504.   (Home) andrew@stagleys.demon.co.uk
  2505.  
  2506.   URL:    <http://www.biochem.ucl.ac.uk/~martin>
  2507.  
  2508.   Tel:   (Work) +44(0)171 419 3890
  2509.  
  2510.   Tel:    (Home) +44(0)1372 275775
  2511.  
  2512.   45.  Copyright Notice
  2513.  
  2514.   Copyright (c) 1997 Al Dev (Alavoor Vasudevan). All rights reserved.
  2515.  
  2516.   Permission to use, copy, modify and distribute this document, without
  2517.   fee, and without a written agreement is hereby granted, provided that
  2518.   the above copyright notice and this paragraph and the following two
  2519.   paragraphs appear in all copies.
  2520.  
  2521.   Brands, companies and product names mentioned in this document are
  2522.   trademarks or registered trademarks of their respective holders.
  2523.   Please refer to individual copyright notices of brands, companies and
  2524.   products mentioned in this document.
  2525.  
  2526.   Document is "as is" and absolutely no implied warranties or guarantees
  2527.   by the author.
  2528.  
  2529.