\documentclass[letterpaper,english]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{ Linux µÄ Database-SQL-RDBMS HOWTO ÎÄ¼þ (PostgreSQL Îï¼þ¹ØÁª×ÊÁÏ¿âÏµÍ³)}
\author{×÷Õß¡ÃAl Dev (Alavoor Vasudevan)        \onlynameurl{alavoor@yahoo.com} \\ 
ÒëÕß¡ÃÔø´ï¿µ \onlynameurl{a9504480@graduate.hku.hk}}
\date{¶þÁãÁãÒ»ÄêÒ»ÔÂ¶þÈÕ£¬41.0 °æ}
\abstract{±¾ÎÄ¼þÊÇÒ»·Ý½éÉÜÈçºÎÔÚ Unix ÏµÍ³¿ì½ÝµØ½¨Á¢Ò»¸ö SQL ×ÊÁÏ¿âÒýÇæ (Database Engine)
¼°Ç°¶Ë¹¤¾ßµÄ¡¸ÊµÓÃÖ¸ÄÏ¡¹¡£ËüÒ²ÌÖÂÛ¹ú¼Ê±ê×¼µÄ ANSI/ISO SQL ÓïÑÔ¼°Ì½ÌÖÔÚ»¥ÁªÍøÖÐ¡¸¿ª·ÅÊ½¿ª·¢¡¹»·¾³ ("open development" environment) ¿ª·¢ SQL ×ÊÁÏ¿âÒýÇæµÄÓÅµã¡£ËüÊÇ¹Øì¶ÈçºÎÔÚ Unix ÏµÍ³ÖÐ½¨Á¢ PostgreSQL Õâ¸ö¼È¿ÉÓÃ×÷Ó¦ÓÃ³ÌÊ½×ÊÁÏ¿âËÅ·þÆ÷ (Application Database Server)£¬ÓÖ¿ÉÓÃ×÷ÍòÎ¬Íø×ÊÁÏ¿âËÅ·þÆ÷ (Web Database Server) µÄÐÂÒ»´úÎï¼þ¹ØÁªÊ½×ÊÁÏ¿â¡£PostgreSQL ³¢ÊÔÊµ¼ù½ñááµÄ¹ú¼Ê ISO / ANSI SQL ±ê×¼¡£±¾ÎÄ¼þÒ²Ìá¹©¹Øì¶×ÊÁÏ¿âµÄ½éÃæ³ÌÊ½£¬ÈçÇ°¶ËÍ¼Ïñ½éÃæ¡¢Ó¦ÓÃ³ÌÊ½¸ßËÙ¿ª·¢ (Rapid Application Development) ¹¤¾ß¡¢ODBC¡¢JDBC Çý¶¯³ÌÊ½¡¢C¡¢C++¡¢Java¡¢Perl ³ÌÊ½ÓïÑÔ½éÃæºÍÍøÉÏ×ÊÁÏ¿â¹¤¾ß¡£ÕâÀïÌá¹©µÄ×ÊÁÏÊÊÓÃì¶ËùÓÐ Unix / Windows NT Æ½Ì¨¼°ÆäËû×ÊÁÏ¿â£¬¶Ô×ÊÁÏ¿â¡¢SQL ÓïÑÔ¼° PostgreSQL µÄÐÂÊÖ·Ç³£ÓÐÓÃ¡£ÕâÎÄ¼þÒ²ÓÐÒ»¸ö SQL µÄµ¼Òý£¬½âÊÍ SQL µÄÓï·¨£¬¶Ô³õÑ§Õß·Ç³£ÓÐÓÃ¡£ÓÐ¾­ÑéµÄÓÃ¼Ò»á¾õµÃÕâÊÇÒ»·ÝÓÐÓÃµÄ²Î¿¼×ÊÁÏ¡£¶ÔÑ§ÉúÀ´Ëµ£¬Õâ´¦Ìá¹©µÄ×ÊÁÏ»áÈÃËûÃÇµÃµ½ PostgresSQL ¹ØÁªÊ½×ÊÁÏ¿âµÄÔ´³ÌÊ½Âë£¬´Ó¶øÑ§Ï°ÈçºÎ±àÐ´Ò»¸öÎï¼þ¹ØÁªÊ½ SQL ×ÊÁÏ¿â¡£}


\begin{document}
\maketitle
\tableofcontents

\section{ÒýÑÔ}

±¾ÎÄ¼þµÄÖ÷ÒªÄ¿±êÊÇÌá¹©Ò»¸ö¹Øì¶¿ì½ÝµØÉè¶¨ PostgreSQL µÄ URL 
µÄÏê¾¡Ãûµ¥£¬ºÍÌá³«¿ª·ÅÔ­Ê¼ÂëÏµÍ³£¬Èç PostgreSQL¡¢Linux µÄºÃ´¦¡£

ÊÀ½çÉÏµÄÃ¿Ò»²¿µçÄÔ¶¼ÐèÒªÒ»¸ö×ÊÁÏ¿âÀ´´æÈ¡×ÊÁÏ¡£ÄãÊ¹ÓÃµçÄÔÖ÷ÒªÀíÓÉÊÇÓÃÀ´´¢´æ¡¢
¶ÁÈ¡ºÍ´¦Àí×ÊÁÏ£¬¶øÇÒËüÃÇÒªºÜ¿ìÍê³É¹¤×÷£¬´Ó¶ø½ÚÊ¡ÄãµÄÊ±¼ä¡£Í¬Ê±£¬ÏµÍ³±ØÐë¼òµ¥¡¢
ÍêÕû¡¢¿ìËÙ¡¢¿É¿¿¡¢¾­¼ÃºÍÒ×ÓÃ¡£×ÊÁÏ¿âÊÇ×î{\bfseries ÖØÒªµÄÏµÍ³}£¬
ÒòÎªËü´¢´æÁËÊÀ½çÉÏÃ¿Ò»¼ä¹«Ë¾µÄ¹Ø¼ü×ÊÁÏ¡£ÊÀÉÏµÄÃ¿Ò»Ïî¹¤Òµ¶¼ÐèÒªÒ»¸ö×ÊÁÏ¿âÏµÍ³¡£
Ã»ÓÐµÄ»°£¬µçÑ¶¡¢Æû³µ¡¢ÒøÐÐ¡¢º½¿Õ¹«Ë¾µÈ¹¤Òµ¶¼²»ÄÜÓÐÐ§ÔË×÷¡£
×îÁ÷ÐÐµÄ×ÊÁÏ¿âÏµÍ³¶¼¸ú´Ó¹ú¼Ê±ê×¼×éÖ¯ (International Standard Organisation, 
ISO) µÄ¹æ¸ñºÍ ANSI SQL£¨ÃÀ¹ú£©±ê×¼¡£Òµ½ç³£ÓÃµÄ×îÐÂ¹æ¸ñÊÇ ISO/ANSI SQL 
1992¡£ÏÂÒ»¸ö±ê×¼ÊÇ SQL 1998/99£¬ÓÖÃû SQL-3£¬ÕâÈÔÔÚ¿ª·¢ÖÐ¡£Á÷ÐÐµÄ×ÊÁÏ¿â£¬Èç 
Oracle£¬Sybase ºÍ Informix ¶¼ÊÇ¸ù¾ÝÕâÐ©±ê×¼£¬»ò³¢ÊÔÊµÊ©ÕâÐ©±ê×¼¡£

Ã»ÓÐÈç ANSI/ISO SQL 
µÄ±ê×¼£¬ÓÃ»§ÒªÒ»´Î½¨Á¢Ò»Ì×ÊÊÓÃì¶ËùÓÐ×ÊÁÏ¿âÏµÍ³µÄÓ¦ÓÃÈí¼þ»á·Ç³£À§ÄÑ¡£
¿Í»§Ï£ÍûÒ»´Î¹ýÊ¹ÓÃ ISO SQL£¬ODBC£¬JDBC 
·¢Õ¹Ò»¸öÓ¦ÓÃÈí¼þ¶øÔÚÊÀÉÏËùÓÐµÄ×ÊÁÏ¿âÏµÍ³Ó¦ÓÃ¡£

ÊÀÉÏ×ÔÓÉ¶øÖ§Ô® ISO SQL¡¢ANSI SQL/98¡¢SQL/92 ºÍ ANSI SQL/89 µÄ¹ØÁªÊ½×ÊÁÏ¿â 
(RDBMS) ÖÐ£¬×îÁ÷ÐÐµÄÊÇ PostgreSQL¡£PostgreSQL ÊÇÐÂÒ»´úµÄÎï¼þ¹ØÁªÊ½×ÊÁÏ¿â£¬
ÒÔÈ«Ãæ·ûºÏ ISO/ANSI µÈ SQL ±ê×¼ÎªÄ¿±ê¡£Ãâ·ÑµÄ RDBMS ÖÐ£¬PostgreSQL 
ÊÇÎ¨Ò»Í¬Ê±Ö§Ô®Îï¼þ×ÊÁÏ¿âºÍ SQL µÄ¡£±¾ÎÄ¼þ»á¸æËßÄãÈçºÎ°²×°Õâ×ÊÁÏ¿â¡¢
ÈçºÎ½¨Á¢ÍøÉÏ×ÊÁÏ¿â¡¢Ó¦ÓÃÈí¼þ×ÊÁÏ¿â¡¢Ç°¶ËÍ¼Ïñ½éÃæºÍ½éÃæ³ÌÊ½¡£
ÎÒÇ¿ÁÒ½¨ÒéÄãËùÐ´µÄ×ÊÁÏ¿âÈí¼þ±ØÐë°Ù·Ö°Ù·ûºÏ ISO/ANSI SQL¡¢ODBC¡¢JDBC 
µÈ±ê×¼£¬ÕâÑù£¬Ê¹µÃÄãµÄ³ÌÊ½ÄÜÒÆÖ²µ½²»Í¬µÄ×ÊÁÏ¿â£¬Èç PostgreSQL¡¢Oracle¡¢
Sybase¡¢Informix µÈ¡£

Äã¿É´Ó PostgreSQL µÃµ½×î¸ßÖÊËØ¼°·Ç³£·á¸»µÄ¹¦ÄÜ£¬ÒòÎªËüÒÀ´Ó¡¸¿ª·ÅÔ­Ê¼Âë¿ª·¢Ä£Ê½¡¹
(Open Source Code development model)¡£¿ª·ÅÔ­Ê¼ÂëÄ£Ê½»á¸øÄãÍêÕûµÄÔ´³ÌÊ½Âë£¬
¿ª·¢¹ý³ÌÔÚ»¥ÁªÍøÉÏÓÉÓÐ¼«´óÁ¿µÄÈËÊÖ½øÐÐ¡£
Ä¿Ç°µÄÇ÷ÊÆÏÔÊ¾Î´À´´ó²¿·ÖµÄÈí¼þ¿ª·¢¹¤×÷»áÔÚÊÀ½çÍ¨ÐÐµÄËùÎ½¡¸×ÊÑ¶¸ßËÙ¹«Â·¡¹ 
(Information Super-Highway) ÉÏ½øÐÐ¡£Î´À´ÊýÄê£¬»¥ÁªÍø»á±¬Õ¨ÐÔµØ³É³¤£¬
ÕâÑù»á´Ù³ÉÒµ½ç¸ü¶àÊ¹ÓÃ PostgreSQL¡£

½å°ÑÍ³¼ÆÑ§¡¢ÊýÑ§ºÍ¿ÆÑ§µÄÔ­ÀíÓ¦ÓÃì¶Èí¼þÖÊËØ£¬ÎÒÃÇÖ»»áÔÚÒ»¸öÈç PostgreSQL 
°ã£¬°ÑÔ­³ÌÊ½Âë¿ª·Å¸ø¾­×ÊÑ¶¸ßËÙ¹«Â·Á¬ÏµÔÚÒ»ÆðµÄ´óÁ¿Í·ÄÔµÄÏµÍ³ÏÂ£¬
²ÅÄÜµÃµ½×î¸ßÖÊËØµÄÈí¼þ¡£ÕýËùÎ½¼¯Ë¼¹ãÒæ¡£
¿ª·ÅÔ­Ê¼ÂëµÄÄ£Ê½Ò²¿É·ÀÖ¹{\bfseries ÖØ¸²¹¤×÷}£¬·Ç³£¾­¼Ã£¬
½ÚÊ¡·¢²¼Ê±¼ä¼°ºÏ·ûÓÐ¹ØÓÅ»¯¹ú¼ÒºÍµØÇò×ÊÔ´µÄÏÖ´ú¾­¼Ã¶¨ÂÉ¡£Ö»ÒªÓÐÈËÐ´ºÃÁËÒ»¸öÈí¼þ£¬
Äã±ã{\bfseries ²»}ÐèÒªÔÙÀ´Ò»´Î¡£Äã²»»á°Ñ±¦¹óµÄÊ±¼äÀË·Ñì¶{\bfseries ÔçÒÑ×öºÃ}µÄ¹¤×÷¡£
Ò»´ç¹âÒõÒ»´ç½ð£¬ÄãÒªºÃºÃÀûÓÃ£¬ÒòÎªÈËÒ»ÌìÖ»ÓÐ°ËÐ¡Ê±¹¤×÷£¡ÔÚÎÒÃÇÌ¤ÈëØ¥Ò»ÊÀ¼ÍÊ±£¬
ÎÒÃÇÈ¡µÃËùÐèÈí¼þµÄ·½·¨½«»á¸Ä±ä¡£Ã¿ÈËµÄµÚÒ»Ñ¡Ôñ¶¼½«»áÊÇÈç PostgreSQL¡¢Linux 
µÈ¿ª·ÅÔ­Ê¼ÂëÏµÍ³¡£

¹ºÂò¿ÉÖ´ÐÐµÄÈí¼þ²»´ú±íÄãÓµÓÐÈí¼þ¡£Ô­³ÌÊ½ÂëÊÇÕä¹óµÄ×Ê²ú£¬¶þÔªµµ²¢ÎÞ¼ÛÖµ¡£
¹ºÂòÈí¼þ{\itshape ¿ÉÄÜ\/}»á³ÉÎªÀúÊ·¡£ÄãÖ»ÐèÒªÂòºÃµÄÓ²¼þ£¬
»¨Ç®ÔÚÓ²¼þÉÏ¶ø´Ó»¥ÁªÍøÉÏÈ¡µÃÈí¼þÊÇÖµµÃµÄ¡£ÖØµãÊÇ{\bfseries ¹¤×÷Á¿´ó}µÄµçÄÔÓ²¼þ¡£
Ó²¼þ²ÅÊÇÕæÕýÅÜ¶¯µÄÂíÆ¥£¬Èí¼þÖ»ÊÇ±Þ²ßËü¡£µçÄÔÓ²¼þµÄ¸´ÔÓ³Ì¶ÈÊ¹µÃÈ«ÇòÖ»ÓÐ 6 
¸ö¹ú¼Ò±íÏÖ³öÉè¼Æ¼°Éú²úµçÄÔ¾§Æ¬ºÍÓ²¼þµÄÄÜÁ¦¡£ÕâÊÇÒ»ÖÖÏÈ½øµÄ¿Æ¼¼£¬¹ý³Ì·Ç³£¸´ÔÓ£¬
×Ê½ðÃÜ¼¯£¬Éè³§¼°Éú²ú 0.18£¨ÉõÖÁÐ¡ì¶ 0.18£©Î¢Ã×¿Æ¼¼µÄ»úÆ÷Í¶×ÊÅÓ´ó¡£
ÔÚÒ»Ð¡Æ¬¾§Æ¬ÉÏ±ãÓÐÊýÒÔ°ÙÍò¼ÆµÄ°ëµ¼ÌåºÍµçÂ·¼·ÔÚÒ»Æð¡£Applied 
Material¡¢AMD¡¢Ó¢ÌØ¶û¡¢Cyrix¡¢ÈÕÁ¢¡¢IBM ¼°ÆäËû¹¤Ë¾»¨·Ñ´óÁ¿ÈË-Äê (man-years) 
ÔÚ¸ß¿Æ¼¼£¬Èç¾§Æ¬Éè¼Æ¡¢Î¢µç×Ó (Micro-electronics) ¼°ÄÉµç×Ó (Nano-electronics) 
µÄÑÐ¾¿ÉÏ¡£Î¢Ã×´ú±í°ÙÍò·ÖÖ®Ò»Ã× (10\^{}-6)£¬ÄÉÃ×´ú±íÊ®ÒÚ·ÖÖ®Ò»Ã× 
(10\^{}-9)¡£ÏÖ½ñÎ¢µç×Ó¼¼ÊõÖÐ£¬0.35 Î¢Ã×µÄÊ¹ÓÃÂÁ×÷µ¼Ìå£¬0.25 Î¢Ã×µÄÊ¹ÓÃÍ­¡£
ÔÚ²»¾ÃµÄ½«À´£¬ÓÃÍ­µÄ 0.10 Î¢Ã×¼¼Êõ£¬ÉõÖÂÄÉµç×Ó¼¼Êõ½«»áÓ¦ÓÃì¶µçÄÔ¾§Æ¬¡£
ÒòÎªÍ­µ¼µçÄÜÁ¦½ÏÇ¿£¬ÂÁµ¼Ìå½«»á±»ÌÔÌ­¡£ÔÚ¿ÌÊ´¾§Æ¬ (photolithography) µÄ¹ý³ÌÖÐ£¬
¼«¸ßÆµµÄ×ÏÍâÏß¡¢X-ÉäÏß»òµç×ÓÊø»á±»ÓÃì¶¿ÌÊ´ (etch) ÌØáç´óÐ¡ (feature size) Ð¡ì¶ 
0.15 Î¢Ã×µÄµçÂ·¡£½ñáá¶þÊ®Äê£¬ÎùÆ¬½«»á±»·Ö×ÓµçÄÔ (molecular computers) 
ºÍÉúÎï¾§Æ¬ (bio chips) È¡´ú¡£ËüÃÇµÄËÙ¶È½«»á±ÈÎùÆ¬¿ìÊýÊ®ÒÚ±¶£¡·Ö×ÓÊÇÒ»×éÔ­×Ó¡£
¶øÎ¢Ð¡µÄÔ­×Ó×é³ÉÄãÔÚÊÀÉÏËù¼ûµÄËùÓÐÎï¼þ¡£
·Ö×ÓµçÄÔ»áÓÃÎïÖÊµÄ·Ö×ÓÀ´µ±³¬¿ìµÄµç×Ó¿ª¹ØÖÆ¡£¿ªÖÆ (ON) ´ú±í 1¡¢¹Ø±Õ (OFF)
´ú±í 0¡£ÊÀÉÏËùÓÐµçÄÔ³ÌÊ½¶¼ÊÇ¸ù¾Ý¶þÔªÊý£¨Êý×Ö 1 ºÍ 0£©ÔË×÷¡£



ÏÂ±íÁÐ³ö¾§Æ¬¼¼ÊõµÄ½ø²½¼°Î´À´·¢Õ¹Ç÷ÊÆ¡£
\begin{tscreen}
\begin{verbatim}
                                 Î´À´¾§Æ¬ÄÜÁ¦µÄ½øÕ¹
                                 ******************
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| ÏîÄ¿/Äê·Ý                | 1997    | 1999    | 2001    | 2003    | 2012   | 2020    | 2030    |
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| ÌØáç´óÐ¡£¨Î¢Ã×£©         | 0.25    | 0.18    | 0.15    | 0.13    | 0.05   |< 0.00001|  Ô­×Ó   |
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| ¾§Æ¬´óÐ¡£¨ÙñÃ×£©         | 200     | 300     | 300     | 300     | 450    |ÉúÎï/·Ö×Ó|  Á¿×Ó   |
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| ×îµÍÔËÐÐµçÑ¹             | 1.8-2.5 | 1.5-1.8 | 1.2-1.5 | 1.2-1.5 | 0.5-0.6| < 0.001 |  ¼«Ð¡   |
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| ×î´ó¹¦ÂÊÏûºÄ             | 70      | 90      | 110     | 130     | 175    | 600     |  ¼«Ð¡   |
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| ÔËÐÐÆµÂÊ (MHz)           | 750     | 1,250   | 1,500   | 2,100   | 10,000 | > 50,000|  -----  +
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
| DRAM ÈÝÁ¿                | 256 MB  | 1 GB    | 2 GB    | 4 GB    | 256 GB | > 1000GB|  -----  |
+--------------------------+---------+---------+---------+---------+--------+---------+---------+
\end{verbatim}
\end{tscreen}

ÈçÄãËù¼û£¬Ó²¼þ²ÅÖØÒªºÍÐèÒª¸ß¿Æ¼¼£¬Èí¼þÔòÐèÒªÈËÊÖ£¬µ«ËùÓÃµÄ¿Æ¼¼¾Í±È½Ï¼òµ¥¡£

ÁíÒ»·½Ãæ£¬ÊÀÉÏÃ¿¹ú¼Ò¶¼»á·¢Õ¹Èí¼þ¡£ÊÂÊµÉÏ£¬
ÊÀÉÏÈÎºÎÒ»¸öÓµÓÐÒ»²¿µÍ¼ÛµçÄÔµÄÈË¶¼¿É±àÐ´Èí¼þ¡£

Ïñ Oracle£¬Informix£¬Sybase£¬IBM DB2 (Unix) µÈ×ÊÁÏ¿â£¬¶¼ÊÇÓÃ "C" ÓïÑÔÐ´³É£¬
¶þÔªµµÔòÊÇÓÃ±àÒëÆ÷²úÉú£¬ÕâÑù±ã¿ÉÊÛ¸øÓÃ»§ÁË¡£Oracle¡¢Sybase¡¢Informix 
×ÊÁÏ¿âÊÇ°Ù·Ö°ÙµÄ C ³ÌÊ½£¡£¡



Ê®ËÄÄêÀ´£¬ÈËÃÇÒÑÔÚ PostgreSQL ÉÏ×öÁËºÜ¶à¹¤×÷£¬´ÓÍ·´´ÔìÁíÒ»¸ö·ûºÏ ANSI/ISO SQL 
µÄ×ÊÁÏ¿âÏµÍ³²¢²»ºÏ·û³£Àí¡£ÔÚ PostgreSQL µÄÔ´³ÌÊ½ÉÏ¼ÓÉÏÇ·È±µÄ¹¦ÄÜ»ò½«Ö®¼ÓÇ¿£¬
Ö®ááÁ¢¿ÌÊ¹ÓÃ£¬ÓÐºÜ´óºÃ´¦¡£

¾Ý¹À¼Æ£¬¶Ô¡¸»¥ÁªÍø²úÆ·¡¹µÄÐèÇó½«»áÒÔÖ¸Êý¼¶Êý (exponentially) 
Ôö³¤£¬ÒòÎªËü¿ÉÎ¬ÏµÒ»Èº¸ßÖÊËØ¡¢µÍ¼Û¶øÅÓ´óÊýÁ¿µÄÊ¹ÓÃÕß¼°¿ª·¢ÈËÔ±¡£
²»Ê¹ÓÃ¡¸»¥ÁªÍø²úÆ·¡¹µÄ¹ú¼Ò»á´í¹ýÕâ³¡¡¸È«Çò»¥ÁªÍø¸ïÃü¡¹¶ø±»ÆäËû¹ú¼Ò´ó´óÅ×Àë¡£
ÕâÊÇÒòÎª»¥ÁªÍø±¾Éí¾ÍÊÇÊÀÉÏ{\bfseries ×î´ó}µÄ¡¸Èí¼þ¹«Ë¾¡¹£¬Ò²ÊÇ´óÐÍµÄÈí¼þ¡¸·¢µç»ú¡¹£¡




\subsection{Á¿×Ó (Quantum) µçÄÔ¡õ¡õÁ¿×ÓÎïÀíÑ§ºÜÓÐÓÃ}

ÈçÄãÔÚÇ°±í¡¸Î´À´¾§Æ¬ÄÜÁ¦µÄ½øÕ¹¡¹Ëù¼û£¬ÔÚ´óÔ¼ 2030 Äê£¬PostgreSQL
Ò»Àà×ÊÁÏ¿âÏµÍ³»áÔÚ{\bfseries Á¿×ÓµçÄÔ}ÔËÐÐ¡£Á¿×ÓµçÄÔ¸ù¾ÝÔ­×ÓÁ£×ÓµÄÌØÐÔ£¬ÈçÐý×ª 
(spin) ·½ÏòÀ´²úÉú×´Ì¬¡£ÀýÈç£¬ÔÚÏòÉÏÐý×ª (spin is up) Ê±£¬Ò»â·Á£×Ó¿É±»¿´×÷{\bfseries ¡°Ò»¡±}£¬ÏòÏÂÐý×ªÊ±¿É±»¿´×÷{\bfseries ¡°Áã¡±}¡£Ô­×ÓºÍÆäºËÐÄ¿É³öÏÖÖØµþ 
(superposition) µÄ×´Ì¬£¬Ê¹µÃÒ»¡¢ÁãºÍÆä¼äµÄÊýÖµ¿ÉÍ¬Ê±±í´ï¡£¼®Öø¸ÉÈÅÔ­×ÓµÄÐý×ª£¬
{\bfseries Á¿×ÓÎ»} (qubit) ¿É·ÅÔÚÒ»Æð£¬ÁîËüÃÇ¿Éµ±Ò»¸öÕûÌåÀ´ÔË×÷£¬
Ê¹µÃ·ÇÏßÐÔ¼ÆËã (nonlinear computational) ÄÜÁ¦{\bfseries Ò£Ò£ÁìÏÈ}ÏÖ´ú³¬¼¶µçÄÔ£¡£¡
ÔÚÔ­×Ó²ãÃæ£¬Á¿×ÓÎïÀíÑ§ÓÐÖúÀí½âÔ­×ÓÁ£×ÓµÄ±íÏÖ¡£


\section{ÎïÀí¶¨ÂÉÊÊÓÃì¶µçÄÔÈí¼þ£¡}

ÕâÕÂ»áËµÃ÷¿ÆÑ§ÔÚ²»Í¬ÊÂÎï£¬ÈçÈí¼þ¡¢ÓîÖæ¡¢Ô­×Ó¡¢ÄÜÁ¿ÉõÖÁÄã×Ô¼ºµÄ´´Ôì¹ý³ÌÖÐ°çÑÝÈçºÎÖØÒªµÄ½ÇÉ«¡£Ò²»áËµÃ÷ÎªºÎ¿ÆÑ§ÖªÊ¶ÔÚÊ¹ÓÃ¿ÆÑ§µÄ²úÆ·Ç°·Ç³£ÖØÒª¡£

»Æ½ð¶¨ÂÉÊÇ¡õ{\itshape ¡¸Äã²»¿ÉÓÃÒ»¼þÀ´Àú²»Ã÷µÄ²úÆ·£¡£¡¡¹\/}Õâ¶¨ÂÉÊÊÓÃì¶ËùÓÐ¶«Î÷¡õ
×ÊÁÏ¿âÏµÍ³¡¢µçÄÔÏµÍ³¡¢×÷ÒµÏµÍ³¡¢ÓîÖæÉõÖÁÄãµÄÉíÌå£¡¼´ÊÇËµ£¬
ÄãÒªµÃµ½ÏµÍ³ÍêÕûµÄÔ´³ÌÊ½ÂëºÍ×ÊÁÏ¡£ÁË½âÈËÌåºÍÈËÌåÄÚµÄÔ­×ÓµÄÔË×÷·Ç³£ÖØÒª£¬ÒòÎª 
PostgreSQL¡¢Î¢ÈíÊÓ´° 95 µÈ¶¼ÊÇÈËÔìµÄ¡£

´´ÔìÊÇºÜÖØÒªµÄÒ»²½¡£Ê¹ÓÃ¿ÆÑ§Îï¼þµÄÈË±ØÐëÖªµÀËüÈçºÎ²úÉú¡£ÕâÉõÖÁÊÊÓÃì¶µçÄÔÏµÍ³ºÍ 
PostgreSQL¡£´ó¶àÊýÈË¶¼Ã»ÓÐ¿ÆÑ§ÖªÊ¶£¬Òò´Ë²»ÖªµÀÈçÎ¢ÈíÊÓ´° NT/95¡¢Oracle¡¢
ÈËÌåºÍÓîÖæµÈÏµÍ³ÈçºÎ²úÉú¡£ºÜ¶àÈË²»ÖªµÀÊ²÷á´´ÔìÓîÖæºÍÎ¢ÈíÊÓ´° NT/95 
ºÍËüÃÇÄÚ²¿ÊÇÊ²÷á¡£¸´ÔÓµÄÏµÍ³ÒÔ¼òµ¥µÄ×é³É²¿·Ö½¨³É¡õ¡õÓÐÇ§Ç§ÍòÍò¸öÓîÖæ²úÉúÁË£¬
Ã¿¸öÓîÖæ¶¼ÊÇÇ§Ç§ÍòÍò¸ö³¬ÐÇÍÅ (super-cluster) ×é³É£¬Ã¿¸ö³¬ÐÇÍÅ¶¼ÊÇÇ§Ç§ÍòÍò¸öÐÇÏµ
(galaxy) ×é³É£¬Ã¿¸öÐÇÏµ¶¼ÊÇÇ§Ç§ÍòÍòâ·¡õÐÇ (star) ×é³É£¬ÓÐÐ©¡õÐÇÏµÍ³ÖÐÓÐÐÐÐÇ 
(planet)£¬¶øÐÐÐÇÊÇÊýÒÔÊ®ÒÚ¼ÆµÄÔ­×Ó×é³É¡£{\itshape £¨ÊÀ½çÀúÊ·ÖÐ£¬
Ö»ÔÚ¹ÅÓ¡¶È{\bfseries ÓÐÒ»¸öÈË´´ÔìÁËÒ»¸öÓîÖæ}£¬µ«ÔÚÏÖ´úÉç»áÔÙÃ»ÓÐ·¢Éú¡£
ÊÀÉÏ²»ÉÙ¹ú¼Ò¶¼Õý³¢ÊÔ´´ÔìÓîÖæ¡££©\/}´´ÔìÓîÖæÊÇÒ»¼þ¼«ÎªÏÈ½øµÄ¿Æ¼¼£¬
±ÈÕ¨ÖÐ¹ãµººÍ³¤Æé£¬Ôì³É{\bfseries ¿Ö²ÀµÄÆÆ»µ}µÄÔ­×Óµ¯ÏÈ½øµÃ¶à¡£
ÏÖ´úºËÎä¼ÈÏ¸Ð¡ÓÖÇ¿¾¢£¬Ö»ÐèÒ»¸öÕâÐ©ºËµ¯Í¶ÈëÌ«Æ½Ñó¼´¿ÉÊ¹µØÇòÏûÊ§£¡
ÎäÆ÷µÄ±ä»¯ÎÞÇî£¡£¡ÔÚ¹ÅÓ¡¶ÈµÄÕ½³¡ÖÐ¾ÍÓÃ¹ýºËÎäºÍÆäËû¸ü{\bfseries Ç¿Á¦·Ç·²µÄÎäÆ÷}£¡
µ±°¬²®ÌØ£®°®ÒòË¹Ì¹ (Albert Eienstein)£¨Ò»¸ö¶þÊ®ÊÀ¼Í 00 
Äê´úµÄ¿ÆÑ§¼Ò£©ËµºËÎä¿ÉÊ¹´ó³ÇÊÐÈË¼äÕô·¢Ê±£¬Ã»ÓÐÈËÏàÐÅËû¡£
½ñÊ±½ñÈÕÒ²Ã»ÓÐÈËÏàÐÅÈËÁ¦¿É´´ÔìÓîÖæ¡£

Î¢ÈíÊÓ´°¾ÅÎåÖ®ÀàÈí¼þÊÇÒÔ C ºÍ×éºÏÓïÑÔÐ´³É£¬Ö»ÓÃµ½ 1 ºÍ
0¡£{\itshape {\bfseries ÎÒÃÇËù×¡µÄÕâÀàÓîÖæÊÇÓÉÆäËû¿Õ¼äÖÐÁ½Á£²»ÏàËÆ¶øÊÊºÏµÄÔ­×Ó×éºÏ×²»÷¶ø³É¡£}\/}£¨ÓÐÈ¤µÄÊÂÔÚÁ£×Ó×²»÷{\bfseries Ö®Ç°¸ÕºÃ}·¢ÉúÁË£©
ÈËÌåÊÇÓÉÁ½Á£²»ÏàËÆ¶øºÏÊÊµÄÏ¸°û×éºÏ×²»÷¶ø³É£¡£¡
{\itshape £¨ÓÐÈ¤µÄÊÂÔÚÏ¸°û×²»÷{\bfseries Ö®Ç°¸ÕºÃ}·¢ÉúÁË£©\/}ÈËÀàÒÅ´«ÁËÓîÖæµÄÌØÐÔ¡£
ÄãËùÔÚµÄÓîÖæÒÔÇ°²¢²»´æÔÚ¡õ¡õÓîÖæÖÐµÄÔ­×Ó²¢²»´æÔÚ£¬ÉõÖÁÊ±¼ä¶¼²»´æÔÚ£¡
ÓîÖæÔÚ´ó±¬Õ¨Ê±³öÉú£¬¿ªÊ¼À©ÕÅ²¢³ÖÐø³É³¤¡£Ö±ÖÁÏÖÔÚÓîÖæÈÔÔÚÀ©ÕÅ£¡£¡
ÓÐÈËÔÚÒ»¸öÃûÎª{\bfseries ¡®Brahma¡¯}µÄÓîÖæ´´ÔìÁËÄãËùÔÚµÄÓîÖæ¡£
{\itshape {\bfseries ÖªÊ¶ÊÇÕâ¸öÓîÖæÖ®Ä¸£¡£¡}\/}
¡®Brahma¡¯ÔÚÄãÉú»îµÄÓ¤¶ùÓîÖæµ®ÉúÖ®Ç°ÒÑ¾­°®ÉÏÁË¡®ÖªÊ¶Ö®Ä¸¡¯£¡£¡
ÄÇ¹ý³ÌºÍÄã³öÉúµÄ¾­¹ý²î²»¶à£¡Ã»ÓÐÀ´×ÔÖªÊ¶Ö®Ä¸µÄµÄ¡®»ùÒò¡¯£¬ÒªÐ´Ò»¸öÐ¡ÐÍµÄ 'C' 
³ÌÊ½Ò²Ã»¿ÉÄÜ£¡£¨Òë°´¡ÃÍêÈ«²»Ã÷°×ÕâÒ»¶ÎÏëËµÊ²÷á£¬¸ü²»ÖªÔõÑùÒë²Å·ûºÏÔ­Òâ£¬
´ó¼ÒÈç¹ûÖªµÀ£¬ÇëÀ´º¯Í¨Öª¡££©

ÓÐ³¯Ò»ÈÕÎÒÃÇµÄÓîÖæ»á¹ØÉÏ£¨Ò»Éù¾ÞÏìÖ®áá£©£¬ÆäÖÐµÄËùÓÐÔ­×Ó»áÍêÈ«»ÙÃðºÍÏûÊ§£¡

ÈËÀàÊµÔÚÊÇÓÐ¿ÉÄÜ´´ÔìÓîÖæµÄ¡£¿ÉÒÔ´´ÔìµÄÓîÖæ×ÜÊýÊÇ{\bfseries ÎÞÏÞ´ó}£¬
¿ÉÒÔ´´ÔìµÄ×÷ÒµÏµÍ³µÄ×ÜÊýÒ²ÊÇ{\bfseries ÎÞÏÞ´ó}£¡£¡ÓÐÊýÒÔ°ÙÍò¼ÆµÄÓîÖæ£¬
¿É·ÖÎªÈý´óÀà¡£ÎÞÏÞÊýÁ¿µÄÓîÖæºÍÎÞÏÞ±ä»¯µÄ¶àÎ¬Ô­×Ó (multi-dimensional atoms) 
±ÀËú³ÉÎªÊý¸ö{\itshape »ù±¾Î¬ÓîÖæ (primary-dimensional-universe)\/}¡£
·Ç³£ÏÈ½øµÄÊýÑ§Ò²Ö§³ÖÕâÀíÂÛ¡£

¿ÆÑ§ºÍÍ³¼ÆÑ§¶¨ÂÉÖ§³Ö¿ª·ÅÔ­Ê¼Âë£¬Èç PostgreSQL ºÍ 
Linux¡£»¥ÁªÍøµÄËÙ¶ÈÓëÈÕ¾ãÔö£¬Ò²Ô½À´Ô½¿É¿¿£¬¿ª·ÅÔ­Ê¼ÂëµÄ¶¯Á¿ (momentum) 
»áÑ¸ËÙÔö¼Ó¡£ÁíÍâ£¬Èç¹ûÍ³¼ÆÑ§¼°¿ÆÑ§¶¨ÂÉÕýÈ·µÄ»°£¬
ÈËÃÇ¸ü×¢Òâ¿ÆÑ§ºÍµ±{\bfseries ÎÞÖª}µÄÈË¿ªÊ¼Ñ§Ï°¿ÆÑ§£¬·â±ÕÊ½³ÌÊ½³ÙÔç»áÔÚÊÀÉÏÏûÊ§¡£

·¢Õ¹ PostgreSQL ÕâÀà¼Æ»®ÐèÒªÄÜÁ¿ºÍÊ±¼äµÈ×ÊÔ´£¬Òò´Ë£¬PostgreSQL 
ÊÇÄÜÁ¿ºÍÊ±¼äµÄ²úÆ·¡£ÄÜÁ¿ºÍÊ±¼äÖ»ÄÜÔÚ¿ÆÑ§ÉÏ½âÊÍ£¬ËùÒÔÎïÀíÑ§ºÍ PostgreSQL¡¢Linux
Ö®ÀàÈí¼þ×¨°¸ÊÇÓÐÖ±½Ó¹ØÁªµÄ¡£¿ÆÑ§£¨ÎïÀí£©¶¨ÂÉÊÊÓÃì¶ÈÎºÎÊ±¼ä¿Õ¼ä£¬ÈÎºÎÐÐÎª£¬
ÉõÖÁÈí¼þ¿ª·¢¡£

ÎïÀíÑ§¼´Ê¹ÔÚÄãËµ»°£¨Éù²¨£©¡¢²½ÐÐ£¨µØÃæºÍ½ÅÖ®¼äµÄÄ¦²ÁÁ¦£©¡¢
¿´ÊéºÍ±àÐ´Èí¼þÊ±¶¼·¢Éú×÷ÓÃ¡£ÊÀÉÏËùÓÐ¿ÆÑ§¶¼Ö²¸ùì¶ÊýÑ§£¬°üÀ¨ 
PostgreSQL¡£PostgreSQL Ê¹ÓÃÁËÊýÑ§µÄÒ»¸öÐ¡·ÖÖ¦¡®ÏÖ´ú´úÊý¡¯(Modern 
Algebra)¡£ÏÖ´ú´úÊý´¦Àí¡®¼¯ºÏÂÛ¡¯(Set Theory)¡¢¡®¹ØÏµ´úÊý¡¯(Relational 
Algebra)¡¢Èº×é (Groups)¡¢»· (Rings)¡¢ÊÕ¼¯ (Collections)¡¢¼¯ (Sets)¡¢ÁªºÏ 
(Unions)¡¢½»´í (Intersections)¡¢ÅÅ³â (Exclusions)¡¢Óò (Domains)¡¢ÁÐ (Lists) 
µÈµÈ¡£

PostgreSQL ÕâÀà²úÆ·Ö®ËùÒÔ´æÔÚ£¬±ãÊÇÒòÎªÄÜÁ¿ºÍÊ±¼ä¡£
¶øÖÊÁ¿ºÍÄÜÁ¿ÊÇ{\bfseries Í¬Ò»}ÊÂÎï£¡ÖÊÄÜÏàÍ¬µÄÊÂÊµÔÚÒ»°ÙÄêÇ°ÈÔÎ´ÎªÈËËùÖª£¡
¼´Ê¹ÔÚ{\bfseries ½ñÊ±½ñÈÕ}ÊÀÈËÒ²²»ÖªµÀ»¥ÁªÍøÊÇ×î´óµÄÈí¼þ¡¸·¢µç»ú¡¹
ºÍÊÀÉÏ×î´óµÄ¡¸Èí¼þ¹«Ë¾¡¹¡£

ÄÔÏ¸°ûÔÚ¹¤×÷£¨±àÐ´³ÌÊ½£©Ê±»áÏûºÄÄÜÁ¿£¬°ÑÀ´×ÔÊ³ÎïµÄ»¯Ñ§ÄÜ×ª»¯ÎªµçÄÜ¼°ÈÈÄÜ¡£
¼´Ê¹ÔÚÄãÔÄ¶ÁÕâ¶ÎÎÄ×ÖÊ±£¬ÄãµÄÄÔÏ¸°û±ã»áÏûºÄÈ¼ÁÏ¼°Ê¹ÓÃÐ¡Á¿ÄÜÁ¿¡£Ò²¾ÍÊÇËµ£¬
ÈËÄÔÊÇÒ»Ì¨ÈÈÁ¦Ñ§ÉÏµÄ»úÆ÷ (thermodynamic heat engine)¡£ÕýÒòÎªÕâÑù£¬
ÈÈÁ¦Ñ§µÄ¶¨ÂÉÒ²ÊÊÓÃì¶ÈËÄÔ£¬Ò²¾Í¼ä½ÓµØÓ°Ïìµ½ PostgreSQL Ò»ÀàÈí¼þ¡£

ÊÀÉÏ¿ÉÓÐÎÞÏÞÖÖÑÕÉ«¡¢µçÄÔÓïÑÔ¡¢¾§Æ¬Éè¼ÆºÍÀíÂÛ£¬µ«²»¿ÉÄÜÓÐÒ»ÖÖÍêÃÀµÄÑÕÉ«¡¢
µçÄÔÓïÑÔ¡¢Éè¼ÆºÍÏµÍ³£¡ÄãËùÄÜµÃµ½µÄÖ»ÊÇ½üºõÍêÃÀµÄÑÕÉ«£¨²¨³¤£©¡¢ÏµÍ³¡¢
×ÊÁÏ¿â»òÀíÂÛ£¡{\bfseries ´ó×ÔÈ»¾ÍÏñÒ»¸ö{\itshape Íò»¨Í²\/}}¡õÓÐÎÞÏÞÎ¬ÊýµÄ¿Õ¼ä£¬
ÆäËû¿Õ¼äÁ£×ÓµÄ±äÏÞ±ä»¯£¬µ«ËüÃÇÈ«²¿½áºÏÎªÐ¡ÊýµÄ¿Õ¼ä£¬·´Ö®ÒàÈ»¡£

°ÑÊÀÉÏÊý°ÙÍòÍøÃñµÄÄÜÁ¿½áºÏÆðÀ´£¬Ê¹µÃ½¨Á¢Ò»¸ö{\bfseries ½üºõÍêÃÀ}µÄÏµÍ³
£¨°üÀ¨×ÊÁÏ¿âÈí¼þ£©±äµÃÓÐ¿ÉÄÜ¡£¹ÂÕÆÄÑÃù£¬µ«¼®ÖøÍøÂç°Ñ´óÁ¿ÈËÊÖ¼¯ºÏÆðÀ´£¬
ËûÃÇµÄ×ÜÄÜÁ¿»á·Ç³£ÅÓ´ó£¬¶øÇÒ¿É¼¯ÖÐì¶½¨Á¢Ò»¸ö½üºõÍêÃÀµÄÏµÍ³¡£

ÄÜÁ¿µÄµ¥Î»ÊÇ½¹¶ú (Joules)£¬Ç§½¹¶ú»ò¹«½ï£¬Ê±¼äÒÔÃë»òÐ¡Ê±Á¿¶È¡£¹¦ÂÊ (power) ÊÇÄÜÁ¿³ýÒÔÊ±¼ä£¬µ¥Î»ÊÇÍß»òÇ§Íß¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
        Ã¿ÈËµÄÄÜÁ¿ = y ½¹¶ú
»òÒÔÖÊÁ¿À´Ëµ
        Ã¿ÈËµÄÄÜÁ¿ = y ¹«¿Ë
ÖÊÁ¿ºÍÄÜÁ¿Ö®¼äµÄ×ª»»ÒòÊýÊÇ E = m * c * c£¬'c' ÊÇ¹âËÙ¶ø 'm' ÊÇÖÊÁ¿¡£
        Ê±¼ä = 8 Ð¡Ê±£¨ÕâÊÇÒ»¸ö³£Êý£¬ÒòÎªÒ»ÈËÒ»ÌìÖ»ÓÐ 8 Ð¡Ê±£©
        ¹¦ÂÊ = ÄÜÁ¿ / Ê±¼ä
             = (y / (8 * 60 * 60)) Íß
        ÊÀ½çµÄ×Ü¹¦ÂÊ = n * (y / (8 * 60 * 60)) Íß
n = ²ÎÓë¼Æ»®µÄ×ÜÈËÊý¡£
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

´ÓÒÔÉÏ·½³ÌÊ½£¬ºÜÃ÷ÏÔÔö¼Ó 'n' »á´ó·ù¸ÄÉÆ²úÆ·ÖÊËØ¡£n
Ô½´ó¹¦ÂÊÒ²Ô½´ó£¨ÓÃÇ§Íß±íÊ¾£©¡£ Äã¿ÉÒÔÏëÏñÈ«»¥ÁªÍøÓÐ¶àÉÙÄÜÁ¿£¨ÒÔÇ§½¹¶ú¼ÆËã£©
ºÍ¹¦ÂÊ£¨ÒÔÇ§Íß¼ÆËã£©×¨×¢ì¶ Linux ºÍ PostgreSQL Ò»ÀàÏµÍ³£¡

ºÜÃ÷ò«£¬»¥ÁªÍø¿ÉÁ¬ÏµºÜ¶àÈË£¬Ò²¾ÍÊÇËµ»¥ÁªÍøÓÐ´óÁ¿ÄÜÁ¿ºÍÊ±¼ä£¬
¿ÉÓÃ±ÈÈí¼þ¹«Ë¾¸ü¶ÌµÄÊ±¼ä²úÉú¸ü¸ßÖÊËØµÄÈí¼þ¡£¼´Ê¹ÊÇÎ¢Èí¡¢IBM 
µÈ´ó¹«Ë¾Ò²²»¿ÉÎ¥¿¹ÎïÀí¶¨ÂÉ£¬¶ø±Ø»áÏòÎïÀí¶¨ÂÉ{\bfseries Í¶½µ}¡£

½áÂÛÊÇ¡ÃÒòÎª¿ÆÑ§µÄ¶¨ÂÉ£¬¡®¿ªì¶Ô­Ê¼Âë¡¯ÏµÍ³£¬Ïñ PostgreSQL¡¢Linux 
»áÕ½Ê¤¡®·â±ÕÔ­Ê¼Âë¡¯ÏµÍ³£¬ºÍ±Ø»á±ÈËüÃÇÓÅÒì¡£ÕâÊÇÓÐ¿ÆÑ§¸ù¾ÝµÄ¡£
ÈËÀà²»Ó¦ÀË·ÑÊ±¼ä´´ÔìÌ«¶àÖØ¸²µÄÈí¼þ²úÆ·¡£


\section{PostgreSQL ÊÇÊ²÷á£¿}

PostgreSQL ÊÇÒ»¸ö×ÔÓÉµÄ×ÊÁÏ¿â£¬¸øÓèÄãÍêÕûµÄ³ÌÊ½Âë£¬ÊÇÒ»¸öÒÔ ANSI SQL 1998, 92, 
89 ¹æ¸ñÎªÄ¿±êµÄÎï¼þ¹ØÁªÊ½×ÊÁÏ¿âÏµÍ³£¬¿ÉÔÚ²»Í¬µÄÓ²¼þÆ½Ì¨ºÍ²Ù×÷ÏµÍ³ÖÐÔËÐÐ¡£
PostgreSQL µÄ×îÖÕÄ¿µÄÊÇ°Ù·Ö°Ù·ûºÏ ANSI/ISO SQL ¼°³ÉÎªÊÀ½çµÚÒ»µÄ¿ª·ÅÍ¨ÓÃ×ÊÁÏ¿â¡£

½ñÌì£¬PostgreSQL
ÊÇÊÀÉÏ{\bfseries ×îÏÈ½ø}µÄÏµÍ³¡£ÁîÈË²ïÒìµÄÊÇ£¬ºÜ¶àÉÌÒµµÄ×ÊÁÏ¿âÔÚÖÊËØ¡¢
ÌØÐÔºÍÄÜÁ¦¸÷·½Ãæ¶¼×·²»ÉÏËü£¡£¡PostgreSQL 
ÊÇµØÇòÉÏºÜ¶à¹ú¼ÒµÄºÏ×÷³É¹û£¬ÊÇÒ»¸öºÍ{\bfseries ¹ú¼ÊÌ«¿ÕÕ¾} (International 
Space Station) ÏàËÆµÄ×¨°¸¡£ÔÚÎ´À´µÄÊýÊ®Äê£¬PostgreSQL 
ÈÔ»áÊÇ{\bfseries ×î¼ÑµÄ×ÊÁÏ¿âÏµÍ³}£¬ÒòÎªËüÊÇÒ»¸ö¿ª·ÅÔ­Ê¼ÂëÏµÍ³¡£

PostgreSQL ±³ááµÄ»ù±¾Ïë·¨ÊÇ¡õÖ»ÒªÒ»¸öÄ£×éµÄ³ÌÊ½Ð´ºÃÁË£¬
Äã¾Í²»Ó¦ÀË·ÑÊ±¼äÖØÐÂÐ´Ò»´Î£¬ÄÄ¹ÜÖ»»¨Ç§·ÖÖ®Ò»Ãë£¡£¡

Informix Universal server£¨1997 ÄêÍÆ³ö£©µÄ»ù´¡ÊÇ PostgreSQL µÄ½Ï¾É°æ±¾£¬ÒòÎª 
Informix ÊÕ¹ºÁË Illustra Inc. ¼°ÕûºÏµ½ Informix¡£Illustra ×ÊÁÏ¿âÊÇ¸ù¾Ý 
Postgres£¨PostgreSQL µÄÇ°Éí£©Ð´³ÉµÄ¡£

PostgreSQL ÊÇ POSTGRES ×ÊÁÏ¿â¹ÜÀíÏµÍ³µÄ¸ÄÁ¼°æ£¬Ò»¸öÐÂÒ»´ú DBMS µÄÑÐ¾¿Ô­ÐÍ 
(prototype)¡£ÔÚ±£Áô POSTGRES Ç¿´óµÄ×ÊÁÏÄ£ÐÍ¼°·á¸»µÄ×ÊÁÏÐÍÌ¬µÄÍ¬Ê±£¬
ËüÒÔÒ»¸öÀ©³äÁËµÄ SQL ×Ó¼¯À´È¡´ú PostQuel ²éÑ¯ÓïÑÔ¡£

PostgreSQL ÊÇÓÉÒ»Èº²Î¼Ó PostgreSQL ¿ª·¢Í¨ÐÅÂÛÌ³µÄ»¥ÁªÍø¿ª·¢ÈËÔ±½øÐÐµÄ¡£
Ä¿Ç°µÄÐ­µ÷ÕßÎª Marc G. Fournier¡£
\begin{itemize}
\item        \onlynameurl{scrappy@postgreSQL.org}
\end{itemize}

Õâ¶ÓÎé»á¸ºÔð½ñááËùÓÐ PostgreSQL ·¢Õ¹¹¤×÷¡£µ±È»£¬×ÊÁÏ¿âµÄÓÃ»§×Ô¼ºÒ²ÊÇ 
PostgreSQL µÄ¿ª·¢ÈËÔ±£¡Õâ¿ª·¢¹ý³ÌÊÇ·ÖÉ¢ÔÚ»¥ÁªÍøÉÏ´óÁ¿×ÊÁÏ¿âÓÃ¼ÒµÄ¡£

PostgreSQL 1.01 µÄ×÷ÕßÊÇ Andrew Yu ºÍ Jolly Chen¡£PostgreSQL µÄÇ°Éí Postgres 
µÄ³ÌÊ½Âë£¬ÊÇºÜ¶à´óÑ§±ÏÒµÉú¡¢±¾¿ÆÉú¼°³ÌÊ½Éè¼ÆÔ±ÔÚ University of 
California£¬Berkeley µÄ Michael Stonebraker ½ÌÊÚµÄÖ¸µ¼ÏÂµÄ²úÆ·¡£

ÒÑÓÐÊýÒÔ°ÙÍòÌ× PostgreSQL ±»°²×°×÷×ÊÁÏ¿âËÅ·þÆ÷£¬
ÍøÉÏ×ÊÁÏ¿âËÅ·þÆ÷ºÍÓ¦ÓÃ³ÌÊ½×ÊÁÏ¿âËÅ·þÆ÷¡£ËüÊÇÒ»¸öºÜÏÈ½øµÄÎï¼þ¹ØÁªÊ½×ÊÁÏ¿â
£¨ORDBMS£©¡£

PostgreSQL ¿ÉÔÚ Soloris¡¢SunOS¡¢HPUX¡¢AIX¡¢Linux¡¢Irix¡¢Digital Unix¡¢BSDi¡¢
NetBSD¡¢FreeBSD¡¢SCO Unix¡¢NEXTSTEP¡¢Unixware ¼°ËùÓÐÆäËûµÄ Unix 
Ö´ÐÐ¡£ÒÆÖ²µ½ÊÓ´° 95/NT µÄ¹¤×÷ÒÑÒÔ Cygnus cygwin32 Ì×¼þÍê³É¡£

±¾ÎÄËùÊöµÄ PostgreSQL ºÍÓÐ¹ØÎï¼þÊÜ University of California, Berkeley
µÄ°æÈ¨±£»¤¡£


\subsection{°×Æ¤Êé}

PostgreSQL ×ÊÁÏ¼ò½é¡Ã

\begin{itemize}
\item   ÌâÄ¿¡Ã   PostgreSQL SQL RDBMS ×ÊÁÏ¿â£¨Îï¼þ¹ØÁª×ÊÁÏ¿â¹ÜÀíÏµÍ³£©
\item   Ä¿Ç°°æ±¾¡Ã7.0.1        
\item   ÄêÁä¡Ã   PostgreSQL Ê®ÎåËê¡£×Ô 1985 Äê¿ªÊ¼¿ª·¢
\item   ×÷Õß¡Ã   Ê®ÎåÄêÀ´»¥ÁªÍøÉÏÊýÒÔ°ÙÍò¼ÆµÄ´óÑ§ºÍ¹«Ë¾
\end{itemize}

PostgreSQL µÄ°×Æ¤ÊéÔÚ \nameurl{http://www.greatbridge.com}{} ÕÒµ½¡£




\section{ÄÄ¸ö½ÏºÃ£¿PostgreSQL »¹ÊÇ MySQL£¿}




\subsection{PostgreSQL ´ò°Ü Oracle¡¢IBM DB2¡¢MS SQL server ºÍÆäËû£¡£¡}

PostgreSQL ÔÚ±íÏÖ¡¢ËÙ¶È¡¢À©Õ¹ÐÔ (scalability) ºÍ ¿ÉÐÅÐÔ (reliability) 
¸÷·½ÃæµÄ±ê×¼²âÊÔÖÐ´ò°Ü Oracle 8£¨ºÍ 8i£©¡¢IBM DB2¡¢MS SQL server¡¢Sybase¡¢
Interbase ºÍ MySQL£¡

µ½ \nameurl{http://www.aldev.8m.com}{} »ò \nameurl{http://aldev.webjump.com}{}  
ÔÄ¶Á»ù×¼²âÊÔ½á¹û¡£

£¨Òë°´¡ÃÓÐ¹Ø¸Ã²âÊÔ½á¹û£¬ÓÐ²»ÉÙÈËÌá³öÖÊÒÉ£¬Çë²ÎÔÄ \nameurl{http://www.devshed.com/BrainDump/MySQL_Benchmarks/}{}£©




\subsection{MySQL ºÍÆäËûÖØ¸²µÄ RDBMSes}

MySQL ÊÇÁíÒ»¸ö¿ª·ÅÔ­Ê¼ÂëµÄ SQL ËÅ·þÆ÷£¬µ«Ëü²»Ö§Ô®½»Ò×
(Transaction)¡£ËüÊÊÓÃì¶·Ç³£Ð¡µÄ×ÊÁÏ¿â£¬¶ø²»Ö§Ô®ÏÈ½øµÄ SQL ¹¦ÄÜ¡£PostgreSQL
ÔòÊÇÒ»¸öÆóÒµ¼¶µÄ×ÊÁÏ¿â£¬Ö§Ô®½»Ò×ºÍ¼¸ºõËùÓÐ SQL ½á¹¹¡£PostgreSQL
±ÈÉÌÒµµÄ×ÊÁÏ¿â£¬Èç Oracle¡¢Sybase ºÍ Informix µÈÏÈ½øµÃ¶à¡£PostgreSQL
Ö§Ô®·Ç³£ÏÈ½øµÄËø¶¨»úÖÆ (locking mechanism) 
ºÍºÜ¶àÔÚÉÌÒµ×ÊÁÏ¿âÖÐÕÒ²»µ½µÄÏÈ½ø¹¦ÄÜ£¡£¡

ÔÚ²»¾Ã½«À´£¬MySQL µÄ¿ª·¢½«»áÍ£Ö¹£¬ÒòÎª MySQL Ò²ÒÔ ANSI SQL 
ÎªÄ¿±ê£¬ÊÇÒ»¸öÖØ¸²µÄ²úÆ·¡£ÎÒÃÇÒª×îÏÈ½øºÍ³ÉÊìµÄ¿ª·ÅÔ­Ê¼Âë SQL 
ËÅ·þÆ÷£¬¶øÅ×µôËùÓÐÆäËûµÄ£¬ÒòÎªÎÒÃÇÃ»ÓÐºÜ¶àÊ±¼ä£¨À´¶Ô¸¶¶à¸ö
RDBMS£©£¡ÊÂÊµÉÏ£¬ÄãÁ¬Ö»¶Ô¸¶Ò»¸öÈç PostgreSQL °ãÇ¿¾¢µÄ SQL 
ËÅ·þÆ÷µÄÊ±¼äÒ²Ã»ÓÐ¡£ËùÓÐ MySQL ÓÃÕß¶¼»á×ªÒÆµ½ PostgreSQL¡£¶øÇÒ£¬MySQL
ÊÇÒ»¸ö¡®ÀàÉÌÒµ¡¯(quasi-commercial) µÄ²úÆ·£¬ºÍ PostgreSQL
²»Í¬£¬ááÕß¿ª·ÅÔ­Ê¼Âë£¬ÎÞÐèÊÚÈ¨·Ñ¡£¼ÈÉúè¤£¬ºÎÉúÁÁ¡£ÓÐÁË 
PostgreSQL£¬¾Í²»ÐèÔÙÓÐÁíÒ»¸ö SQL ×ÊÁÏ¿âÏµÍ³ÁË¡£

Èç MySQL Ò»ÀàµÄÖØ¸²²úÆ·Ê¹µÃÓÃ¼ÒÎÞËùÊÊ´Ó£¬·ÖÉ¢×ÊÔ´¡£
Ò»¸ö{\bfseries ¡°½üºõÍêÃÀ¡±}µÄÏµÍ³Ó¦¸ÃÊÇ{\bfseries ¶ÀÒ»ÎÞ¶þ}µÄÏµÍ³£¬
ÊÀÉÏÃ¿Ò»¸öÈË¶¼Ó¦ÎªËü¹¤×÷£¡£¡ÖØ¸²µÄ²úÆ·±×¶àì¶Àû£¬Òò´Ë£¬¾ø²»ÖµµÃ·ÖÉ¢×ÊÔ´¡£
ÕâÒÑÔÚÉÌÒµµÄ×ÊÁÏ¿â·¢Éú£¬Èç Oracle¡¢Sybase¡¢Informix ºÍÎ¢Èí SQL 
server¡£ÕâÑù»áÊ¹µÃÓÃÕß·ÖÁÑ£¬¶øÇÒ²úÆ·»¥²»¼æÈÝ¡£{\bfseries {\itshape ÎÒÈ´Ïë°Ñ SQL 
ËÅ·þÆ÷µÄÔ­Ê¼Âë¸øÄã¿ØÖÆ£¡£¡£¡\/}}

Äã²»ÐèÒªÉÏ°Ù¸ö×ÊÁÏ¿âÏµÍ³£¬ÄãÖ»ÐèÒªÒ»¸ö×îºÃµÄ×ÊÁÏ¿âËÅ·þÆ÷£¬Ëü¾ÍÊÇ¡®PostgreSQL¡¯¡£

{\bfseries ¾¯¸æ¡Ã}¸ù¾ÝÒ»·ÝÈç ANSI SQL µÄ¹æ¸ñ£¬ÈËÃÇ¿ÉÔì³öÎÞÏÞ¸ö×ÊÁÏ¿âÏµÍ³£¡£¡

MySQL Ã»ÓÐ¶ø PostgreSQL Ö§Ô®µÄ¹¦ÄÜÈçÏÂ¡õ
\begin{itemize}
\item  ½»Ò× (Transactions)
\item  ÄÚ´¢³ÌÐò (Stored Procedures)
\item  ¼¤·¢ (Triggers)£¨update£¬insert ºÍ delete£©
\item  Îï¼þµ¼Ïò×ÊÁÏ¿â (Object oriented databases)
\item  ÏÈ½øµÄ·âËøÏµÍ³ (Locking systems)£¬ÔÚ¶àÓÃ»§¡¢¶à½»Ò×»·¾³ÏÂµÄ²¢ÐÐ¹ÜÀí 
(concurrency management)¡£
\item  ×Ó²éÑ¯ (Sub-queries)
\item  ËÅ·þÆ÷¶ËÓÎ±ê (Server-side cursors)
\item  ²éÑ¯¿ìÈ¡ (Query caching)
\item  ×ÊÁÏ¿â·âËø (Locking of databases)
\item  ½ÏºÃµÄÁ¬½áÖ§Ô®£¨JOIN¡¢UNION¡¢MINUS¡¢INTERSECT¡¢outer join£©
\item  ºÜ¶àÆäËû¹¦ÄÜ¡õ¡õ¶à²»Ê¤Êý¡£
\end{itemize}


MySQL ¿ÉÔÚ \nameurl{http://www.tcx.se}{} ÕÒµ½¡£

£¨Òë°´¡ÃMySQL ÒÑ¸ÄÒÔ GPL ·¢ÐÐ¡££©


\section{ºÎ´¦È¡µÃ ?}

Äã¿É´ÓÒÔÏÂµØ·½¹ºÂò Redhat Linux ¹âµú¡¢Debian Linux ¹âµú»ò Slackware Linux 
¹âµú£¬´ÓÖÐÕÒµ½ PostgreSQL Ì×¼þ£¨Ô­Ê¼ÂëºÍ¶þÔªÂë£©¡Ã
\begin{itemize}
\item Linux System Labs ÍøÖ·¡Ã\nameurl{http://www.lsl.com/}{}  £¨7 ÃÀÔª£©
\item CheapBytes Inc ÍøÖ·¡Ã\nameurl{http://www.cheapbytes.com/}{} £¨7 ÃÀÔª£©
\item Debian Ö÷ÍøÖ·¡Ã\nameurl{http://www.debian.org/vendors.html}{}
\end{itemize}


PostgreSQL ×éÖ¯Ò²ÊÛÂô¡®PostgreSQL CDROM¡¯£¬ÄÚº¬ÍêÕûµÄÔ­Ê¼Âë£¬Ðí¶à Unix 
²Ù×÷ÏµÍ³µÄ¿ÉÖ´ÐÐµµ¼°ÍêÕûµÄÎÄ¼þ¡£
\begin{itemize}
\item ´ÓÖ÷ÍøÒ³È¡µÃ PostgreSQL ¹âµú¡Ã\nameurl{http://www.postgresql.org}{} 
30£¨ÃÀÔª£©
\end{itemize}


PostgreSQL Ö»º¬¶þÔªµµµÄ·¢ÐÐ°æ±¾ (distribution)¡Ã
\begin{itemize}
\item  PostgreSQL RPMs µÄÎ¬»¤ÈËÊÇ Lamer Owen£¬ÔÚ  
\onlynameurl{lamar.owen@wgcr.org} ÕÒµ½¡£
\item PostgreSQL Ô´ RPM ºÍ¶þÔª RPM \nameurl{http://www.ramifordistat.net/postgres}{}¡£
\item PostgreSQL Ô´ RPM ºÍ¶þÔª RPM \nameurl{http://www.postgresql.org}{} ¡£µãÑ¡¡°Latest News¡±ºÍ Redhat RPMs¡£
\item PostgreSQL Ô´ RPM ºÍ¶þÔª RPM \nameurl{http://www.redhat.com/pub/contrib/i386/}{} ¡£ftp Õ¾Ì¨ÔÚ \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/}{}
\item Solaris, HPUX, AIX, IRIX, Linux µÄ¶þÔªµµÕ¾Ì¨¡Ã \nameurl{ftp://ftp.postgresql.org/pub/bindist}{}
\end{itemize}




ÍòÎ¬ÍøÍøÕ¾¡Ã
\begin{itemize}
\item Ö÷ÍøÕ¾¡Ã\nameurl{http://www.postgresql.org/}{}
\item ´ÎÍøÕ¾¡Ã     \nameurl{http://logical.thought.net/postgres95/}{}
\item                \nameurl{http://www.itm.tu-clausthal.de/mirrors/postgres95/}{}
\item                \nameurl{http://s2k-ftp.cs.berkeley.edu:8000/postgres95/}{}
\item   \nameurl{http://xenium.pdi.net/PostgreSQL/}{}
\item   \nameurl{http://s2k-ftp.cs.berkeley.edu:8000/postgres95/}{}
\end{itemize}




ÒÔÏÂÎª ftp Õ¾¡Ã
\begin{itemize}
\item Ö÷ FTP:       \nameurl{ftp://ftp.postgresql.org/pub}{}
\item ´Î FTP:     \nameurl{ftp://ftp.chicks.net/pub/postgresql}{}
\item                \nameurl{ftp://ftp.emsi.priv.at/pub/postgres/}{}
\item           \nameurl{ftp://ftp.itm.tu-clausthal.de/pub/mirrors/postgres95}{}
\item                \nameurl{ftp://rocker.sch.bme.hu/pub/mirrors/postgreSQL}{}
\item                \nameurl{ftp://ftp.jaist.ac.jp/pub/dbms/postgres95}{}
\item                \nameurl{ftp://ftp.luga.or.at/pub/postgres95}{}
\item                \nameurl{ftp://postgres95.vnet.net:/pub/postgres95}{}
\item   \nameurl{ftp://ftpza.co.za/mirrors/postgres}{}
\item   \nameurl{ftp://sunsite.auc.dk/pub/databases/postgresql}{}
\item   \nameurl{ftp://ftp.task.gda.pl/pub/software/postgresql}{}
\item   \nameurl{ftp://xenium.pdi.net/pub/PostgreSQL}{}
\end{itemize}




PostgreSQL µÄÔ´³ÌÊ½ÂëÒ²¿É´Ó sunsite unc 
µÄÓ³ÉäÕ¾µÃµ½£¨È«ÇòÓÐ´óÔ¼Ò»Ç§¸ö£©¡£ËüÊÇÔÚ Redhat Linux ·¢ÐÐ°æ±¾ (distribution) 
µÄ /pub/contrib/i386/postgresql.rpm µµÖÐ¡£
\begin{itemize}
\item   ÒªÖªµÀÓÐÊ²÷áÓ³ÉäÕ¾£¬Çëµ½ \nameurl{ftp://sunsite.unc.edu}{} 
\end{itemize}



\section{PostgreSQL ¿ìËÙ°²×°Ö¸Òý \label{Quick-Installation}}

Õâ½Ú»á°ïÄãÔÚÐ¡ì¶Îå·ÖÖÓÄÚ¿ìËÙ°²×°ºÍÆô¶¯Õâ×ÊÁÏ¿â¡£




\subsection{°²×°ºÍ²âÊÔ}

°²×°¡¢²âÊÔ¡¢È·ÈÏºÍÖ´ÐÐ PostgreSQL µÄ²½Öè
ÒÔ root Éí·ÝÇ©Èë
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# cd /mnt/cdrom/RedHat/RPMS
# man rpm
# ls postgre*.rpm
# rpm -qpl postgre*.rpm | less £¨¹Û¿´µµ°¸Ãûµ¥£©
# rpm -qpi postgre*.rpm £¨¹Û¿´Ì×¼þ×ÊÁÏ£©
# cat /etc/passwd | grep postgres
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

×¢Òâ¡ÃÈç¹ûÄã¿´µ½Ò»¸ö¡®postgres¡¯Ê¹ÓÃÕß£¬Äã¿ÉÄÜÒª±¸·ÝºÍÇå³ý postgres µÄ¼ÒÄ¿Â¼ 
~postgres ºÍÉ¾³ýÕâÃûÓÃÕß£¬»ò°ÑËû¸ÄÃûÎª¡®postgres2¡¯Ö®Àà¡£°²×°Ê±ÐèÒªÇ¬Ç¬¾»¾»¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
:
# rpm -i postgre*.rpm £¨±ØÐë°²×°ËùÓÐÌ×¼þ£¬¼´¿Í»§¶Ë¡¢¿ª·¢¡¢×ÊÁÏºÍÖ÷Ì×¼þÀ´Ê¹ 
pgaccess Õý³£¹¤×÷£©
# man chkconfig
# chkconfig --add postgresql  £¨ÓÃÀ´ÔÚ¿ª»úÊ±¿ªÊ¼ pg¡££©
# /etc/rc.d/init.d/postgresql start £¨Æô¶¯ postgresql£©
# man xhost
# xhost +  £¨ÈÃ pgaccess Ê¹ÓÃÏÔÊ¾×°ÖÃ£©
# su - postgres
bash$ man createdb
bash$ createdb mydatabase
bash$ man psql
bash$ psql mydatabase
¡­¡­ÔÚ psql ÖÐ¿É°´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÇÂ¼»ò \s

bash$ export DISPLAY=<Ö÷»úÃû>:0.0
bash$ man pgaccess
bash$ pgaccess mydatabase
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÏÖÔÚÄã¿ÉÒÔÔÚ pgaccess »ò psql {\bfseries ¸ßËÙÏÂ´ï}¸÷ÖÖ SQL Ö¸ÁîÁË£¡£¡
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ cd /usr/doc/postgresql*
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÔÚ´ËÔÄ¶ÁËùÓÐ FAQ£¬Ê¹ÓÃÕß¡¢³ÌÊ½Éè¼ÆÔ±¡¢¹ÜÀíÊÖ²áºÍÖ¸Òý¡£


\subsection{PostgreSQL RPMs}

´ËÍâ£¬Çë¿´ \nameurl{http://www.ramifordistat.net/postgres}{} µÄ 
{\itshape "Installation Steps"\/}¡£

PostgreSQL RPM ÓÉ Lamar Owen Î¬»¤£¬Î»ì¶
\onlynameurl{lamar.owen@wgcr.org}
ÔÚ \nameurl{http://www.postgresql.org}{} ¿ÉÕÒµ½¸ü¶à PostgreSQL µÄ×ÊÁÏ¡£


\subsection{Maximum RPM}

ÊìÏ° RedHat RPM Ì×¼þ¹ÜÀíÔ±ÒÔ¹ÜÀí PostgreSQL °²×°¡£ÔÚ 
\nameurl{http://www.RPM.org}{} ÏÂÔØ¡®Maximum RPM¡¯Ò»Êé£¬ÕÒÑ°µµÃû
maximum-rpm.ps.gz¡£
ÔÚ Linux Ê¹ÓÃ gv Ö¸ÁîÔÄ¶ÁËü¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# gv maximum-rpm.ps.gz
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÓÐÒ»¸ö rpm2deb ¿É°Ñ RPM Ì×¼þ×ª»»Îª Debian Linux Ì×¼þ


\subsection{Àý×Ó RPM \label{Examples RPM}}

²âÊÔ PostgreSQL µÄ¸÷ÖÖ½éÃæÐèÒªÀý×Ó¡£´ÓÒÔÏÂµØ·½°²×° PostgreSQL Àý×ÓÄ¿Â¼¡õ
\begin{itemize}
\item  Linux ¹âµú - postgresql-*examples.rpm
\item  postgresql-*examples.rpm  \nameurl{http://www.aldev.8m.com}{} 
»ò \nameurl{http://aldev.webjump.com}{}
\item  PostgreSQL Ô­³ÌÊ½Âë postgresql*.src.rpm£¬ÔÚ examples¡¢testing »ò 
tutorial Ä¿Â¼Ñ°ÕÒ¡£
\end{itemize}



\subsection{²âÊÔ PyGreSQL¡õPython ½éÃæ \label{Testing PyGreSQL}}

°²×° examples Ì×¼þ£¬Çë²ÎÔÄ \ref{Examples RPM} {(Àý×Ó RPM)}£¬Ö®áá¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ cd /usr/lib/pgsql/python
bash$ createdb thilo
bash$ psql thilo
thilo=> create table test (aa char(30), bb char(30) );
thilo=> \q
bash$ /usr/bin/python
>>> import _pg
>>> db = _pg.connect('thilo', 'localhost')
>>> db.query("INSERT INTO test VALUES ('ping', 'pong')")
>>> db.query("SELECT * FROM test")
eins|zwei
----+----
ping|pong
(1 row)
>>>CTRL+D
bash$
¡­¡­ºÃÏñÐÐÁË¡õÏÖÔÚÕýÊ½°²×°Ëü
bash$ su - root
# cp /usr/lib/pgsql/python/_pg.so /usr/lib/python1.5/lib-dynload
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{²âÊÔ Perl¡õPerl ½éÃæ \label{Testing Perl}}

°²×° examples Ì×¼þ£¬Çë²ÎÔÄ \ref{Examples RPM} {(Àý×Ó RPM)}£¬Ö®áá¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
root# chown -R postgres.postgres /var/lib/pgsql/examples
bash$ cd /var/lib/pgsql/examples/perl5
bash$ perl ./example.pl
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

×¢Òâ¡ÃÈç¹ûÒÔÉÏÖ¸ÁîÊ§°ÜÁËÇë×öÈç´Ë×ö¡ÃÈ«Óò±äÊý @INC ÒªÔÚ°üÀ¨ site\_perl Ä¿Â¼ÖÐµÄ 
Pg.pm Ä£×é£¬ËùÒÔÒªÈçÏÂÊ¹ÓÃ
-I Ñ¡Ïî¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ perl -I/usr/lib/perl5/site_perl/5.004/i386-linux-thread ./example.pl
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

¡­¡­ÄãµÄ perl ÒÑÔÚ´æÈ¡ PostgreSQL ×ÊÁÏ¿â£¡£¡

ÒªÊ¹ÓÃ perl ½éÃæ£¬Çë²ÎÔÄ example.pl µµ¡£


\subsection{²âÊÔ libpq, libpq++ ½éÃæ \label{Testing libpq}}

°²×° examples Ì×¼þ£¬Çë²ÎÔÄ \ref{Examples RPM} {(Àý×Ó RPM)}£¬Ö®áá¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
root# chown -R postgres.postgres /var/lib/pgsql/examples
bash$ cd /var/lib/pgsql/examples/libpq
bash$ gcc testlibpq.c -I/usr/include/pgsql -lpq
bash$ export PATH=$PATH:.
bash$ a.out

bash$ cd /var/lib/pgsql/examples/libpq++
bash$ g++ testlibpq0.cc -I/usr/include/pgsql -I/usr/include/pgsql/libpq++
-lpq++ -lpq -lcrypt
bash$ ./a.out £¨×¢Òâ¡Ã²»ÐëÀí»á´íÎóÑ¶Ï¢¡õÈçÏÂ£©
> create table foo (aa int, bb char(4));
No tuples returned...
status = 1
Error returned: fe_setauthsvc: invalid name: , ignoring...
> insert into foo values ('4535', 'vasu');
No tuples returned...
status = 1
Error returned: fe_setauthsvc: invalid name: , ignoring...
> select * from foo;
aa   |bb   |
-----|-----|
4535 |vasu |
Query returned 1 row.
>
>CTRL+D
bash$
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

¡­¡­ÄãÖ±½ÓÓÃ C/C++ ½éÃæÀ´´æÈ¡ PostgreSQL ×ÊÁÏ¿â£¡£¡


\subsection{²âÊÔ Java ½éÃæ \label{Testing Java}}

°²×° examples Ì×¼þ£¬Çë²ÎÔÄ \ref{Examples RPM} {(Àý×Ó RPM)} 
ºÍ°²×°ÒÔÏÂ¶«Î÷¡£
\begin{itemize}
\item  ´Ó \nameurl{ftp://ftp.redhat.com/pub/contrib/i386}{} »ò 
\nameurl{http://www.blackdown.org}{} È¡µÃ JDK jdk-*glibc*.rpm 
\item  ´Ó \nameurl{ftp://ftp.redhat.com/pub/contrib/i386}{} È¡µÃ 
postgresql-jdbc-*.rpm
\end{itemize}

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
root# chown -R postgres.postgres /var/lib/pgsql/examples
bash$ cd /var/lib/pgsql/examples/jdbc
bash$ echo $CLASSPATH
 --> Ó¦ÏÔÊ¾ CLASSPATH=/usr/lib/pgsql/jdbc7.0-1.2.jar:.:/home/java/jdk1.2.2/lib:/usr/lib/pgsql:/usr/lib/pgsql/classes.zip:/usr/lib/pgsql/pg.jar

¶ø jdbc*.jar µÄ°æ±¾ºÅÂëÒªÕýÈ·¡£
*.jar µµÒª·ÅÔÚ /usr/lib/pgsql ºÍ  /usr/libjdk*/lib Ä¿Â¼ÖÐ¡£

bash$ export CLASSPATH=/usr/lib/pgsql/jdbc7.0-1.2.jar:.:/home/java/jdk1.2.2/lib:/usr/lib/pgsql:/usr/lib/pgsql/classes.zip:/usr/lib/pgsql/pg.jar

±à¼­ËùÓÐ psql.java µµ£¬°Ñ¡®package¡¯µÄÐÐ±äÎªÆÀÂÛ¡£
bash$ javac psql.java
bash$ java psql jdbc:postgresql:template1 postgres < password >[1] select * from pg_tables;
tablename       tableowner      hasindexes      hasrules
pg_type postgres        true    false   false
pg_attribute    postgres        true    false   false
[2]
CTRL+C
bash$
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

¡­¡­ÄãÖ±½ÓÓÃ Java ½éÃæÀ´´æÈ¡ PostgreSQL ×ÊÁÏ¿â£¡


\subsection{²âÊÔ ecpg ½éÃæ \label{Testing ecpg}}

°²×° examples Ì×¼þ£¬Çë²ÎÔÄ \ref{Examples RPM} {(Àý×Ó RPM)}£¬Ö®áá¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
root# chown -R postgres.postgres /var/lib/pgsql/examples
bash$ cd /var/lib/pgsql/examples/ecpg
bash$ ecpg test1.pgc -I/usr/include/pgsql
bash$ cc test1.c -I/usr/include/pgsql -lecpg -lpq -lcrypt
bash$ createdb mm
bash$ ./a.out
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

¡­¡­ÄãÖ±½ÓÓÃÇ¶ÈëÊ½ SQL À´´æÈ¡ PostgreSQL ×ÊÁÏ¿â£¡


\subsection{²âÊÔ SQL µÄÀý×Ó¡õ×Ô¶©×ÊÁÏÐÍÌ¬ºÍº¯Êý \label{Testing SQL}}

°²×° examples Ì×¼þ£¬Çë²ÎÔÄ \ref{Examples RPM} {(Àý×Ó RPM)}£¬Ö®áá¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
root# chown -R postgres.postgres /var/lib/pgsql/examples
bash$ cd /var/lib/pgsql/examples/sql
Î´Ð´ºÃ¡­
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{²âÊÔ Tcl/TK ½éÃæ}

Tck/Tk µÄÀý×ÓÊÇ pgaccess ³ÌÊ½¡£
Ê¹ÓÃÒ»¸öÎÄ×Ö±à¼­Æ÷ÔÄ¶Á /usr/bin/pgaccess µµ°¸¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ view /usr/bin/pgaccess
bash$ export DISPLAY=<ÄãµçÄÔµÄÖ÷»úÃû>:0.0
bash$ createdb mydb
bash$ pgaccess mydb
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{²âÊÔ ODBC ½éÃæ}

\begin{enumerate}
\item  ÔÚ \nameurl{http://www.insightdist.com/psqlodbc/}{} È¡µÃ win32 pgsql 
odbc Çý¶¯³ÌÊ½
\item  ÁíÍâÇë²ÎÔÄ /usr/lib/libpsqlodbc.a
\end{enumerate}



\subsection{²âÊÔ MPSQL Motif-worksheet ½éÃæ}

ÔÚ \nameurl{http://www.mutinybaysoftware.com}{} È¡µÃ RPM¡£


\subsection{È·ÈÏ}

ÒªÈ·ÈÏ PostgreSQL µÄ¸ßÆ·ÖÊ£¬Ö´ÐÐ Regression ²âÊÔÌ×¼þ¡Ã
ÒÔ root Éí·ÝÇ©Èë
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# rpm -i postgresql*test.rpm
ÔÄ¶Á README µµ»ò°²×°Ô´³ÌÊ½£¬ËüÒÑÓÐ regress Ä¿Â¼
# rpm -i postgresql*.src.rpm
# cd /usr/src/redhat/SPECS
# more postgresql*.spec £¨ÒÔ²ì¿´ÐèÒª°²×°ÄÄÐ© RPM Ì×¼þ£©
# rpm -bp postgresql*.spec £¨¡­ÕâÑù»á×¼±¸¸ÃÌ×¼þ£©

Regression ²âÊÔÐèÒª Makefiles ºÍÀàËÆ *fmgr*.h µÄ±êÍ·µµ£¬¿ÉÓÃÒÔÏÂÖ¸Áî
²úÉú¡õ
# rpm --short-circuit -bc postgresql*.spec £¨×ß½Ý¾¶£¡£©
¿´µ½¡®make -C common  SUBSYS.o¡¯áá°´ CTRL-C ÖÕÖ¹¹¤×÷¡£ÕâÊ±ºò configure 
ÒÑ¾­³É¹¦£¬ËùÓÐ Makefiles ºÍ±êÍ·µµÒ²ÒÑ²úÉú¡£Äã²»ÔÙÐèÒªÈÃËü¼ÌÐøÏÂÈ¥¡£
# cd /usr/src/redhat/BUILD
# chown -R postgres postgresql*
# su - postgres
bash$ cd /usr/src/redhat/BUILD/postgresql-6.5.3/src/test/regress
bash$ more README
bash$ make clean; make all runtest
bash$ more regress.out
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{½ô¼±³ý´í}

ÓÐÊ±³ý´íÇ¶²¹»áÔÚÖ÷ÒªµÄÍÆ³ö PostgreSQL 
µÄÖ÷Òª°æ±¾Ö®áá³öÏÖ¡£Äã¿ÉÒÀ¾Ý×Ô¼ºÐèÒª£¬×ÔÐÐ½øÐÐÐÞ²¹¡£Çë¸ú´ÓÒÔÏÂ²½Öè¡Ã
µ½ postgresql ³ÌÊ½ÂëµÄÄ¿Â¼
\begin{tscreen}
\begin{verbatim}
                # rpm -i postgresql*.src.rpm
                # cd /usr/src/postgresql6.5.3
                # man patch
                # patch -p0 < patchfile
                # make clean
                # make
\end{verbatim}
\end{tscreen}

Ç¶²¹µµÊÇÔÚ
\begin{itemize}
\item PostgreSQL Ç¶²¹¡Ã\nameurl{ftp://ftp.postgresql.org/pub/patches}{}
\end{itemize}



\section{¿ìËÙ¿ªÊ¼Ö¸Òý}

Çë²Î¿¼\ref{Quick-Installation} {(¿ìËÙ°²×°Ö¸Òý)}Ò»ÕÂ¡£


\subsection{×ÊÁÏ¿â½¨Á¢¡¢¶ªÆú¡¢¸ÄÃû}

Äã¿ÉÊ¹ÓÃÊ¹ÓÃÕßÓÑÉÆµÄ
GUI£¬ÃûÎª¡®pgaccess¡¯À´½¨Á¢ºÍ¶ªÆú×ÊÁÏ¿â£¬Ò²¿ÉÓÃÖ¸ÁîÁÐ¡®psql¡¯¹¤¾ß¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
ÈçÄãÒÔ root Éí·ÝµÇÈë£¬±äÉíÎªÓÃÕß¡®postgres¡¯¡Ã
# xhost + £¨ÈÃ pgaccess Ê¹ÓÃÏÔÊ¾×°ÖÃ£©
# su - postgres
bash$ man createdb
bash$ createdb mydatabase
bash$ man psql
bash$ psql mydatabase
¡­ÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s

bash$ export DISPLAY=<Ö÷»úÃû>:0.0
bash$ man pgaccess
bash$ pgaccess mydatabase
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÄãÏÖÔÚ¿ÉÒÔÔÚ psql »ò pgaccess {\bfseries ¸ßËÙÏÂ´ï} SQL Ö¸Áî¡£



Òª¶ªÆú×ÊÁÏ¿âµÄ»°¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man dropdb
bash$ man destroydb  £¨ÔÚ½Ï¾É°æ±¾µÄ pgsql ÖÐÊ¹ÓÃ£© 
bash$ dropdb <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

Ò²¿ÉÒÔÔÚÒ»¸ö SQL Á¬½ÓÆÚ¼äÓÃÒÔÏÂÖ¸ÁîÏûÃðÒ»¸ö×ÊÁÏ¿â¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
> drop database <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

Òª¸ü¸Ä×ÊÁÏ¿âÃû³Æ£¬Çë²ÎÔÄ\ref{backup_restore} {(±¸·ÝºÍ»¹Ô­)}Ò»½Ú


\subsection{½¨Á¢ºÍ¶ªÆúÓÃ»§}

Òª½¨Á¢ÐÂÓÃ»§£¬ÒÔ unix ÓÃ»§¡®postres¡¯Ç©Èë£¬Äã¿ÉÓÃ¼òµ¥Ò×ÓÃµÄ GUI
¹¤¾ß¡®pgaccess¡¯À´Ôö¼õÓÃ»§¡£ 
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man pgaccess
bash$ pgaccess <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

»÷Ñ¡¡°Users¡±tab£¬ÔÙ»÷Ñ¡ Object$|$New »ò Object$|$Delete

ÄãÒ²¿ÉÓÃÖ¸ÁîÐÐÃüÁî¸å (script)¡£ÃûÎª¡®createuser¡¯µÄÃüÁî¸åÆô¶¯ psql¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man createuser
bash$ createuser <ÓÃ»§Ãû³Æ>
bash$ createuser -h host -p port -i userid <ÓÃ»§Ãû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


Òª¶ªÆúÒ»¸ö postgres ÓÃ»§£¬Ê¹ÓÃÃüÁî¸å¡®destroyuser¡¯¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man dropuser
bash$ man destroyuser £¨ÔÚ½Ï¾É°æ±¾µÄ pgsql ÖÐÊ¹ÓÃ£© 
bash$ destroyuser
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{½¨Á¢ºÍ¶ªÆúÈº×é}

Ä¿Ç°Ã»ÓÐ¼òµ¥µÄ½éÃæ¿ÉÓÃÀ´Éè¶¨ÓÃ»§Èº×é¡£ÄãÒª×ÔÐÐÔÚ {\bfseries pg\_group}
±í¸ñÖÐ²åÈë»ò¸üÐÂ¼ÍÂ¼¡£Èç¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ su - postgres
bash$ psql <×ÊÁÏ¿âÃû³Æ>
¡­ÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s

psql=> insert into pg_group (groname, grosysid, grolist)
psql=> values ('posthackers', '1234', '{5443, 8261}' );
INSERT 58224
psql=> grant insert on foo to group posthackers;
CHANGE
psql=>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

{\bfseries pg\_group} ÖÐµÄÀ¸Î»Îª¡Ã
{\bfseries groname} Èº×éÃû³Æ¡£ÕâÃû³Æ±ØÐëÈ«Îª×ÖÄ¸»òÊý×Ö£¬²»¿ÉÓÐµ×Ïß»ò±êµã·ûºÅ¡£

{\bfseries grosysid} Èº×é´úÂë¡£ÕâÊÇÒ»¸ö int4£¬Ã¿¸öÈº×é¶¼Òª¶ÀÒ»ÎÞ¶þ¡£

{\bfseries grolist} Êôì¶´ËÈº×éµÄ {\bfseries pg\_user} ´úÂëÃûµ¥¡£ÊÇÒ»¸ö int4{[}]¡£

ÒªÉ¾³ýÈº×é¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ su - postgres
bash$ psql <×ÊÁÏ¿âÃû³Æ>
¡­ÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s


psql=> delete from pg_group where groname = 'posthackers';
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{½¨Á¢¡¢±à¼­ºÍ¶ªÆú±í¸ñ}

Äã¿ÉÊ¹ÓÃÊ¹ÓÃÕßÓÑÉÆµÄ
GUI£¬ÃûÎª¡®pgaccess¡¯£¬»òÖ¸ÁîÁÐ¡®psql¡¯¹¤¾ßÀ´½¨Á¢¡¢±à¼­ºÍ¶ªÆú×ÊÁÏ¿â±í¸ñ¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man pgaccess
bash$ pgaccess <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

»÷Ñ¡ Table $|$ New $|$ Design °´Å¥¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man psql
bash$ psql <×ÊÁÏ¿âÃû³Æ>
¡­ÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÔÚ psql ÌáÊ¾ÏÂ£¬¼üÈë±ê×¼µÄ SQL Ö¸Áî£¬Èç¡®create table¡¯¡¢¡®alter
table¡¯»ò¡®drop table¡¯À´´¦Àí±í¸ñ¡£


\subsection{½¨Á¢¡¢±à¼­ºÍ¶ªÆú±í¸ñÖÐµÄ¼ÍÂ¼}



Äã¿ÉÊ¹ÓÃÊ¹ÓÃÕßÓÑÉÆµÄ
GUI£¬ÃûÎª¡®pgaccess¡¯£¬»òÖ¸ÁîÁÐ¡®psql¡¯¹¤¾ßÀ´½¨Á¢¡¢
±à¼­ºÍ¶ªÆú×ÊÁÏ¿â±í¸ñÖÐµÄ¼ÍÂ¼¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man pgaccess
bash$ pgaccess <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

»÷Ñ¡ Table $|$ $<$ Ñ¡Ò»¸ö±í¸ñ $>$ $|$ Open °´Å¥¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man psql
bash$ psql <×ÊÁÏ¿âÃû³Æ>
¡­ÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÔÚ psql ÌáÊ¾ÏÂ£¬¼üÈë±ê×¼µÄ SQL Ö¸Áî£¬Èç¡®insert into table\_name¡¯¡¢¡®update
table\_name¡¯»ò¡®delete from table\_name¡¯À´´¦Àí±í¸ñ¡£


\subsection{¸Ä±äÄ¿Ç°µÄ×ÊÁÏ¿â}

Äã¿ÉÊ¹ÓÃÊ¹ÓÃÕßÓÑÉÆµÄ
GUI£¬ÃûÎª¡®pgaccess¡¯£¬»òÖ¸ÁîÁÐ¡®psql¡¯¹¤¾ßÀ´¸Ä±äÄ¿Ç°µÄ×ÊÁÏ¿â¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man pgaccess
bash$ pgaccess <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

»÷Ñ¡ Database $|$ Open °´Å¥¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man psql
bash$ psql <×ÊÁÏ¿âÃû³Æ>
¡­ÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s

psql=> connect <×ÊÁÏ¿âÃû³Æ> <user>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{±¸·ÝÓë»¹Ô­×ÊÁÏ¿â \label{backup_restore}}

PostgreSQL Ìá¹©ÁËÁ½¸ö¹¤¾ßÀ´±¸·ÝÄãµÄÏµÍ³¡Ã{\bfseries pg\_dump} 
±¸·ÝÒ»¸ö×ÊÁÏ¿â£¬{\bfseries pg\_dumpall} Ò»´Î¹ý±¸·ÝËùÓÐ×ÊÁÏ¿â¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ su - postgres
bash$ man pd_dump
bash$ pd_dump <×ÊÁÏ¿âÃû³Æ> > database_name.pgdump
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

»¹Ô­Ôò¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ cat database_name.pgdump | psql <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

Õâ¼¼¿¼¿ÉÓÃì¶°áÒÆ×ÊÁÏ¿â»òÎª×ÊÁÏ¿â¸ÄÃû¡£

{\bfseries ¾¯¸æ¡Ã}Ã¿¸ö×ÊÁÏ¿â¶¼Òª¶¨Ê±±¸·Ý¡£ÒòÎª PostgreSQL
×ÔÐÐ¹ÜÀíËüÔÚµµ°¸ÏµÍ³ÖÐµÄµµ°¸£¬ËùÒÔ²»ÒªÒÐÀµÏµÍ³±¸·ÝÀ´×÷×ÊÁÏ¿â±¸·Ý¡£
Ã»ÓÐÈËÄÜ±£Ö¤ÄÇÐ©µµ°¸ÔÚ»¹Ô­áá»á´¦ì¶Ò»¸ö¿ÉÓÃ¶øÒ»ÖÂµÄ×´Ì¬¡£

{\bfseries ±¸·Ý´óÐÍ×ÊÁÏ¿â¡Ã}ÒòÎª PostreSQL
ÈÝÐí±í¸ñ´ó¹ýÏµÍ³µÄ×î´óµµ°¸ÈÝÁ¿£¬°ÑÒ»¸ö±í¸ñÊä³öÎªÒ»¸öµµ°¸»áÓÐÎÊÌâ£¬
ÒòÎªËù²úÉúµÄµµ°¸¿ÉÄÜ»á³¬³öÏµÍ³µÄÏÞÖÆ¡£ÒòÎª {\bfseries pg\_dump} »áÐ´µ½ 
{\bfseries stdout}£¬Äã¿ÉÊ¹ÓÃ±ê×¼µÄ unix ¹¤¾ßÀ´½â¾öÕâ¿ÉÄÜµÄÎÊÌâ¡Ã

Ê¹ÓÃÑ¹ËõÁËµÄÊä³ö¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ pg_dump <×ÊÁÏ¿âÃû³Æ> | gzip > filename.dump.gz
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÓÃÒÔÏÂ·½·¨ÖØÐÂÔØÈë¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ createdb <×ÊÁÏ¿âÃû³Æ>
bash$ gunzip -c filename.dump.gz | psql <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

»ò
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ cat filename.dump.gz | gunzip | psql <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


Ê¹ÓÃ split¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ pg_dump <×ÊÁÏ¿âÃû³Æ> | split -b 1m - filename.dump.
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

×¢Òâ¡ÃÒÔÉÏÖ¸ÁîÖÐ£¬ÔÚ filename.dump ááÓÐÒ»µã (.)£¡£¡Äã¿ÉÓÃÒÔÏÂ·½·¨ÖØÐÂÔØÈë¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man createdb
bash$ createdb <×ÊÁÏ¿âÃû³Æ>
bash$ cat filename.dump.* | pgsql <×ÊÁÏ¿âÃû³Æ>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

µ±È»£¬µµ°¸Ãû³Æ£¨filename£©ºÍ {\bfseries pg\_dump}
Êä³öµÄÄÚÈÝÎÞÐèºÍ×ÊÁÏ¿âÃû³ÆÅäºÏ¡£´ËÍâ£¬»¹Ô­ÁËµÄ×ÊÁÏ¿â¿ÉÓÐÈÎºÎÐÂÃû¡£
Òò´ËÕâ·½·¨ÊÊÓÃì¶Îª×ÊÁÏ¿â¸ÄÃû¡£

Òª°ÑËùÓÐ PostgreSQL Êä³ö£¬Ê¹ÓÃ {\bfseries pg\_dumpall}
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man pg_dumpall
bash$ pg_dumpall -o > db.out
ÒªÖØÐÂÔØÈë¡Ã
bash$ psql -e template1 < db.out
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{×ÊÁÏ¿â±£°²}

Çë²ÎÔÄ\ref{security} {(PostgreSQL ±£°²)}Ò»½Ú¡£




\subsection{ÏßÉÏÇóÖú}

Äã±ØÐëÖªµÀ PostgreSQL
µÄÏßÉÏÇóÖúÉèÊ©£¬ÒòÎªËü»áÎªÄã½ÚÊ¡ºÜ¶àÊ±¼ä£¬ÈÃÄã¿ìËÙÈ¡µÃ×ÊÁÏ¡£

Çë²ÎÔÄ²»Í¬Ö¸Áî£¬Èç createdb¡¢createuser µÈµÈµÄÏßÉÏ  man pages¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man createdb
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


Ò²Çë²ÎÔÄ psql µÄÏßÉÏÇóÖúÑ¶Ï¢£¬ÔÚ psql ÌáÊ¾¼üÈë $\backslash$h
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ psql mydatabase
psql> \h
ÌáÊ¾¡ÃÔÚ psql °´ÉÏ / ÏÂ¼ý¾×À´±à¼­ÀúÊ·¼ÍÂ¼»òÓÃ \s
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{½¨Á¢¼¤·¢ (Triggers) ºÍÄÚ´¢³ÌÐò (Stored Procedures)}

Òª½¨Á¢¼¤·¢»òÄÚ´¢³ÌÐò£¬ÏÈÔÚÄãÊ¹ÓÃµÄ×ÊÁÏ¿âÖ´ÐÐ¡®createlang¡¯ÃüÁî¸åÀ´°²×°
¡®plpgsql¡¯¡£Èç¹ûÄãÏëÔ¤ÉèÊ¹ÓÃËü£¬°ÑËü°²×°ÔÚ¡®template1¡¯£¬
ÒòÎªÒÔáá½¨Á¢µÄ×ÊÁÏ¿â¶¼ÊÇ template1 µÄ·Â×°Æ·¡£²ÎÔÄ¡®createlang¡¯ÍøÒ³»òÎ»ì¶ 
/usr/doc/postgresql-7.0.2/user/index.html µÄ User Guide¡£

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man createlang
bash$ createdb mydb
bash$ export PGLIB=/usr/lib/pgsql
bash$ createlang plpgsql mydb
bash$ createlang plpgsql template1
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

Ò²Çë²Î¿¼ \ref{Examples RPM} {(Àý×Ó RPM)} 
ÖÐ¼¤·¢ºÍÄÚ´¢³ÌÐòµÄÀý×Ó¡£Examples RPM ÖÐµÄÆäÖÐÒ»¸öÀý×Ó¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
create function tg_pfield_au() returns opaque as '
begin
    if new.name != old.name then
        update PSlot set pfname = new.name where pfname = old.name;
    end if;
    return new;
end;
' language 'plpgsql';

create trigger tg_pfield_au after update
    on PField for each row execute procedure tg_pfield_au();
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÁíÒ»¸ö¼¤·¢³ÌÊ½ÂëÀý×Ó¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
create trigger check_fkeys_pkey_exist
        before insert or update on fkeys
        for each row
        execute procedure
        check_primary_key ('fkey1', 'fkey2', 'pkeys', 'pkey1', 'pkey2');
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

Äã±ØÐë°²×° TEST Ì×¼þ¡õ postgresql-test-7.0.2-2.rpm ºÍÔÄ¶ÁÔÚ 
/usr/lib/pgsql/test/regress/sql ÖÐµÄ SQL ÃüÁî¸åÀý×Ó¡£

ÒªÏÔÊ¾×ÊÁÏ¿âÖÐ¼¤·¢µÄÃûµ¥¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ psql mydb
psql=> \?
psql=> \dS
psql=> \d pg_trigger
psql=> select tgname from pg_trigger order by tgname;
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ÒªÏÔÊ¾×ÊÁÏ¿âÖÐº¯ÊýºÍÄÚ´¢³ÌÐòµÄÃûµ¥¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ psql mydb
psql=> \?
psql=> \dS
psql=> \d pg_proc
psql=> select proname, prosrc from pg_proc order by proname;
psql=> \df
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{PostgreSQL ÎÄ¼þ}

ÓÐ¹ØÆäËûÎÊÌâ£¬Çë²ÎÔÄ PostgreSQL µÄËµÃ÷Êé£¬ËüÃÇµÄ×ÊÁÏÊ®·ÖÈ«Ãæ¡£PostgreSQL
ÎÄ¼þÒÑÔÚÌ×¼þÖÐ¡£ÇëÔÄ¶Á¡®User's Guide¡¯¡¢¡®Programmer's
Guide¡¯¡¢¡®Administrator's Guide¡¯ºÍÆäËûËµÃ÷Êé¡£


\section{PostgreSQL Ö§Ô®³¬¹ý 200 Gig µÄ³¬¼¶×ÊÁÏ¿â}

ÔçÒÑÓÐºÜ¶à´ó¹«Ë¾½« PostgreSQL ÓÃì¶´óÐÍµÄ×ÊÁÏ¿â¡£ÔÚ´ËÌá¹©ÒÔÏÂ¼¼¿¼¡Ã


\subsection{ÖÐÑë´¦ÀíÆ÷ÖÖÀà¡õ32 Î»Ôª»ò 64 Î»Ôª}

32 Î»Ôª´¦ÀíÆ÷µÄµçÄÔÔÚ×ÊÁÏ¿â³¬¹ý 5 GigaByte Ê±±íÏÖ»áÑ¸ËÙÏÂ½µ¡£Äã¿ÉÓÃ 32 
Î»Ôª´¦ÀíÆ÷Ö´ÐÐ 30 gig µÄ×ÊÁÏ¿â£¬µ«±íÏÖ»áÏÂ½µ¡£32 Î»Ôª»úÆ÷ÊÜµ½×î¶à 2 GB 
¼ÇÒäÌå¡¢2 GB µµ°¸ÏµÍ³¼°²Ù×÷ÏµÍ³ÆäËû·½ÃæµÄÏÞÖÆ¡£Ê¹ÓÃ SGI¡¢IBM¡¢»ò HP Îª Linux 
ÌØÖÆµÄµµ°¸ÏµÍ³»ò ext3-fs À´ÔÚ 32 Î»Ôª»úÆ÷ÉÏÖ§Ô®´ó¹ý 2 GB µÄµµ°¸´óÐ¡¡£

¶Ô¼«´óÐÍµÄ×ÊÁÏ¿âÀ´Ëµ£¬ÎÒÇ¿ÁÒ½¨ÒéÄãÊ¹ÓÃ 64 Î»Ôª´¦ÀíÆ÷£¬Èç Digital Alpha¡¢Sun 
Ultra-sparc 64 Î»Ôª´¦ÀíÆ÷¡¢SGI 64 Î»Ôª´¦ÀíÆ÷¡¢Intel Mercel IA-64 ´¦ÀíÆ÷¡¢HPUX 
64 Î»ÔªµçÄÔ¡¢IBM 64 Î»ÔªµçÄÔ¡£Ê¹ÓÃ 64 Î»ÔªµÄ´¦ÀíÆ÷À´±àÒë 
PostgreSQL£¬Ëü¾Í¿ÉÒÔ´¦Àí´óÐÍµÄ×ÊÁÏ¿â¼°²éÑ¯¡£²éÑ¯´óÐÍ±í¸ñºÍ×ÊÁÏ¿âµÄËÙ¶È»á±È 32 
Î»ÔªµÄµçÄÔ¿ìÊý±¶¡£64 Î»ÔªµçÄÔµÄÓÅµãÊÇÄãÓÐºÜ´óµÄ¼ÇÒäÎ»Ö· (memory addressing 
space) ºÍ²Ù×÷ÏµÍ³¿É´¦ÀíºÜ´óµÄµµ°¸ÏµÍ³¡¢Îª´óÐÍ×ÊÁÏ¿âÌá¹©½Ï¼Ñ±íÏÖ¡¢
Ö§Ô®¸ü¶à¼ÇÒäÌå¡¢ÄÜÁ¦¸üÇ¿¡­¡­

£¨Òë°´¡Ã2.4 µÄ Linux ºËÐÄÒÑÍ»ÆÆ 2 GB µµ°¸´óÐ¡µÄÏÞÖÆ£¬²¢Ö§Ô®×î¶à 64 GB
¼ÇÒäÌå¡££©


\subsection{¶à´¦ÀíÆ÷}

ÒªÊ¹ÓÃ´óÐÍµÄ×ÊÁÏÁÏ£¬Äã×îºÃÊ¹ÓÃÄÚÓÐ 4¡¢16 »ò 32 â·´¦ÀíÆ÷µÄ SMP
µçÄÔ¡£ÁíÒ»·½Ãæ£¬ÄãÒ²¿ÉÊ¹ÓÃ 4 ÖÁ 5 ²¿µ¥´¦ÀíÆ÷µçÄÔ£¬¶ø°ÑÄãµÄ×ÊÁÏ¿â·Ö¸î
(partition) Îª 4 ÖÁ 5 ¸ö·Ö¿ªµÄ×ÊÁÏ¿â£¬Ã¿¸öÔÚÒ»²¿µçÄÔÔËÐÐ¡£Ã¿¸ö´¦ÀíÆ÷¶¼ÒÔ¸ßËÙ
£¨100MBits£©µÄÒÒÒÔÌ«ÍøÂç¿¨Á¬½Ó¡£ÀýÈç£¬ÄãµÄ×ÊÁÏ¿âÖÐÓÐ¶þ°Ù¸ö±í¸ñ£¬
Äã¿É°ÑËüÃÇ·ÖÎªËÄ¸ö×ÊÁÏ¿â£¬Ã¿¸öÓÐÎåÊ®¸ö±í¸ñ¡£ÕâÑù£¬Äã°Ñ¹¤×÷Æ½¾ù·ÖÅä¸ø
4 ²¿·Ö¿ªµÄµçÄÔ¡£ÕâÊÇÒ»¸ö±ÈËÄ´¦ÀíÆ÷µçÄÔ±ãÒËµÄ·½°¸¡£
Äã¿ÉÊ¹ÓÃ{\bfseries ¡®¿ç×ÊÁÏ¿âµÄ²éÑ¯¡¯}¡¢ÔÚÇøÓòÍøÂçÊ¹ÓÃ NFS¡¢ÎªÎ¨¶Á±í¸ñ¡®CREATE 
VIEW¡¯À´Íê³ÉÕâ¹¤×÷¡£Ã¿¸ö´¦ÀíÆ÷¶¼¿É¡¸¼ûµ½¡¹ËùÓÐ×ÊÁÏ¿â£¬¼´È«²¿ 200 
¸ö±í¸ñ¡£ÔÚÎ´À´£¬PostgreSQL »áÖ§Ô®{\bfseries ¡®¿ç×ÊÁÏ¿âµÄ²éÑ¯¡¯}£¨ÒÑ¾­ÔÚ TODO 
Ãûµ¥£©£¬ÔÚ½«ÍÆ³öµÄ 7.1 °æ³öÏÖ¡£ÀýÈç£¬Ê¹ÓÃ´úºÅ a¡¢b 
×÷±í¸ñÃû³Æ×÷µÄ¿ç×ÊÁÏ¿â²éÑ¯»áÀàËÆ¡õ¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
select a.col1, a.col2, b.col4, b.col7
from
    database1.my_tablea a, database2.my_tableb b
where
    a.col1 = b.col3 and
    a.col4 = b.col9;

update my_tablea
set
    col1 =  b.col2
from
    database1.my_tablea a, database2.my_tableb b
where
    a.col4 = b.col9;
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{¸´ÖÆ (Replication) ËÅ·þÆ÷}

Îª´óÐÍÆóÒµ/ÉÌÒµ¹«Ë¾¶øÉèµÄ¸´ÖÆËÅ·þÆ÷ÓÉ PostgreSQL Inc
×÷ÉÌÒµ··Âô¡£Äã¿ÉÊ¹ÓÃ¸´ÖÆËÅ·þÆ÷À´Ìá¹©ÖØ¸²µÄ×ÊÁÏ¼°¸ß¶È¿ÉµÃÐÔ
(availability)¡£¸´ÖÆËÅ·þÆ÷ÊÇÒ»¼þ¸´ÔÓ¡¢ÏÈ½øµÄ²úÆ·£¬Òò´ËÐèÒª½ðÇ®¡£


\section{Æ¾Ê²÷áÏàÐÅ PostgreSQL£¿Regression ²âÊÔÌ×¼þÎªÓÃ»§½¨Á¢ÐÅÐÄ}

ÓÐÀµ{\itshape ¡¸ÎïÀíÑ§¶¨ÂÉ¡¹\/}£¬ÎÒÃÇ¿ÉÒÔ{\bfseries ¿ÆÑ§µØ}¼ìÖ¤ PostgreSQL 
ÊÇ·ñÕæµÄÒÀ´Ó ISO/ANSI SQL ¹æ¸ñ¹¤×÷¡£Îª·½±ã²âÊÔ PostgreSQL£¬Regression 
²âÊÔÌ×¼þ£¨src/test/regress£©ÒÑ°üº¬ÔÚ·¢ÐÐ°æ±¾ (distribution) ÖÐ£¬
ËüÈÝÐíÄãµÄµçÄÔ¼ìÖ¤±ê×¼µÄ SQL ²Ù×÷¼° PostgreSQL µÄÑÓÉìÄÜÁ¦¡£
²âÊÔÌ×¼þÖÐÒÑ°üº¬ÁËÊý°Ù¸ö SQL ²âÊÔ³ÌÊ½¡£

ÄãÓ¦ÓÃµçÄÔµÄ¸ßËÙÀ´ÑéÖ¤ PostgreSQL£¬¶ø²»ÊÇÓÃÈËÄÔ¡£
µçÄÔ¿ÉÒÔÈËÄÔÇ§Íò±¶ÉõÖÁÊýÒÔÒÚ±¶µÄËÙ¶ÈÀ´½øÐÐ Regression 
²âÊÔ¡£ÏÖ´úµçÄÔ¿ÉÔÚºÜ¶ÌÊ±¼äÄÚÖ´ÐÐÊýÊ®ÒÚ¸ö SQL 
²âÊÔ¡£ÔÚ²»¾Ã½«À´£¬µçÄÔ»á±ÈÈËÄÔ¿ìÊýÒÔÕ×±¶¡£Òò´Ë£¬
Ê¹ÓÃµçÄÔÀ´²âÊÔµçÄÔµÄ±íÏÖÊÇºÏÀíµÄ¡£

ÈçÓÐÐèÒª£¬ÄãÒ²¿É×ÔÐÐÔö¼Ó²âÊÔ¡£Èç¹ûÄãÈÏÎªËü»á¶ÔÆäÄã»¥ÁªÍøÓÃ¼ÒÓÐ°ïÖú£¬
ÄãÒ²¿É°ÑËüÉÏÔØµ½ PostgreSQL µÄÖ÷ÍøÕ¾¡£Regression ²âÊÔÌ×¼þ°ïÖúÓÃ»§½¨Á¢¶Ô 
PostgreSQL µÄÐÅÐÄ¼°ÐÅÈÎ£¬ËüÒ²°ïÖúÉú²úÏµÍ³Ñ¸ËÙÉèÁ¢ PostgreSQL¡£

Regression ²âÊÔÌ×¼þ¿É±»ÊÓÎª¿ª·¢ÈËÔ±Óë×îÖÕÓÃ»§¼äÏà»¥Í¬ÒâµÄÒ»·Ý{\bfseries ¡°·Ç³£ÓÐÁ¦¡±}µÄ¼¼ÊõÎÄ¼þ¡£PostgreSQL ÔÚ¿ª·¢¹ý³Ì¼°ÍÆ³öÈí¼þÖ®Ç°¹ã·ºÊ¹ÓÃ Regression 
²âÊÔÌ×¼þÀ´±£Ö¤ÖÊËØ¡£

PostgreSQL µÄÄÜÁ¦¿É¼® Regression ²âÊÔÌ×¼þÖ±½Ó·´Ó³³öÀ´¡£Èç¹ûÒ»ÖÖ¹¦ÄÜ¡¢
Óï·¨»òÌØÐÔÔÚ Regression ²âÊÔÖÐ´æÔÚ£¬Ëü¾Í±»Ö§Ô®£¬ËùÓÐÆäËûÃ»ÓÐÁÐ³öµÄ PostgreSQL 
¾Í¿ÉÄÜ²»Ö§Ô®£¡£¡Äã¿ÉÒÔ×ÔÐÐÑéÖ¤¼°¼ÓÈë Regression ²âÊÔÌ×¼þÖÐ¡£




\section{×ÊÁÏ¿â±£°² \label{security}}

×ÊÁÏ¿â±£°²ÎÊÌâÐèÔÚ¶à¸ö²»Í¬²ãÃæÌ½ÌÖ¡Ã
\begin{itemize}
\item  ×ÊÁÏ¿âµµ°¸±£»¤¡£×ÊÁÏ¿âµÄËùÓÐµµ°¸¶¼²»»´ {\itshape postgres\/}
³¬¼¶ÓÃ»§ÒÔÍâµÄÓÃ»§¶ÁÈ¡¡£
\item  ¾ÝÔ¤ÉèÖµ£¬´ÓÓÃ»§Á¬½Óµ½×ÊÁÏ¿âËÅ·þÆ÷Ö»ÄÜÍ¸¹ý±¾»úµÄ UNIX ²å×ù
(socket)£¬²»ÊÇ TCP/IP ²å×ù¡£ËÅ·þÆ÷ÐèÒÔ -i Ñ¡ÏîÆô¶¯²ÅÄÜÈÝÐí·Ç±¾»ú¿Í»§Á¬½Ó¡£
\item  ¿Í»§Á¬½Ó¿ÉÒÔ IP µØÖ·ºÍ / »òÓÃÕßÃû³Æ¼ÓÒÔÏÞÖÆ£¬Ö»ÐèÐÞ¸Ä {\bfseries \$PG\_DATA}
ÖÐµÄ {\bfseries pg\_hba.conf} µµ¡£
\item  ¿É¼®Íâ²¿Ì×¼þÈÏÖ¤¿Í»§Á¬½Ó¡£
\item  Ã¿Î» Postgres ÓÃ»§¶¼ÓÐÒ»¸öÊ¹ÓÃÕßÃû³ÆºÍÑ¡ÔñÐÔµØÓµÓÐÒ»¸öÃÜÂë¡£
Ô¤ÉèÖµÊÇÓÃ»§Ã»ÓÐÈ¨ÏÞÐ´Èë²»ÊÇ×Ô¼º½¨Á¢µÄ×ÊÁÏ¿â¡£
\item  ÓÃ»§¿É±»±àÅäµ½Èº×éÖÐ£¬ÄÜ·ñ´æÈ¡Ò»¸ö±í¸ñ¿ÉÒÔÈº×éÌØÈ¨À´ÏÞÖÆ¡£ 
\end{itemize}



\subsection{ÓÃ»§ÈÏÖ¤}

ÈÏÖ¤ÊÇáá¶ËËÅ·þÆ÷ºÍ postmaster È·±£ÒªÇó´æÈ¡×ÊÁÏµÄÓÃ»§ÊÇ·ñÈ·ÎªÆäÈËµÄ¹ý³Ì¡£ËùÓÐÆô¶¯
Postgres µÄÓÃÕß¶¼ÓëÈÏÖ¤ÊÇáá¶ËËÅ·þÆ÷ºÍ postmaster {\bfseries pg\_user}
Àà±ð±È½Ï£¬ÒÔÈ·¶¨ËûÃÇÓÐÈ¨×öÏë×öµÄ¹¤×÷¡£
¶øÓÃÕßÕæÊµÉí·ÖµÄ±æ±ð¹¤×÷ÒÔ¶à¸ö²»Í¬·½·¨Íê³É¡Ã
\begin{itemize}
\item  {\bfseries ÔÚÊ¹ÓÃÕß shell ÖÐ¡Ã} ÔÚÊ¹ÓÃÕß shell
Ö±½ÓÆô¶¯µÄáá¶ËËÅ·þÆ÷¼ÇÏÂÓÃÕßµÄ£¨ÓÐÐ§£©Ê¹ÓÃÕß´úºÅ (effective 
user-id)£¬Ö®áá×÷Ò»´Î {\bfseries setuid} À´»¯ÉíÎª {\bfseries postgres}¡£
ÓÐÐ§Ê¹ÓÃÕßÊ¶±ðºÅ»á±»ÓÃ×÷´æÈ¡¿ØÖÆµÄ»ù´¡¡£ÔÙÃ»ÓÐÆäËûÈÏÖ¤¹¤×÷¡£
\item  {\bfseries À´×ÔÍøÂç¡Ã} Èç¹û Postgres ÏµÍ³ÒÔ·ÖÉ¢Ê½ÔËÐÐ£¬ÈÎºÎÈË¶¼¿É´æÈ¡
postmaster ÐÐ³Ì (process) µÄ»¥ÁªÍø TCP ²º¡£×ÊÁÏ¿â¹ÜÀíÔ±ÐèÉè¶¨ {\bfseries \$PGDATA}
Ä¿Â¼ÖÐµÄ {\bfseries pg\_hda.conf} µµ£¬À´Ö¸¶¨²»Í¬Ö÷»úÁ¬½Ó²»Í¬×ÊÁÏ¿âÊ±ËùÓÃµÄÈÏÖ¤ÏµÍ³¡£

Çë²ÎÔÄ {\bfseries pg\_hba.conf(5)} £¨man 5 pg\_hba.conf£©
ÒÔÁË½â²»Í¬ÈÏÖ¤ÏµÍ³¡£µ±È»£¬¸ù¾ÝÖ÷»úÀ´½øÐÐÈÏÖ¤ÔÚ Unix
Ò²²»ÊÇºÁÎÞÆÆíÖ¡£ÓÐ¾öÐÄµÄÈëÇÖÕßÒ²¿ÉÒÔÎ±×°×Ô¼ºËùÓÃµÄÖ÷»ú¡£ÕâÐ©±£°²ÎÊÌâ²»ÔÚ
Postgres µÄ¿ØÖÆ¡õÎ§¡£
\end{itemize}



\subsection{ÒÀ¾ÝÖ÷»ú¿ØÖÆ´æÈ¡}

ÒÀ¾ÝÖ÷»ú¿ØÖÆ´æÈ¡¼´ PostgreSQL
ÓÃì¶¾ö¶¨Ê²÷á¿Í»§¿É´æÈ¡×ÊÁÏ¿âºÍËûÃÇÈçºÎÈ·ÈÏÉí·ÝµÄ¹ý³Ì¡£Ã¿¸ö×ÊÁÏ¿â¶¼ÓÐÒ»¸öÃûÎª
{\bfseries pg\_hba.conf} µÄµµ°¸£¬ÔÚËüµÄ {\bfseries \$PGDATA}
Ä¿Â¼ÖÐ£¬Ëü¿ØÖÆË­ÄÜ´æÈ¡×ÊÁÏ¿â¡£Ã¿¸ö´æÈ¡×ÊÁÏ¿âµÄÓÃ»§¶¼ÒªÔÚ {\bfseries pg\_hba.conf}
ÖÐÓÐÏàÓ¦µÄ¼ÍÂ¼¡£·ñÔòËùÓÐÀ´×Ô¸Ã¿Í»§µÄÁ¬½Ó¶¼»áÒÔ{\bfseries "User authemtication
failed"} ´íÎóÑ¶Ï¢±»¾Ü¡£

Çë²ÎÔÄ {\bfseries pg\_hba.conf(5)} µÄ man page£¨man 5 pg\_hba.conf£©¡£

{\bfseries pg\_hba.conf} µµµÄ»ù±¾¸ñÊ½ÊÇÒ»×é¼ÍÂ¼£¬Ò»ÐÐÒ»¸ö¡£¿ÕÐÐ»òÒÔ hash
×ÖÄ¸£¨\#£©¿ªÊ¼µÄÐÐÔò²»Àí»á¡£Ò»¸ö¼ÍÂ¼ÓÉÒ»Ð©ÓÃ¿Õ¸ñºÍ / »ò Tab ·Ö¿ªµÄÀ¸Î»×é³É¡£

´Ó¿Í»§À´µÄÁ¬½Ó¿É¾­ Unix ²å×ù»ò»¥ÁªÍø²å×ù£¨¼´ TCP/IP£©¡£À´×Ô Unix
²å×ùµÄÁ¬½ÓÓÃÒÔÏÂ¸ñÊ½µÄ¼ÇÂ¼¿ØÖÆ¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
local database authentication method
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

¶ø

{\bfseries database} Ö¸¶¨±¾¼ÍÂ¼ÓÃì¶ÄÄ¸ö×ÊÁÏ¿â¡£{\bfseries all}
´ú±íËüÊÊÓÃì¶ËùÓÐ×ÊÁÏ¿â¡£

{\bfseries authentication method} Ö¸¶¨ÓÃ»§ÔÚÊ¹ÓÃ Unix 
²å×ùÊ±ÓÃÀ´ÈÏÖ¤µÄ·½·¨¡£²»Í¬µÄ·½·¨ÈÝááÏêÊö¡£



À´×Ô»¥ÁªÍø²å×ùµÄÁ¬½ÓÓÃÒÔÏÂ¸ñÊ½µÄ¼ÇÂ¼¿ØÖÆ¡Ã

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
host database TCP/IP-address TCP/IP-mask authentication method
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


{\bfseries TCP/IP} µØÖ·»á {\itshape Âß¼­ÉÏ and'ed\/} µ½Ö¸¶¨µÄ TCP/IP ÕÖºÍ¿Í»§µÄ 
TCP/IP µØÖ·¡£ÈçÁ½ÕßÏàµÈ£¬Õâ¼ÍÂ¼»áÓÃì¶Õâ¸öÁ¬½Ó¡£Èç¹ûÒ»¸öÁ¬½Ó·ûºÏ³¬¹ýÒ»¸ö¼ÍÂ¼£¬
µµ°¸ÖÐµÄµÚÒ»¸ö¼ÍÂ¼»á±»Ê¹ÓÃ¡£²»ÂÛ TCP/IP µØÖ·»¹ÊÇ TCP/IP 
ÕÖ¶¼ÊÇÒÔ·ÖµãµÄÊ®½øÊý¸ñÊ½ (dotted decimal notation) 
±í´ï¡£Èç¹ûÒ»¸öÁ¬½ÓºÍËùÓÐ¼ÍÂ¼¶¼²»·û£¬reject ÈÏÖ¤·½·¨½«»á±»Ê¹ÓÃ¡££¨²ÎÔÄ\ref{auth_method} {(ÈÏÖ¤·½·¨)}£©


\subsection{ÈÏÖ¤·½·¨ \label{auth_method}}

Unix ºÍ TCP/IP ²å×ù¶¼Ö§Ô®ÒÔÏÂÈÏÖ¤·½·¨¡Ã
\begin{itemize}
\item  {\bfseries trust}
ÎÞÌõ¼þµØÈÝÐíÁ¬½Ó¡£
\item  {\bfseries reject}
ÎÞÌõ¼þµØ¾Ü¾øÁ¬½Ó¡£
\item  {\bfseries crypt}
ÎÊ¿Í»§¶ËÓÃÕßµÄÃÜÂë¡£Ëü»á¾­¼ÓÃÜ£¨Ê¹ÓÃ crypt(3)£©ºÍÓë pg\_shadow
±í¸ñµÄÃÜÂë±È½Ï¡£Èç¹ûÃÜÂëÏà·û£¬±ãÈÝÐíÁ¬½Ó¡£
\item  {\bfseries password}
ÎÊ¿Í»§¶ËÓÃÕßµÄÃÜÂë¡£Ëü»áÔ­×°´«ËÍºÍÓë pg\_shadow
±í¸ñµÄÃÜÂë±È½Ï¡£Èç¹ûÃÜÂëÏà·û£¬±ãÈÝÐíÁ¬½Ó¡£Ò»¸öÑ¡ÔñÐÔµÄÃÜÂëµµ¿ÉÔÚ password
¹Ø¼ü×Öáá³öÏÖ¡£ÕâÑùÃÜÂëµÄÅä¶Ô»áÓÃÕâµµ°¸£¬¶ø²»ÊÇ {\bfseries pg\_shadow} µµ°¸¡£Çë²ÎÔÄ
{\bfseries pg\_passwd}¡£
\end{itemize}


ÒÔÏÂÈÏÖ¤·½·¨Ö»ÊÜ TCP/IP ²å×ùÖ§Ô®¡Ã
\begin{itemize}
\item  {\bfseries krb4}
ÓÃ Kerberos V4 À´ÈÏÖ¤ÓÃ»§¡£
\item  {\bfseries krb5}
ÓÃ Kerberos V4 À´ÈÏÖ¤ÓÃ»§¡£
\item  {\bfseries ident}
ÓÃ¿Í»§¶ËµÄ ident ËÅ·þÆ÷À´ÈÏÖ¤ÓÃ»§£¨RFC 1413£©¡£ÔÚ {\bfseries ident}
¹Ø¼ü×Öáá»¹¿ÉÑ¡ÔñÐÔµØÖ¸Ã÷Ò»¸öÓ³Éä£¬ÈÃ ident ÓÃ»§Ãû³Æ¶ÔÓ¦µ½ Postgres
ÓÃ»§Ãû³Æ¡£¶ÔÓ¦µÄ¹ØÏµ´¢´æÔÚ {\bfseries \$PGDATA/pg\_ident.conf} µµÖÐ¡£
\end{itemize}


ÕâÀïÓÐÒ»Ð©Àý×Ó¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# ÐÅÈÎËùÓÐÀ´×Ô Unix ²å×ùµÄÁ¬½Ó¡£
local   trust
# ÐÅÈÎËùÓÐÕâ²¿µçÄÔ¾­ TCP/IP À´µÄÁ¬½Ó¡£
host    all 127.0.0.1   255.255.255.255     trust
# ÎÒÃÇÌÖÑáÕâ²¿µçÄÔ¡£
host    all 192.168.0.10    255.255.255.0       reject
# Õâ²¿µçÄÔ²»¶®¼ÓÃÜ£¬ËùÒÔÎÒÃÇÒª´¿ÎÄ×ÖµÄÃÜÂë¡£
host    all 192.168.0.3 255.255.255.0       password
# ÕâÈºµçÄÔµÄÆäËû³ÉÔ±¶¼ÒªÌá¹©¼ÓÃÜÁËµÄÃÜÂë¡£
host    all 192.168.0.0 255.255.255.0       crypt
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{´æÈ¡¿ØÖÆ}

Postgres Ìá¹©ÁËÏÞÖÆÆäËûÓÃ¼Ò´æÈ¡×Ô¼º×ÊÁÏµÄ»úÖÆ¡£
\begin{itemize}
\item  {\bfseries ×ÊÁÏ¿â³¬¼¶ÓÃ¼Ò (Database superusers)}
×ÊÁÏ¿â³¬¼¶ÓÃ¼Ò£¨¼´ {\bfseries pg\_user.usesuper}
Éè¶¨Îª¶ÔµÄÓÃ¼Ò£©×Ô¶¯Í¨¹ýÒÔÏÂÁ½ÏîÖ®ÍâµÄËùÓÐ´æÈ¡¿ØÖÆ¡Ã{\bfseries pg\_user.usecatupd}
Ã»ÓÐÉè¶¨Îª¶ÔµÄ»°²»×¼ÊÖ¶¯¸üÐÂÏµÍ³Ä¿Â¼£¬´Ý»ÙÏµÍ³Ä¿Â¼£¨»òÐÞ¸ÄËüµÄ¸ÙÄ¿ 
(schema)£©ÔòÓÀ²»×¼Ðí¡£
\item  {\bfseries ´æÈ¡ÌØÈ¨ (Access Privilege)}
´æÈ¡ÌØÈ¨ÊÇÓÃÀ´ÏÞÖÆ¶Á¡¢Ð´ºÍÉè¶¨Àà±ð (class) ¹æÔòµÄÈ¨Á¦£¬ÓÃ SQL 
{\bfseries grant/revoke(1)} À´¾ö¶¨¡£
\item  {\bfseries ÒÆ³ýÀà±ðºÍÐÞ¸Ä¸ÙÄ¿}
»ÙÃð»òÐÞ¸ÄÏÖ´æÀà±ðµÄ½á¹¹£¬ÈçÐÞ¸Ä¡¢¶ªÆú±í¸ñ£¬ºÍ¶ªÆúË÷Òý£¬Ö»ÄÜÓÉÀà±ðµÄÖ÷ÈËÖ´ÐÐ¡£
ÈçÉÏËùÊö£¬ÕâÀà¶¯×÷²»ÐíÓÃì¶ÏµÍ³Ä¿Â¼¡£
\end{itemize}



\subsection{¾­ SSH µÄ±£°² TCP/IP Á¬½Ó}

Äã¿ÉÓÃ {\bfseries ssh} À´¼ÓÃÜ¿Í»§ºÍ Postgres
ËÅ·þÆ÷¼äµÄÍøÂçÁ¬½Ó¡£×öµÃÕýÈ·µÄ»°£¬ÕâÑù¿ÉÐÎ³ÉÒ»¸ö±£°²µÄÍøÂçÁ¬½Ó¡£

{\bfseries ssh} µÄÎÄ¼þÌá¹©ÁË´ó²¿·Ý¿ªÊ¼Ê±ÐèÒªµÄ×ÊÁÏ¡£Çë²ÎÔÄ \nameurl{http://www.heimhardt.de/htdocs/ssh.html}{} ÒÔ¼ÓÉîÁË½â¡£Öð²½½âÊÍÖ»ÐèÁ½²½¡£

{\bfseries ¾­ ssh ÐÎ³ÉÒ»Ìõ±£°²Í¨µÀ¡Ã}
Öð²½½âÊÍÖ»ÐèÁ½²½¡£
\begin{itemize}
\item  ²úÉúÒ»Ìõµ½áá¶ËµçÄÔµÄÍ¨µÀ£¬ÈçÏÂ¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
ssh -L 3333:wit.mcs.anl.gov:5432 postgres@wit.mcs.anl.gov
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  {\bfseries -L}
²ÎÊýááµÄµÚÒ»¸öÊý×Ö£¬{\bfseries 33333}£¬ÊÇÄãÕâ·½Í¨µÀµÄ²ººÅ¡£µÚ¶þ¸öÊý×Ö£¬
{\bfseries 5432}£¬ÊÇÁíÒ»·½µÄÖÕµã¡õáá¶ËµÄ²ººÅ¡£Á½¸ö²ºÊýÖ®¼äµÄÃû³Æ»òµØÖ·Êôì¶ËÅ·þÆ÷¡£
{\bfseries ssh} ×îááÒ»¸ö²ÎÊýÖÐÓÃ¼Ò×ÔÐÐÑ¡ÔñÊÇ·ñ¼ÓÉÏµÄÓÃ»§Ãû³ÆÒ²ÊÇ¡£
Ã»ÓÐÓÃ»§Ãû³ÆµÄ»°£¬{\bfseries ssh} »á³¢ÊÔÊ¹ÓÃµÇÈë¿Í»§¶ËµçÄÔµÄÓÃ»§Ãû³Æ¡£
Äã¿ÉÓÃÈÎºÎËÅ·þÆ÷µçÄÔ½ÓÊÜµÄÓÃ»§Ãû³Æ£¬²»Ò»¶¨ÒªÓÃºÍ PostgreSQL ÓÐ¹ØµÄ¡£
\item  ÄãÏÖÔÚÒÑ¿ªÊ¼ÁËÒ»¸ö {\bfseries ssh} Ê±¶Î£¬Äã°Ñ¿ÉÄãËùÓÃµÄµçÄÔµÄ Postgres 
¿Í»§Á¬½Óµ½ÄãÇ°Ò»²½Ëù¶¨µÄ²ººÅ¡£ÈçÄãÊ¹ÓÃ 
{\bfseries psql}£¬ÄãÒªÁíÒ»¸ö½éÃæ£¬ÒòÎªÖ®Ç°ËùÓÃµÄÒ»¸öÒÑ±» {\bfseries ssh} Õ¼¾Ý¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
psql -h localhost -p 3333 -d mpw
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  ×¢ÒâÄãÒªÓÃ {\bfseries -h} ²ÎÊýÊ¹µÃÄãµÄ¿Í»§ÓÃ TCP ²å×ù¶ø²»ÊÇ Unix
²å×ù¡£Èç¹ûÄãÓÃ {\bfseries 5432} ×÷Í¨µÀµÄÖÕµãÄã¿ÉÂÔÈ¥²ºµÄ²ÎÊý¡£
\end{itemize}



\subsection{Kerberos ÈÏÖ¤}

Kerberos ÊÇÒ»¸öÒµ½ç±ê×¼µÄ±£°²ÈÏÖ¤ÏµÍ³£¬ÊÊÓÃì¶¾­¹ý¹«ÓÃÍøÂçµÄ·ÖÉ¢Ê½ÏµÍ³¡£

{\bfseries ÈçºÎÈ¡µÃ}
Kerberos ÈÏÖ¤ÏµÍ³²¢²»ËæÍ¬ Postgres É¢²¼¡£²»Í¬°æ±¾µÄ Kerberos
¶àÒÔ¿É¹©Ñ¡ÔñµÄÈí¼þµÄÐÎÊ½×Ô×÷ÒµÏµÍ³³§ÉÌµÃµ½¡£´ËÍâ£¬Ô­³ÌÊ½ÂëµÄ·¢ÐÐ°æ±¾ 
(distribution) ¿É×Ô MIT Project Athena µÃµ½¡£

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
×¢Òâ¡Ã¼´Ê¹ÄãÊ¹³§ÉÌÌá¹©ÁË Kerberos£¬ÄãÈÔ¿ÉÄÜÏëÓÃ MIT 
°æ£¬ÒòÎªÒ»Ð©³§ÉÌµÄ°æ±¾±»¹ÊÒâÅª»µÒÔÖÂ²»ÄÜºÍ MIT °æ±¾ºÏ×÷¡£
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ÓÐ¹Ø Kerberos µÄ²éÑ¯¿ÉÌá½»ÄãµÄ³§ÉÌ»ò MIT Project Athena¡£×¢Òâ
FAQLs£¨³£ÎÊÎÊÌâÃûµ¥£¬Frequently-Asked Questions Lists) »á±»¶¨Ê±¼ÄÖÁ Kerberos
Í¨ÐÅÂÛÌ³£¨¼ÄÐÅÈ¥¶©ÔÄ£©£¬ºÍ USENET ÐÂÎÅ×é¡£

{\bfseries °²×°¡Ã}
°²×° Kerberos ÔÚ Kerberos Installation Notes ÖÐÒÑÏêÏ¸ËµÃ÷¡£ÒªÈ·¶¨ËÅ·þÆ÷¼üÂëµµ
(key file)£¨{\bfseries srvtab} »ò {\bfseries keytab}£©¿É±» postgres
ÓÃ»§¶Áµ½¡£¼®Éè¶¨ {\bfseries src/Makefile.global} µµµÄ KRBVERS ±äÊý£¬Postgres 
»òÆä¿Í»§³ÌÊ½¿É±àÒëÎªÊ¹ÓÃ MIT Kerberos Í¨Ñ¶Ð­¶¨µÄµÚËÄ»òÎå°æ¡£ÄãÒ²¿É¸Ä±ä 
Postgres ÆÚÍûÕÒµ½Ïà¹Øº¯Ê½¿â¡¢±êÍ·µµºÍ×Ô¼ºµÄËÅ·þÆ÷¼üÂëµµµÄÎ»ÖÃ¡£±àÒëÍêáá£¬
Postgres ÒªµÇ¼ÇÎªÒ»¸ö Kerberos ·þÎñ¡£Çë²ÎÔÄ Kerberos  Operations Notes ºÍÏà¹Ø 
manual pages ÒÔÈ¡µÃÓÐ¹ØµÇ¼Ç·þÎñµÄÏêÇé¡£

{\bfseries ²Ù×÷¡Ã}
°²×°Ö®áá£¬Postgres ÔÚ¸÷·½ÃæÓ¦ÈçÒ»°ã Kerberos
·þÎñÔË×÷¡£ÒªÖªµÀÈÏÖ¤µÄÊ¹ÓÃ·½·¨£¬Çë²ÎÔÄ {\itshape PostgreSQL User's Guide\/} ÓÐ¹Ø
{\bfseries postmaster} ºÍ {\bfseries psql} µÄÕÂ½Ú¡£

ÔÚ Kerberos µÚÎå°æ¹Òµö
(hooks)£¬¶ÔÓÃ»§ºÍ·þÎñÃüÃû×÷ÁËÒÔÏÂ¼ÙÉè£¨Ò²Çë²ÎÔÄÒÔÏÂ±í¸ñ£©¡£
\begin{itemize}
\item  ÓÃ»§µÄÖ÷ÒªÃû³Æ (principal names£¬anames) µÚÒ»¸ö²¿·ÝÖÐ¼ÙÉèº¬ÓÐ Unix /
Postgres ÓÃ»§Ãû³Æ¡£
\item  Postgres
·þÎñ¼ÙÉèÓÐÁ½¸ö²¿·Ý£¬·þÎñÃû³ÆºÍÖ÷»úÃû³Æ¡£ááÕßÈçÍ¬µÚËÄ°æµÄ¸ñÊ½
£¨¼´³ýÈ¥ËùÓÐÓòÃûµÄ²¿·Ö£©¡£
\end{itemize}


\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
                ±í¸ñ¡ÃKerberos ²ÎÊýÀý×Ó
 ------------------------------------------------------
 ²ÎÊý       Àý×Ó 
 ------------------------------------------------------
 user       frew@S2K.ORG
 user       aoki/HOST=miyu.S2K.Berkeley.EDU@S2K.ORG
 host       postgres_dbms/ucbvax@S2K.ORG
 ------------------------------------------------------
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\section{PostgreSQL µÄÇ°¶Ë GUI ¹¤¾ß£¨Í¼ÏñÊ¹ÓÃÕß½çÃæ£©}

ÍøÒ³ä¯ÀÀÆ÷ÔÚÎ´À´½«»á³ÉÎª×îÁ÷ÐÐµÄÇ°¶Ë GUI¡£½¨ÒéÄã°ÑËùÓÐ¡¸×æ´«¡¹µÄÊÓ´° 95/NT
³ÌÊ½¸ÄÐ´ÎªÔÚÍøÉÏÖ´ÐÐµÄ³ÌÊ½¡£

ÄãÒªÊ¹ÓÃÍøÉÏÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷Èç \ref{Enhydra} {()}£¨Ê¹ÓÃ Java£©»ò \ref{Zope} {()}£¨Ê¹ÓÃ Python£©»ò \ref{OpenACS} {()}¡£

×î¼ÑÍøÉÏÃüÁî¸å (script) ±àÐ´£¨»ò±àÒë£©ÓïÑÔÊÇ \ref{PHP} {(PHP+Zend  ±àÒëÆ÷)}¡£{\bfseries PHP} ¹¦ÄÜÊ®·ÖÇ¿¾¢£¬ÒòÎªËü°Ñ Perl¡¢Java¡¢C++ ºÍ Javascript 
µÄ¹¦ÄÜ½áºÏµ½Ò»ÖÖÓïÑÔÖÐ£¬¶øÇÒ¿Éì¶ËùÓÐ×÷ÒµÏµÍ³¡õUnixes ºÍÊÓ´° NT/95 Ö´ÐÐ¡£

ÅÅÃûÒÔÏ²»¶µÄ³Ì¶ÈÎªÏÈáá£¬×î¼Ñ¹¤¾ßÎª
\begin{itemize}
\item  Enhydra ÔÚ \ref{Enhydra} {()} ¼ÓÉÏ Borland Java JBuilder Linux °æ \nameurl{http://www.inprise.com}{}
\item  Zope ÔÚ \ref{Zope} {()}
\item  OpenACS ÔÚ \ref{OpenACS} {()}
\item  PHP ÃüÁî¸åºÍ Zend ±àÒëÆ÷ \ref{PHP} {(PHP+Zend ±àÒëÆ÷)}
\item  X-Designer Ö§Ô® C++, Java ºÍ MFC \nameurl{http://www.ist.co.uk/xd}{}
\item  Windows95 ºÍ Unix °æµÄ QT ÔÚ \nameurl{http://www.troll.no}{} ºÍ \nameurl{ftp://ftp.troll.no}{}
\item  Code Crusader ÔÚ Linux cdrom ÖÐ£¬¸ù¾Ý MetroWorks Code Warrior 
Ð´³ÉµÄÃâ·ÑÈí¼þ \nameurl{http://www.kaze.stetson.edu/cdevel/code_crusader/about.html}{}
\item  MetroWorks µÄ Code Warrior \nameurl{http://www.metrowerks.com}{}
\item  GNU Prof C++ IDE£¬À´×Ô \nameurl{http://www.redhat.com}{(Redhat)}
Cygnus \nameurl{http://www.cygnus.com}{} 
\item  Borland C++ Builder Linux °æ\nameurl{http://www.inprise.com}{}
\item  Borland Java JBuilder Linux °æ\nameurl{http://www.inprise.com}{}
\end{itemize}


ÒÔ×î¼ÑÎªÏÈµÄÓïÑÔÑ¡Ôñ¡õ
\begin{enumerate}
\item  Java£¬µ«ËüµÄ³ÌÊ½Ö´ÐÐµÃºÜÂý£¬¶øÇÒÒªÊÚÈ¨·Ñ¡£C++ ±È Java {\bfseries ¿ìÎå±¶}£¡£¡
\item  Python£¨Ç¿´óµÄÎï¼þµ¼ÏòÃüÁî¸åÓïÑÔ£©¡£
\item  PHP ÍòÎ¬ÍøËÅ·þÆ÷ÃüÁî¸å¼ÓÉÏ HTML¡¢DHTML¡¢Javascript ¿Í»§¶ËÃüÁî¸å¼° 
Java-Applet¡£
\item  Perl ÃüÁî¸åÓïÑÔÊ¹ÓÃ Perl-Qt »ò Perl-Tk \ref{Perl Database Interface} {(Perl ×ÊÁÏ¿â½éÃæ)}
\item  Omnipresent ºÍ Omnipotent ÓïÑÔ C++ (GNU g++)¡Ã
\begin{itemize}
\item  Fast CGI£¨ÒÔ C++ Ð´³É£©¼ÓÉÏ Javascript/Java-Applet ×÷ÎªÍøÒ³Ç°¶Ë½éÃæ
\item  GNU C++ ¼Ó QtEZ »ò QT
\item  GNU C++ ¼Ó Lesstif »ò Motif¡£
\end{itemize}
\end{enumerate}


»¹ÓÐÆäËû¹¤¾ß¡õPostgreSQL ·¢ÐÐ°æ±¾ (distribution) ÖÐÓÐÒ»¸öÃûÎª¡®pgTcl¡¯µÄ 
Tcl/Tk ½éÃæ³ÌÊ½¿â¡£Tcl/Tk ÓÐÒ»¸öÃûÎª SpecTcl µÄ×ÛºÏ¿ª·¢»·¾³¡£

\begin{itemize}
\item  Lesstif Motif ¹¤¾ß \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/lesstif*.rpm}{}
\item  Vibe Java/C++ ÔÚ \nameurl{http://www.LinuxMall.com/products/00487.html}{}
\item  JccWarrior \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/jcc*.rpm}{}
\item  Tcl/Tk \nameurl{http://www.scriptics.com}{}
\item  ÃûÎª INCR µÄ Tcl Îï¼þµ¼ÏòÑÓÉì \nameurl{http://www.tcltk.com}{}
\item  Visual TCL ÍøÕ¾ \nameurl{http://www.neuron.com}{}
\item  Visual TCL Redhat rpm ÔÚ \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/visualtcl*.rpm}{}
\item  \nameurl{http://sunscript.sun.com/}{}
\item  \nameurl{http://sunscript.sun.com/TclTkCore/}{}
\item  \nameurl{ftp://ftp.sunlabs.com/pub/tcl/tcl8.0a2.tar.Z}{}
\item  Java FreeBuilder \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/free*.rpm}{}
\item  SpecTCL \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/spec*.rpm}{}
\item  PostgreSQL µÄ Java RAD ¹¤¾ß Kanchenjunga  \nameurl{http://www.man.ac.uk/~whaley/kj/kanch.html}{}
\item  Applixware ¹¤¾ß \nameurl{http://www.redhat.com}{}
£¨Òë°´¡ÃRedhat ÔçÒÑÍ£ÊÛ Applix ²úÆ·¡££©
\item  XWPE X Window Programming Environment \nameurl{http://www.identicalsoftware.com/xwpe/}{} »ò \nameurl{ftp://ftp.rpi.edu/~payned/xwpe}{}
\nameurl{ftp://ftp.redhat.com/pub/contrib/i386/xwpe*.rpm}{}
\item  XWB X Window Work Bench \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/xwb*.rpm}{}
\item  NEdit \nameurl{ftp://ftp.redhat.com/pub/contrib/i386/nedit*.rpm}{}
\end{itemize}


ÄãÒ²¿ÉÔÚÊÓ´° 95 ÖÐÊ¹ÓÃ Borland C++ Builder¡¢Delphi¡¢Borland JBuilder¡¢
PowerBuilder ¾­ ODBC/JDBC Çý¶¯³ÌÊ½Á¬½Óµ½ unix µçÄÔµÄ PostgreSQL¡£


\section{PostgreSQL µÄ½éÃæÇý¶¯³ÌÊ½}




\subsection{PostgreSQL µÄ ODBC Çý¶¯³ÌÊ½}

ODBC ´ú±íÓÉÎ¢ÈíÖÆ¶¨µÄ¡®Open DataBase Connectivity¡¯¡£
ËüÊÇ´Ó²»Í¬³§ÉÌµÄ²»Í¬×ÊÁÏ¿â´æÈ¡×ÊÁÏµÄÁ÷ÐÐ½éÃæ¡£Ê¹ÓÃ ODBC 
Çý¶¯³ÌÊ½Ð´³ÉµÄÈí¼þ±£Ö¤¿ÉÓÃì¶²»Í¬×ÊÁÏ¿â£¬Èç PostgreSQL¡¢Oracle¡¢Sybase ºÍ 
Informix µÈ¡£

\begin{itemize}
\item  \nameurl{http://www.insightdist.com/psqlodbc}{PostODBC} 
ÒÑ¾­°üÀ¨ÔÚ·¢ÐÐ°æ±¾ÖÐ¡£Çë²ÎÔÄÖ÷ÍøÒ³ \nameurl{http://www.postgresql.org}{}¡£
ËüÒÑ°üÀ¨ÔÚ PostgreSQL ¹âµúÖÐ¡£
\item  ÔÚ \nameurl{http://www.iodbc.org}{} µÄ¿ª·ÅÔ­Ê¼Âë ODBC ×¨°¸¡£
\item  \nameurl{http://www.openlinksw.com}{} Open Link Software Corporation 
ÊÛÂô PostgreSQL ºÍÆäËû×ÊÁÏ¿âµÄ ODBC Çý¶¯³ÌÊ½¡£ËýÒ²ËÍ³öÃâ·ÑµÄ ODBC (Ãû¶îÓÐÏÞ£©¡£
\item  Insight µÄ PostgreSQL ODBC \nameurl{http://www.insightdist.com/psqlodbc}{} ÕâÊÇ PostODBC µÄ¹Ù·½ÍøÕ¾¡£
\item  FreeODBC Ì×¼þ \nameurl{http://www.ids.net/~bjepson/freeODBC/}{}¡£ÕâÊÇÒ»¸öÃâ·ÑµÄ ODBC¡£
\item  PostgreSQL µÄ ODBC 32 Explorer \nameurl{http://members.nbci.com/anhr}{} 
\end{itemize}



\subsection{PostgreSQL µÄ UDBC Çý¶¯³ÌÊ½}

UDBC ÊÇÒ»ÖÖ¶ÀÁ¢ì¶Çý¶¯³ÌÊ½¹ÜÀíÔ± (driver managers) ºÍ DLL Ö§Ô®µÄ¾²Ì¬ ODBC 
°æ±¾£¬ÓÃÀ´Ö±½Ó°Ñ×ÊÁÏ¿âÁ¬½ÓÄÜÁ¦Ç¶Èëµ½Ó¦ÓÃÈí¼þÖÐ¡£
\begin{itemize}
\item  \nameurl{http://www.openlinksw.com}{} Open Link Software Corporation 
³öÊÛ PostgreSQL ºÍÆäËû×ÊÁÏ¿âµÄ UDBC Çý¶¯³ÌÊ½¡£Open Link Ò²ËÍ³öÃâ·ÑµÄ UDBC 
(Ãû¶îÓÐÏÞ£©¡£
\end{itemize}



\subsection{PostgreSQL µÄ JDBC Çý¶¯³ÌÊ½}

JDBC ´ú±í¡®Java DataBase Connectivity¡¯¡£Java ÊÇÒ»ÖÖÉýÑô (Sun Microsystems) 
Ëù¿ª·¢µÄ¶ÀÁ¢ì¶Æ½Ì¨µÄ³ÌÊ½ÓïÑÔ¡£Java ³ÌÊ½Éè¼ÆÊ¦±»¹ÄÀøÊ¹ÓÃ JDBC 
À´×«Ð´×ÊÁÏ¿â³ÌÊ½£¬ÒÔÔöÇ¿³ÌÊ½ÔÚ²»Í¬×ÊÁÏ¿â£¬Èç PostgreSQL¡¢Oracle¡¢Informix 
µÈÖ®¼äµÄÒÆÖ²ÄÜÁ¦¡£Èç¹ûÄãÐ´ Java ³ÌÊ½£¬Äã¿ÉÔÚÒÔÏÂÍøÕ¾È¡µÃ PostgreSQL µÄ JDBC 
Çý¶¯³ÌÊ½¡£

JDBC Çý¶¯³ÌÊ½ÒÑ°üÀ¨ÔÚ PostgreSQL ·¢ÐÐ°æ±¾µÄ postgresql-jdbc*.rpm Ì×¼þÖÐ¡£

\begin{itemize}
\item  \nameurl{http://www.demon.co.uk/finder/postgres/index.html}{} ÉýÑô 
Java µÄ PostgreSQL Á¬½Ó
\item  \nameurl{ftp://ftp.ai.mit.edu/people/rst/rst-jdbc.tar.gz}{}
\item  \nameurl{http://www.openlinksw.com}{} Open Link Software Corporation 
³öÊÛ PostgreSQL ºÍÆäËû×ÊÁÏ¿âµÄ JDBC Çý¶¯³ÌÊ½¡£Open Link Ò²ËÍ³öÃâ·ÑµÄ JDBC 
(Ãû¶îÓÐÏÞ£©¡£
\item  JDBC Ó¢¹úÍøÕ¾ \nameurl{http://www.retep.org.uk/postgres}{}
\item  JDBC FAQ ÍøÕ¾ \nameurl{http://eagle.eku.edu/tools/jdbc/faq.html}{}
\end{itemize}


JDBC µÄÍøÒ³¡¢µ¼ÒýºÍ FAQ ÔÚ¡Ã
\begin{itemize}
\item  JDBC HOME \nameurl{http://splash.javasoft.com/jdbc}{}
\item  JDBC µ¼Òý \nameurl{http://www.javasoft.com/products/jdk/1.1/docs/guide/jdbc}{}
\item  JDBC FAQ \nameurl{http://javanese.yoyoweb.com/JDBC/FAQ.txt}{}
\end{itemize}

Çë²Î¿¼ \ref{Testing Java} {(²âÊÔ Java ½éÃæ)} Ò»½Ú¡£


\subsection{PostgreSQL µÄ Java}

Java ³ÌÊ½Éè¼ÆÊ¦»á¾õµÃÕâÐ©¶ÔËûÃÇºÜÓÐÓÃ¡£
\begin{itemize}
\item  \nameurl{ftp://ftp.redhat.com/pub/contrib/i386}{} ¿´ 
postgresql-jdbc-*.rpm
\item  \nameurl{http://www.blackdown.org}{}
\end{itemize}

Çë²Î¿¼ \ref{Testing Java} {(²âÊÔ Java ½éÃæ)} Ò»½Ú¡£


\section{PostgreSQL µÄ Perl ×ÊÁÏ¿â½éÃæ (Database Interface, DBI) \label{Perl Database Interface}}




\subsection{PostgreSQL µÄ PERL ½éÃæ}

PERL ÊÇ¡®Practical Exptraction and Report Language¡¯µÄ¼òÐ´¡£
ÊÀÉÏËùÓÐÈíÓ²¼þÆ½Ì¨¶¼¿ÉÊ¹ÓÃ Perl¡£ÄãËùÔÚÊÓ´° 95/NT¡¢Æ»¹ûÂó½ðËþ iMac¡¢ËùÓÐ 
Unix £¨Solaris¡¢HPUX¡¢AIX¡¢Linux¡¢Irix¡¢SCO µÈµÈ£©¡¢´óÐÍµçÄÔ MVS¡¢×ÀÃæµÄ 
OS/2¡¢OS/400¡¢Amdahl UTS ºÍÆäËûºÜ¶àµçÄÔ¡£Perl 
{\bfseries ÉõÖÁ}¿ÉÔÚºÜ¶à²»Á÷ÐÐºÍ²»ÎªÈËÖªµÄ²Ù×÷ÏµÍ³ºÍÓ²¼þÖ´ÐÐ£¡£¡ËùÒÔ£¬ÔÚ¿´µ½ 
Perl ÔÚÒ»¸öº±¼ûµÄ²Ù×÷ÏµÍ³ÉÏÖ´ÐÐÊ±£¬²»±Ø´ó¾ªÐ¡¹Ö¡£Äã¿ÉÒÔÏëÏñµ½ Perl 
µÄÊ¹ÓÃÕßºÍ¿ª·¢ÈËÔ±µÄÊýÁ¿¡£ºÍ¡°C¡±ÓïÑÔÏàËÆ£¬Perl 
ÒÑÓÐºÜ³¤ÊÙÃü£¬¶øÔÚ{\bfseries Î´À´ÊýÇ§Äê}ÈÔ´óÐÐÆäµÀ£¡Perl µÄÖ´ÐÐËÙ¶È±È Java 
¿ì{\bfseries Ê®±¶}£¬ÓÐÊ±ÉõÖÁ±È¡°C¡±¿ì¡£Java 
ÊÇÒ»¸ö·Ç³£¸´ÔÓµÄÏµÍ³£¬¼ÈÓÐÐéÄâ»úÆ÷£¬ÓÖÓÐÖ±ÒëÆ÷£¬Ê¹µÃËü·Ç³£»ºÂý¡¢²»ÎÈ¶¨ºÍ²»¿É¿¿¡£
Perl Ôò¼ò½à¡¢¿ìËÙ£¬¸üÊÇÎï¼þµ¼Ïò¡£

PostgreSQL µÄ Perl ½éÃæÒÑ°üÀ¨ÔÚ PostgreSQL µÄ°²×°Ì×¼þÖÐ¡£Çë²Î¿´ 
src/pgsql\_perl5 Ä¿Â¼¡£
\begin{itemize}
\item  Pgsql\_perl5 µçÓÊÁªÂçµØÖ·¡Ã
\onlynameurl{E.Mergl@bawue.de}
\item  Perl ÍøÒ³ \nameurl{http://www.perl.com/perl/index.html}{}
\item  Perl µ¼Òý£¬ÇëÔÚ \nameurl{http://reference.perl.com/}{} ²Î¿´µ¼ÒýÄ¿Â¼
\item  Perl FAQ ÔÚ \nameurl{http://www.yahoo.com/Computers_and_Internet/Programming_Languages/Perl/}{}
\item  ´Ó \nameurl{http://www.perl.com/CPAN/modules/by-module/CPAN}{} È¡µÃËùÓÐ 
Perl Ä£×éÖ®Ä¸£¬´òÏÂ¡®/usr/bin/cpan¡¯¡¢¡®man CPAN¡¯ºÍÊýÒÔÇ§¼ÆµÄÄ£×é \nameurl{http://www.perl.com/CPAN-local/modules/by-module}{}¡£
\item  Perl GUI Ê¹ÓÃÕß½éÃæ Perl-Qt rpm¡Ã\nameurl{ftp://ftp.redhat.com/pub/contrib/i386}{} 
Ò²Çë¿´ PerlQt-1.06-1.i386.rpm
\item  Perl GUI Ê¹ÓÃÕß½éÃæ Perl-Qt¡Ã\nameurl{http://www.accessone.com/~jql/perlqt.html}{}
\item  Perl GUI Ê¹ÓÃÕß½éÃæ Perl-XForms¡Ã\nameurl{ftp://ftp.redhat.com/pub/contrib/i386}{}£¬Ñ°ÕÒ Xforms4Perl-0.8.4-1.i386.rpm
\item  Perl GUI Ê¹ÓÃÕß½éÃæ Perl-Tk¡Ã\nameurl{ftp://ftp.redhat.com/pub/contrib/i386}{}
\item  Perl GUI kits¡Ã\nameurl{http://reference.perl.com/query.cgi?ui}{}
\item  Perl ×ÊÁÏ¿â½éÃæ¡Ã\nameurl{http://reference.perl.com/query.cgi?database}{}
\item  Perl µ½ "C" µÄ·­Òë¹¤¾ß¡Ã\nameurl{http://www.perl.com/CPAN-local/modules/by-module/B/}{}
Ñ°ÕÒ Compiler-a3.tar.gz
\item  °Ñ Perl ±àÒëÎª¿ÉÖ´ÐÐµµ¡£Perl2Exe ÊÇÒ»¸ö¿É°Ñ perl
ÃüÁî¸å×ªÎª¿ÉÖ´ÐÐµµµÄµÄÖ¸ÁîÁÐ¹¤¾ß¡£\nameurl{http://www.indigostar.com/perl2exe.htm}{}
\item  Bourne shell µ½ Perl µÄ·­Òë¹¤¾ß¡Ã\nameurl{http://www.perl.com/CPAN/authors/id/MERLYN/sh2perl-0.02.tar.gz}{}
\item  awk ×ªÎª perl µÄ a2p ºÍ sed ×ªÎª perl µÄ s2p ÒÑ°üÀ¨ÔÚ PERL É¢²¼ÖÐ¡£
\item  Ò²Çë¿´ comp.lang.perl.* µÈÓÐ¹Ø PERL µÄÐÂÎÅ×é
\end{itemize}



\subsection{Perl ×ÊÁÏ¿â½éÃæ DBI}


\subsubsection{ºÎÎ½ DBI£¿}

Perl ×ÊÁÏ¿â½éÃæ£¨DBI£©ÊÇ Perl ÓïÑÔµÄÒ»¸ö×ÊÁÏ¿â´æÈ¡Ó¦ÓÃ³ÌÊ½½éÃæ£¨API£©¡£Perl DBI
API ¹æ¸ñ¶¨ÒåÁËÒ»×éº¯Êý¡¢±äÊýºÍ¹ßÀý£¬ÒÔÌá¹©Ò»¸öÒ»ÖÂ¶ø¶ÀÁ¢ì¶Êµ¼ÊËùÓÃ×ÊÁÏ¿âµÄ½éÃæ¡£
×ÊÁÏ¿âÇý¶¯³ÌÊ½£¨Perl DBI£©µÄ·¢ÆðÈËÎªÒ»¶¨ÊýÁ¿µÄÉÌÒµ×ÊÁÏ¿âÒýÇæÖÆ¶¨±ê×¼£¬
ËùÒÔÄãÖ»Ðè»¨ºÜÉÙ¹¤·ò±ã¿É´Ó Oracle ×ªµ½ PostgreSQL¡£


\subsubsection{PostgreSQL µÄ DBD Çý¶¯³ÌÊ½}

ÔÚÄã°²×° DBD PostgreSQL £¨Çý¶¯³ÌÊ½£©Ç°£¬ÄãÒªÏÈ°²×° DBI£¬´ÓÒÔÏÂµØ·½È¡µÃ DBI
Çý¶¯³ÌÊ½¡Ã
\begin{itemize}
\item  ÏÈ´Ó \nameurl{http://www.perl.com/CPAN/modules/by-module/CPAN}{} 
È¡µÃËùÓÐ Perl Ä£×éÖ®Ä¸£¬´ò¡®/usr/bin/cpan¡¯¡¢¡®man CPAN¡¯ºÍÊýÒÔÇ§¼ÆµÄÄ£×é \nameurl{http://www.perl.com/CPAN-local/modules/by-module}{}¡£
\item  DBI Ä£×é \nameurl{http://www.perl.com/CPAN-local/modules/by-module/DBI}{}
\item  DBI Ä£×é \nameurl{http://www.symbolstone.org/technology/perl/DBI}{}
\item  DBI FAQ \nameurl{http://www.symbolstone.org/technology/perl/DBI/doc/faq.html}{}
\item  Perl DBI µÄ²Î¿¼ÎÄ¼þ \nameurl{http://www.symbolstone.org/technology/perl/DBI}{}
\item  DBI Í¨ÐÅÂÛÌ³ \nameurl{http://www.fugue.com/dbi}{}
\item  Perl ×ÊÁÏ¿â²Î¿¼ÎÄ¼þ \nameurl{http://www.perl.com/reference/query.cgi?section=database}{}
\item  ÏÂÔØ DBI rpm £¨×¢Òâ¡Ã¿ÉÄÜÊÇ¾É°æ£©\nameurl{http://rpmfind.net/linux/rpm2html/search.php?query=DBI}{}
\end{itemize}


ÔÚ´ËÈ¡µÃ DBD-Pg
\begin{itemize}
\item  ÏÈ´Ó \nameurl{http://www.perl.com/CPAN/modules/by-module/CPAN}{} 
È¡µÃËùÓÐ Perl Ä£×éÖ®Ä¸£¬´ò¡®/usr/bin/cpan¡¯¡¢¡®man CPAN¡¯ºÍÊýÒÔÇ§¼ÆµÄÄ£×é \nameurl{http://www.perl.com/CPAN-local/modules/by-module}{}¡£
\item  DBD Ä£×é \nameurl{http://www.perl.com/CPAN-local/modules/by-module/DBD}{}£¬ÕÒ DBD-pg µµ»ò
\nameurl{http://www.perl.com/CPAN/modules/by-module/DBD}{DBD}¡£
\item  Comprehensive Perl Archive Network CPAN \nameurl{http://www.perl.com/CPAN}{} ÔÚÕâ´¦Ñ¡¡®Database¡¯£¨ÔÚ Search ºÐ×ÓÉÏ·½£©£¬
»÷Ñ¡¡®Go¡¯°´Å¥¡£
\item  Ô¤ÏÈ±àÒëÁËµÄÊÓ´° NT/2000 Ì×¼þ¿ÉÔÚ \nameurl{http://www.edmund-mergl.de/export/DBD-Pg.zip}{} µÃµ½
\item  ÏÂÔØ DBD rpm £¨×¢Òâ¡Ã¿ÉÄÜÊÇ¾É°æ£©\nameurl{http://rpmfind.net/linux/rpm2html/search.php?query=DBD}{}
\item  Perl Ä£×é£¨ÊýÒÔÇ§¼Æ£©\nameurl{http://www.perl.com/CPAN-local/modules/by-module}{}¡£
\end{itemize}



\subsubsection{DBI µÄ¼¼ÊõÖ§Ô®}



\begin{itemize}
\item  Çë½«Òâ¼û»ò´íÎó±¨¸æÁ¬Í¬ perl -v ºÍ perl -V µÄÊä³ö¡¢PostgreSQL 
µÄ°æ±¾¡¢DBD-pg µÄ°æ±¾¡¢DBI µÄ°æ±¾¼ÄÖÁ
\onlynameurl{E.Mergl@bawue.de}
\end{itemize}



\subsubsection{DBI ÎÄ¼þ}

ÕâÀïÓÐÒ»Ð© DBI µÄ×ÊÁÏÀ´Ô´¡£

{\bfseries POD ÎÄ¼þ¡Ã} POD ÊÇÇ¶Èëµ½ perl ³ÌÊ½ÖÐÓÃÒÔ¡°¼´³¡¡±½âÊÍ³ÌÊ½ÂëµÄÒ»¶ÎÎÄ¼þ£¬
ÓÃÒÔ¸ø³ÌÊ½Éè¼ÆÊ¦ºÍÄ£×éµÄÓÃ¼ÒÌá¹©ÓÐÓÃµÄ×ÊÁÏ¡£DBI ºÍÇý¶¯³ÌÊ½µÄ POD 
ÕýÔ½À´Ô½Á÷ÐÐ£¬ÒªÔÄ¶ÁÓÐ¹ØÎÄ¼þ£¬ÇëÊ¹ÓÃÒÔÏÂÖ¸Áî¡£

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
DBI ¹æ¸ñµÄ PO ¿ÉÓÃÒÔÏÂÖ¸ÁîÔÄ¶Á
        $ perldoc DBI

Ê¹ÓÃ½áºÏµ½ DBD::Oracle µÄ Oraperl Ä£Äâ²ãµÄÈË¿ÉÓÃÒÔÏÂÖ¸ÁîÔÄ¶ÁÈçºÎÓÃ Oraperl 
½éÃæ±àÐ´³ÌÊ½¡Ã
        $ perldoc Oraperl

DBD::mSQL Ä£×éµÄÓÃ¼Ò¿É¼®ÒÔÏÂÖ¸ÁîÔÄ¶ÁÒ»Ð©¸ÃÇý¶¯³ÌÊ½µÄ¶À¼Òº¯Êý (private 
functions) ºÍÌØÒì¹¦ÄÜµÄ×ÊÁÏ¡Ã
        $ perldoc DBD::mSQL

POD ÎÄ¼þÖÐÒ²°üº¬³£¼ûÎÊÌâ¡£ÒªÔÄ¶ÁµÄ»°ÇëÊäÈë¡Ã
        $ perldoc DBI::FAQ

POD µÄÒ»°ã×ÊÁÏ¡õÈçºÎ×«Ð´ POD£¬¼°ÕûÌåµÄ POD ÕÜÑ§£¬¿É¼®ÒÔÏÂÖ¸ÁîÔÄ¶Á¡Ã
        $ perldoc perlpod
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

°²×°ÁË Tk Ä£×éµÄÓÃ¼Ò¿ÉÄÜ»á¶ÔÒ»¸öÃûÎª tkpod£¬Ê¹ÓÃ Tk µÄ POD ÔÄ¶ÁÆ÷ÓÐÐËÈ¤¡£Ëü»á°Ñ 
POD ±àÅÅµ½Ò»¸ö·½±ã¼°¿ÉÔÄ¶ÁµÄÐÎÊ½¡£

Ò²Çë¿´¿´
\begin{itemize}
\item  À´×Ô DBI µÄÍ¨ÐÅÂÛÌ³µÄ×ÊÁÏ  \nameurl{http://www.symbolstone.org/technology/perl/DBI/tidbits}{}
\item  DBI Perl Journal ÍøÒ³ \nameurl{http://www.tpj.com}{}
\item ¡°DBperl¡±ÕâÎÄÕÂÔÚÒ»¾Å¾ÅÁùÄêÊ®Ò»ÔÂµÄ¡°Dr. Dobbs Journal¡±·¢±í¡£
\item ¡°The Perl5 Database Interface¡±£¬Ò»±¾ÓÉ Alligator Descartes Ð´³É£¬ÓÉ 
O'Reilly and Associates ³ö°æµÄÊé¡£
\end{itemize}


ÓÃ¼Ò¿ÉÄÜ²Î¼ÓµÄÍ¨ÐÅÂÛÌ³Îª¡Ã
\begin{itemize}
\item  Í¨ÐÅÂÛÌ³ \nameurl{http://www.fugue.com/dbi}{}
\item  {\bfseries dbi-announce}
µçÓÊÖÁ \onlynameurl{dbi-announce-request@fugue.com}
ÒÔ 'subscribe' ÎªÕýÎÄÄÚÈÝ
\item  {\bfseries dbi-dev}
¿ª·¢ÈËÔ±×¨ÓÃ
Email: \onlynameurl{dbi-dev-request@fugue.com}
ÒÔ 'subscribe' ÎªÕýÎÄÄÚÈÝ
\item  {\bfseries dbi-users} Ò»°ãÌÖÂÛ
Email: \onlynameurl{dbi-users-request@fugue.com}
ÒÔ 'subscribe' ÎªÕýÎÄÄÚÈÝ
\item  ÃÀ¹úÍ¨ÐÅ´æ¿â \nameurl{http://outside.organic.com/mail-archives/dbi-users/}{}
\item  Å·ÖÞÍ¨ÐÅ´æ¿â \nameurl{http://www.rosat.mpe-garching.mpg.de/mailing-lists/PerlDB-Interest}{}
\end{itemize}



\subsubsection{ÊÓ´° 95/NT ÓÐÃ»ÓÐ DBI Ö§Ô®£¿}

DBI ºÍ DBD::Oracle µÄ Win32 °æ±¾ÒÑ³ÉÎª DBI µÄ±ê×¼²¿·Ö¡£Òò´Ë£¬±È DBI 0.81 
¸ßµÄ°æ±¾Ó¦¸Ã»áÕý³£ÔË×÷¡£Í¸¹ý ODBC£¬Äã¿ÉÒÔ´æÈ¡Î¢Èí Access ºÍ SQL-Server 
×ÊÁÏ¿â¡£ÔÚ DBI-0.79£¨¼°ÒÔáá£©ÓÐÒ»¸ö Win32::ODBC DBI Ä£Äâ²ã¡£ËüÃûÎª 
DBI::W32ODBC¡£ÄãÐèÒªÊ¹ÓÃ Win32::odbc Ä£×é¡£
\begin{itemize}
\item  Win32 DBI \nameurl{http://www.symbolstone.org/technology/perl/DBI}{}
\item  Win32 ODBC \nameurl{http://www.roth.net}{}
\item  Î¢Èí SQL server µÄ Perl ½éÃæ \nameurl{http://www.algonet.se/~sommar/mssql}{}
\end{itemize}



\subsubsection{ÉÌÒµÖ§Ô®¼°ÑµÁ·}

{\bfseries PERL CLINIC : }
Perl Clinic ÒÔºÏÔ¼ÐÎÊ½Îª Perl¡¢DBI¡¢DBD::Oracle ºÍ Oraperl 
Ìá¹©ÉÌÒµÖ§Ô®¡£ÕâÐ©Ö§Ô®ÊÇÓÉ DBI ×÷Õß Tim Bunce 
¹¤×÷µÄ¹«Ë¾Ìá¹©µÄ¡£ÓûÖªÏêÇé£¬Çë¿´¡Ã
\begin{itemize}
\item  Ö§Ô® \nameurl{http://www.perlclinic.com}{}
\item  Ö§Ô® \nameurl{http://www.perldirect.com}{}
\item  ÅàÑµ \nameurl{http://www.westlake.com/training}{}
\end{itemize}



\subsection{²âÊÔ Perl ½éÃæ}

Çë²ÎÔÄ\ref{Testing Perl} {(²âÊÔ Perl¡õPostgreSQL ½éÃæ)}Ò»½Ú


\section{PostgreSQL ¹ÜÀí¹¤¾ß}




\subsection{PGACCESS - ¹ÜÀí PostgreSQL µÄ GUI ¹¤¾ß}

PgAccess ÊÇ PostgreSQL µÄ Tcl/Tk ½éÃæ¡£ËüÒÑ¾­°üÀ¨ÔÚ PostgreSQL 
µÄ·¢ÐÐÌ×¼þÖÐ¡£Äã¿ÉÄÜÏë´ÓÕâÍøÒ³ÕÒ³öËüÓÐÃ»ÓÐÐÂ°æ±¾¡Ã
\begin{itemize}
\item  \nameurl{http://www.flex.ro/pgaccess}{}
\item  ÈçÓÐÈÎºÎÒâ¼û¡¢¸ÄÁ¼µÄ½¨Òé£¬µçÓÊ¡Ã
\onlynameurl{teo@flex.ro}
\end{itemize}

pgaccess µÄÓÃ·¨
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
# man xhost
# xhost +
# su - postgres
bash$ man pgaccess
bash$ export DISPLAY=<Ö÷»úÃû>:0.0
bash$ pgaccess mydatabase
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


PgAccess µÄÌØÉ«

PgAccess ÊÓ´°¡õMain window, Table builder,
Table(query) view, Visual query builder.

Tables
\begin{itemize}
\item ¿ªÆô±í¸ñ (tables) ²éÔÄ£¬×î¶à¶þ°Ù¸ö¼ÍÂ¼£¨¿ÉÔÚ perferences ²Ëµ¥¸ü¸Ä£©
\item ¼®ÍÏÒ·´¹Ö±¸ñÏß (grid line) ÖØÕû´óÐ¡£¨ÔÚÁÐ±í¿Õ¼ä (table space) 
½øÐÐ±ÈÔÚÁÐ±íÄ¿Â¼ (table header) ºÃ£©
\item µ¥¸ñÖÐ×Ô¶¯»»ÐÐ¡õÃ¿¸ö±í¸ñµÄÅäÖÃ¶ÀÁ¢´¢´æ
\item »ãÈë/»ã³öÆäËûµµ°¸¸ñÊ½£¨SDF¡¢CSV£©
\item ¹ýÂË¹¦ÄÜ£¨ÊäÈëÈç price{$>$}3.14 µÄ¹ýÂËÆ÷£©
\item ÅÅÐò¹¦ÄÜ£¨×ÔÐÐÊäÈëÐèÅÅÐòµÄÀ¸Î»£©
\item ¼´³¡±à¼­
\item ¸ÄÁ¼ÁËµÄ±í¸ñ²úÉúÖúÀí (table generator assistant)
\item ¸ÄÁ¼ÁËµÄÀ¸Î»±à¼­
\end{itemize}


Queries
\begin{itemize}
\item ¶¨Òå¡¢±à¼­ºÍ´¢´æ¡°ÓÃ¼Ò¶¨Òå²éÑ¯¡±(user defined queries)
\item °Ñ²éÑ¯´¢´æ×÷Îª¾°¹Û (views)
\item ²éÑ¯µÄÖ´ÐÐ
\item ¹Û¿´ select ÐÎÊ½µÄ²éÑ¯½á¹û
\item É¾³ýºÍ¸ü¸Ä²éÑ¯Ãû³Æ
\item ¾ßÍÏÒ·ºÍ·ÅÏÂ¹¦ÄÜµÄ Visual query builder¡£Èç¹ûÄãÓÐ°²×° Netscape 
Navigator µÄ Tcl/Tk ²å¼þ£¬Äã¿ÉÔÚ´Ë¿´µ½Ëü¹¤×÷¡Ã
£¨Òë°´¡Ã²»ÖªÔÚÄÄ£¿£¡£©
\end{itemize}


ÐòÁÐ (sequence)
\begin{itemize}
\item ¶¨Òå¡¢É¾³ýºÍ¼ì²éÐòÁÐ
\end{itemize}


º¯Êý (Function)
\begin{itemize}
\item Ê¹ÓÃ SQL ÓïÑÔ¶¨Òå¡¢¼ì²éºÍÉ¾³ýº¯Êý
\end{itemize}


½«À´»¹»áÓÐÒÔÏÂ¸Ä½ø
\begin{itemize}
\item ±í¸ñÉè¼Æ£¨Ôö¼ÓÀ¸Î»¡¢¸üÃûµÈµÈ£©
\item º¯Êý¶¨Òå
\item ±¨¸æ²úÉúÆ÷
\item »ù±¾µÄÃüÁî¸å±àÐ´¹¦ÄÜ
\end{itemize}




ÓÐ¹Ø LIBGTCL µÄ×ÊÁÏ

Äã»áÓÃµ½ PostgreSQL µ½ Tcl µÄ½éÃæ³ÌÊ½¿â libpgtcl£¬ËùÎ½µÄ Tcl/Tk 
¿É¡®ÔØÈë¡¯Ä£×é¡£libpgtcl ºÍÔ­Ê¼ÂëÎ»ì¶ PostgreSQL µÄ /src/interfaces/libpgtcl 
Ä¿Â¼¡£ÌØ¶¨À´Ëµ£¬ÄãÐèÒªÒ»¸ö¿ÉÔÚ Tcl/Tk¡®ÔØÈë¡¯µÄ libpgtcl 
³ÌÊ½¿â¡£¼¼ÊõÉÏÀ´Ëµ£¬ËüºÍÆÕÍ¨µÄ PostgreSQL ¿ÉÔØÈëÄ¿µÄµµ²¢²»ÏàÍ¬£¬ÒòÎª libpgtcl 
ÊÇÒ»¶ÑÄ¿µÄµµ (object files) µÄ¼¯ºÏ¡£Õâµµ°¸ÔÚ Linux ÃûÎª 
libpgtcl.so¡£Äã¿ÉÔÚÒÔÉÏÍøÖ·ÏÂÔØÒ»¸öÎª Linux i386 
ÏµÍ³Ô¤ÏÈ±àÒëÁËµÄ°æ±¾¡£Ö»Ðè°ÑÕâµµ°¸¿½±´µ½ÏµÍ³³ÌÊ½¿âÄ¿Â¼£¨/usr/lib£©
¼´¿É¡£ÈçÓÐÒÉÄÑ£¬ÆäÖÐÒ»¸ö½â¾ö·½·¨ÊÇÉ¾³ýÔ­Ê¼ÂëÖÐÓÐ¹ØÔØÈë libpgtcl.so 
µÄÒ»¾äºÍÊ¹ÓÃ pgwish£¨»ò wishpg£©À´ÔØÈë pgaccess.tcl£¬¶ø·Ç wish£¬ÒòÎªÕâ wish 
ÒÑÁ´½á libpgtcl º¯Ê½¿â¡£

Èç¹ûÄãÔÚ±àÒë pgaccess Ä¿Â¼Ê±Óöµ½ crypt not found µÄÎÊÌâ£¬ÇëÊ¹ÓÃ -lcrypt¡£


\subsection{PostgreSQL Í¼ÐÍ½éÃæ²éÑ¯¹¤¾ß GtkSQL }

GtkSQL ÊÇÒ»¸öÍ¼ÐÍ½éÃæ²éÑ¯¹¤¾ß£¨Ïñ PostgreSQL µÄ psql£©¡£ËüÒÔ GNU GPL 
·¢ÐÐ¡£Ê¹ÓÃ Gtk+ 1.2.3 ºÍ PostgreSQL 6.3 ¿ª·¢¶ø³É¡£

GtkSQL µÄÖ÷ÍøÕ¾Îª \nameurl{http://gtksql.sourceforge.net}{}¡£

ËüµÄÖ÷ÒªÌØÉ«°üÀ¨¡Ã
\begin{enumerate}
\item  ¶à¸ö SQL ÔÝ´æÇø
\item  SQL ¹Ø¼ü×Ö¡¢±í¸ñÃû³ÆºÍÀ¸Î»×Ô¶¯Íê³É
\item  ¼òÒ×ÏÔÊ¾±í¸ñ¶¨Òå
\item  PostgreSQL ºÍ MySQL Ö§Ô®£¨¶øÇÒÈÝÒ×¼ÓÉÏÆäËû×ÊÁÏ¿â£©
\end{enumerate}

GtkSQL Ä¿Ç°µÄ°æ±¾Îª v. 0.3¡£Äã¿ÉÔÚ
\nameurl{https://sourceforge.net/project/?form_grp=533}{} ÏÂÔØÔ­Ê¼Âë¡£


\subsection{ÊÓ´°ÖÐµÄ PostgreSQL »¥¶¯Ê½²éÑ¯¹¤¾ß£¨WISQL »ò MPSQL£©}

MPSQL Ìá¹©¸øÊ¹ÓÃÕßÒ»¸öÍ¼Ïñ SQL ½éÃæ¿ØÖÆ PostgreSQL¡£MPSQL Óë Oracle µÄ SQL 
Worksheet »òÎ¢Èí SQL Server µÄ²éÑ¯¹¤¾ß WISQL ÀàËÆ¡£ËüÓÐÒ»¸öÆ¯ÁÁµÄ GUI 
ºÍÖ¸Áî¼ÇÂ¼¡£ÄãÒ²¿ÉÒÔ¼ôÏÂ¼°ÌùÉÏ¡£Ëü»¹ÓÐÆäËûÓÐÖúÌá¸ßÉú²úÁ¦µÄ¹¦ÄÜ¡£
\begin{itemize}
\item  \nameurl{http://www.troubador.com/~keidav/index.html}{}
\item  µçÓÊ¡Ã
\onlynameurl{keidav@whidbey.com}
\item  \nameurl{http://www.ucolick.org/~de/}{} ÔÚ tcl\_syb/wisql.html µµÖÐ
\item  \nameurl{http://www.troubador.com/~keidav/index.html}{}
\item  µçÓÊ¡Ã
\onlynameurl{de@ucolick.org}
\end{itemize}



\subsection{ÃûÎª PSQL µÄ PostgreSQL »¥¶¯Ê½²éÑ¯¹¤¾ß£¨ISQL£©}

ISQL ÊÇ¹©ÎÄ×ÖÖ¸ÁîÐÐÖÕ¶Ë»úÊ¹ÓÃµÄ¡£ÕâÒÑ°üÀ¨ÔÚ·¢ÐÐ°æ±¾ÖÐ£¬ÃûÎª psql¡£ºÍ Sybase 
ISQL¡¢Oracle SQLplus Ê®·ÖÏàËÆ¡£ÔÚ Unix Ö¸ÁîÌáÊ¾ÊäÈë¡®psql¡¯»á³öÏÖ psql$>$ ÌáÊ¾¡£
\begin{tscreen}
\begin{verbatim}
bash# su - postgres
bash$ man psql
bash$ psql mydatabase
´ò \h ÒÔÔÄ¶ÁÖ¸ÁîµÄÇóÖúÑ¶Ï¢
\end{verbatim}
\end{tscreen}

·Ç³£Ê¹ÓÃÕßÓÑÉÆºÍÒ×ÓÃ¡£
¿ÉÔÚÍâ¿òÃüÁî¸å (shell script) ÖÐÊ¹ÓÃ¡£


\subsection{MPMGR¡õPostgreSQL µÄ×ÊÁÏ¿â¹ÜÀí¹¤¾ß}

 
MPMGR Îª PostgreSQL ÊÇ¹©Ò»¸öÍ¼Ïñ¹ÜÀí½éÃæ¡£Äã¿ÉÔÚÒÔÏÂµØ·½ÕÒµ½Ëü¡Ã
\begin{itemize}
\item  \nameurl{http://www.mutinybaysoftware.com/}{}
\item  Email:
\onlynameurl{keidav@mutinybaysoftware.com}
\item  \nameurl{http://www.troubador.com/~keidav/index.html}{} 
\item  µçÓÊ¡Ã
\onlynameurl{keidav@whidbey.com} 
\item  \nameurl{http://www.ucolick.org/~de}{} in file tcl\_syb/wisql.html 
\item  PostgreSQL µÄ WISQL\nameurl{http://www.ucolick.org/~de/Tcl/pictures}{} 
\item µçÓÊ¡Ã
\onlynameurl{de@ucolick.org} 
\end{itemize}



\subsection{PgAdmin¡¢PhpPgAdmin ¹¤¾ß}

\begin{itemize}
\item  ÊÓ´° 95/NT µÄ PgAdmin ¹¤¾ß
ÊÓ´° 95/NT µÄ PostgreSQL ×ÊÁÏ¿âÉè¼Æ¹¤¾ß
\nameurl{http://www.pgadmin.freeserve.co.uk}{}
\item  ÍøÉÏÔË×÷µÄ¹ÜÀí¹¤¾ß¡õPostgreSQL ÓÃµÄ PhpPgAdmin ÔÚ
\nameurl{http://www.phpwizard.net/projects/phpPgAdmin}{}
\end{itemize}



\subsection{PgBash - SQL shell ¹¤¾ß}

PgBash µÄ¹¦ÄÜÀàËÆ psql¡£¶øÇÒ£¬PgBash Ê¹ÓÃ bash µÄ´úºÅ 
(alias)¡¢º¯Êý¡¢ÀúÊ·±à¼­´´Ôì³öÒ»¸öÁé»îµÄ»¥¶¯²Ù×÷»·¾³£¬Ìá¹©ÓÐÓÃµÄ¹¦ÄÜ¡£

PgBash µÄÖ÷ÍøÒ³ÔÚ \nameurl{http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html}{}

PgBash ÊÇÒ»¸ö°üÀ¨ PostgreSQL¡°Ö±½Ó SQL¡±»ò¡°Ç¶ÈëÊ½ SQL¡± ("direct SQL" or the 
"embedded SQL") ½éÃæµÄ shell£¬¼®¸ÄÁ¼ bash£¨Ä¿Ç°×îÐÂ°æÎª 2.03£©shell 
¶øÀ´¡£PgBash ¿ÉÓÃ×÷µÇÈë shell¡¢sub-shell£¨´Ó shell Æô¶¯µÄ shell) ºÍ shell ³ÌÊ½¡£

ÔÚ´Ë£¬Ö±½Ó SQL ÓÐ°Ñ½á¹ûÖ±½ÓÊä³öµ½±ê×¼Êä³öµÄÄÜÁ¦¡£¶øÇ¶ÈëÊ½ SQL
ÓÐ°ÑÌáÈ¡³öÀ´µÄ½á¹ûÉè¶¨µ½ shell ±äÊýµÄÄÜÁ¦¡£ËüÃÇÔòÔÙ¾­ shell ÃüÁî¸å (script) 
ÓïÑÔ´¦Àí¡£

SQL Óï¾ä£¨ÒÔ·ÖÊý×÷½áÊø×ÖÍê£©±»µ±×÷Ò»¸ö shell Ö¸Áî´¦Àí£¬ÎÒÃÇ¿ÉÒÔÖ´ÐÐ SQL
Óï¾ä²¢ÓÃì¶¹ÜµÀ (pipeline)¡¢¸ÄÏòºÍ±³¾°¹¤×÷Ñ¡Ïî¡£´ËÍâ£¬Ê¹ÓÃ exec\_sql
Ö¸Áî£¬ÎÒÃÇ¿ÉÓÃ²»Í¬µÄÑ¡ÏîÀ´Ö´ÐÐ SQL Óï¾ä¡£Êµ¼ÊÖ´ÐÐ SQL µÄÀý×ÓÈçÏÂ¡£
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
prompt> /usr/local/bin/pgbash                ¡­¡­Æô¶¯ pgbash
pgbash> connect to db2@xxx.com user sakaida; ¡­¡­Á¬½Óµ½×ÊÁÏ¿â
pgbash> select * from test limit 100; | more ¡­¡­Ê¹ÓÃ¹ÜµÀ
pgbash> select * from test; > /tmp/sel.dat & ¡­¡­Ê¹ÓÃ¸ÄÏòºÍ±³¾°¹¤×÷
pgbash> addr='Osaka'
pgbash> insert into test values(
>  111,'name',                               ¡­¡­¿ÉÒÔ»»ÐÐ
> '$addr'                                    ¡­¡­Ê¹ÓÃ shell ±äÊý
> );
pgbash> connect to db3@yyy.com user postgres;
pgbash> set connection db2;                  ¡­¡­°ÑÄ¿Ç°µÄ×ÊÁÏ¿â¸ÄÎª db2
pgbash> select * from test;                  ¡­¡­×Ô db2 µÄ test ±í¸ñÑ¡Ôñ
pgbash> exec_sql -d db3 "select * from test3"¡­¡­Á¬½Óµ½ db3
pgbash> ls
pgbash> begin;
pgbash> declare cur cursor for select * from test;
pgbash> fetch in cur into :AA,:BB;           ¡­¡­Éè¶¨ shell ±äÊý
pgbash> echo "AA=$AA, BB=$BB"
pgbash> end;
pgbash> fc fetch                             ¡­¡­±à¼­ÀúÊ·¼ÍÂ¼ºÍÖ´ÐÐ
pgbash> !echo                                ¡­¡­ÔÙ´Î echo
pgbash> disconnect all                       ¡­¡­¹Ø±ÕËùÓÐÁ¬½Ó
pgbash> exit                                 ¡­¡­½áÊø pgbash
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{PostgreSQL µÄ Webmin ¹¤¾ß}

webmin ¹¤¾ß£¨Í¸¹ý¿ÉÒÔÊÇ±£°²µÄÍøÒ³À´¹ÜÀí Unix µçÄÔ£©µÄ×îÐÂ°æ±¾£¨0.82 °æ£©ÓÐÒ»¸ö
PostgreSQL Ä£×é¡£Äã¿ÉÊ¹ÓÃÕâÄ£×éÀ´ÐÂÔöÓÃ»§¡¢Èº×é¡¢×ÊÁÏ¿â¡¢±í¸ñ£¬Ò²¿É²éÔÄ±í¸ñ¡£

Äã¿ÉÔÚ \nameurl{http://www.webmin.com/webmin}{} ÕÒµ½ webmin¡£


\section{PostgreSQL ÓÃµÄÖÐÑë´¦ÀíÆ÷}

²ÎÔÄÎÄ¼þ \nameurl{http://metalab.unc.edu/LDP/HOWTO/CPU-Design-HOWTO.html}{} 
ÒÔµÃµ½¿ÉÓÃì¶ PostgreSQL µÄÖÐÑë´¦ÀíÆ÷Ãûµ¥£¬±¾ÎÄÒ²»áÌá¹©ÓÐ¹ØÖÐÑë´¦ÀíÆ÷µÄÏêÇé¡£

ÒÔÏÂÖÐÑë´¦ÀíÆ÷ (CPUs)£¨32 Î»ÔªºÍ 64 Î»Ôª£©¿ÉÖ´ÐÐ PostgreSQL¡£ËüÃÇ¶¼ÔËÐÐ Linux¡£
\begin{itemize}
\item  ´¦ÀíÆ÷Ö÷ÍøÕ¾ÊÇ¡ÃGoogle ËÑÑ°ÒýÇæ CPU
Õ¾¡°Computers{$>$}Hardware{$>$}Components{$>$}Microprocessors¡±\nameurl{http://directory.google.com/Top/Computers/Hardware/Components/Microprocessors}{}
\end{itemize}


ÒÔÏÂÎª GNU/GPL ¿ª·ÅÔ­Ê¼Âë´¦ÀíÆ÷Ãûµ¥¡Ã
\begin{itemize}
\item  ¿ª·ÅÔ­Ê¼Âë´¦ÀíÆ÷ÍøÕ¾¡õGoogle ËÑÑ° "Computers{$>$}Hardware{$>$}Open Source"
\nameurl{http://directory.google.com/Top/Computers/Hardware/Open_Source}{}
\item  OpenRISC 1000 Free 32-bit ´¦ÀíÆ÷ IP ºËÐÄ£¬Óë×¨¶ÏµÄ ARM ºÍ MIPS
¾ºÕù£¬Î»ì¶ \nameurl{http://www.opencores.org/cores/or1k}{}
\item  OpenRISC 2000 Î»ì¶ \nameurl{http://www.opencores.org}{}
\item  Å·ÖÞÌ«¿Õ×ÜÊðµÄ ESA-32bit ºÍ ESA-64bit ´¦ÀíÆ÷¡°LEON¡±Sparc \nameurl{http://www.estec.esa.nl/wsmwww/leon}{}
\item  GNU/GPL Freedom 64-bit F-CPU \nameurl{http://www.f-cpu.org}{} »ò \nameurl{http://f-cpu.tux.org}{}
Ó³ÉäÕ¾Ì¨Î»ì¶ \nameurl{http://www.f-cpu.de}{}
\item  STM 32 Î»Ôª£¬Ë«Ïò³¬´¿Á¿ (2-way superscalar) RISC ´¦ÀíÆ÷ \nameurl{http://www.asahi-net.or.jp/~uf8e-itu}{}
\item  ÒÔ Verilog »ò VRML Ð´³ÉµÄÃâ·ÑÎ¢´¦ÀíÆ÷ºÍ DSP IP ºËÐÄ \nameurl{http://www.cmosexod.com}{}
\item  ¿ÉÊ¹¿ª·¢¼Ó¿ìµÄÃâ·ÑÓ²¼þºËÐÄ \nameurl{http://www.scrap.de/html/opencore.htm}{}
\item  Opencores org¡õ¿ª·ÅÔ­Ê¼Âë¡¢×ÔÓÉ IP core \nameurl{http://www.opencores.org}{}
\item  Linux ¿ª·ÅÓ²¼þºÍÃâ·Ñ EDA ÏµÍ³ \nameurl{http://opencollector.org}{}
\item  ARM ´¦ÀíÆ÷ \nameurl{http://www.arm.com/Documentation}{}
\item  Cogent ´¦ÀíÆ÷ \nameurl{http://www.cogcomp.com}{}
\end{itemize}


ÒÔÏÂÎªÉÌÒµ´¦ÀíÆ÷Ãûµ¥¡Ã
\begin{itemize}
\item  ¶íÂÞË¹µÄ E2k 64-bit CPU£¨ºÜ¿ìµÄ´¦ÀíÆ÷£¡£¡£¡£©
ÍøÕ¾¡Ã\nameurl{http://www.elbrus.ru/roadmap/e2k.html}{}
Elbrus ÒÑºÍÃÀ¹úÉýÑôÎ¢ÏµÍ³½áÎªºÏ×÷»ï°é¡£
\item  º«¹úÈýÐÇ (Samsung) 64 Î»Ôª´¦ÀíÆ÷£¬À´×Ô DEC Alpha¡£
\nameurl{http://www.samsungsemi.com}{}
Alpha-64bit ´¦ÀíÆ÷ÔÚ \nameurl{http://www.alpha-processor.com}{}
ÈýÐÇºÍÃÀ¹úµÄ Compaq ÕýºÏ×÷¿ª·¢ Alpha ´¦ÀíÆ÷¡£
\item  Ó¢ÌØ¶û (Intel) IA 64 \nameurl{http://developer.intel.com/design/ia-64}{}
\item  È«ÃÀ´ï (Transmeta) crusoe ´¦ÀíÆ÷£¬ºÍ²»¾Ã½«À´µÄÈ«ÃÀ´ï 64 Î»Ôª´¦ÀíÆ÷¡£
\nameurl{http://www.transmeta.com}{}
\item  Sun Ultra-sparc 64 Î»Ôª´¦ÀíÆ÷
\nameurl{http://www.sun.com}{}
»ò \nameurl{http://www.sunmicrosystems.com}{}
\item  MIPS¡¡RISC ´¦ÀíÆ÷ \nameurl{http://www.mips.com}{}
\item  SGI Graphics MIPS Architecture ÖÐÑë´¦ÀíÆ÷ \nameurl{http://www.sgi.com/processors}{} 
\item  IDT MIPS Architecture ÖÐÑë´¦ÀíÆ÷ \nameurl{http://www.idt.com}{}
\item  IBM Power PC£¨Ä¦ÍÐÂÞÀ­£©\nameurl{http://www.motorola.com/SPS/PowerPC/index.html}{}
\item  Ä¦ÍÐÂÞÀ­Ç¶ÈëÊ½´¦ÀíÆ÷¡£¡õ¾Ý PowerPC¡¢M-CORE¡¢ColdFire¡¢M68k »ò M68HC 
ºËÐÄ \nameurl{http://www.mot-sps.com}{}
\item  M68k »ò  M68K ºËÐÄ \nameurl{http://www.mot-sps.com}{}
\item  ÈÕÁ¢ SuperH 64-bit RISC ´¦ÀíÆ÷ SH7750 \nameurl{http://www.hitachi.com}{} Èç¹ûÒ»´ÎÂòÒ»Íò¸ö£¬Ã¿¸öÖ»ÊÛËÄÊ®ÃÀÔª¡£
\item  Fujitsu 64-bit ´¦ÀíÆ÷ \nameurl{http://www.fujitsu.com}{}
\item  HAL (California) Super-Sparc 64-bit ´¦ÀíÆ÷ \nameurl{http://www.hal.com}{} Ò²ºÍ Sun µÄ sparc ½á¹¹ÏàÈÝ¡£
\item  Pyramid Technologies µÄ Seimens Pyramid ÖÐÑë´¦ÀíÆ÷
\item  Intel X86 ÏµÁÐ 32-bit ÖÐÑë´¦ÀíÆ÷£¬±¼ÌÚ¡¢ÈüÑïµÈµÈ¡£
\item  AMDs X86 ÏµÁÐ 32-bit ÖÐÑë´¦ÀíÆ÷£¬K-6¡¢Athlon µÈµÈ¡£
\item  National's Cyrix X86 ´¦ÀíÆ÷ 32-bit CPUs Cyrix µÈµÈ¡£ 
\item  ÆäËû¹ú¼Ò£¨Ì¨Íå¡¢º«¹ú£¬ÈÕ±¾£©µÄÆäËûÖÐÑë´¦ÀíÆ÷£¿£¿Çë¸æËßÎÒ¡­¡­
\end{itemize}


ÆäËûÖØÒªµÄ´¦ÀíÆ÷ÍøÕ¾Îª¡õ
\begin{itemize}
\item  Ø¥ËÄÐ¡Ê±È«Çò´¦ÀíÆ÷ÐÂÎÅ \nameurl{http://www.newsnow.co.uk/cgi/NewsNow/NewsLink.htm?Theme=Processors}{}
\item  µçÄÔ½á¹¹Íø¡õÎ»ì¶ \nameurl{http://www.cs.wisc.edu/~arch/www}{}
\item  ARM ´¦ÀíÆ÷ \nameurl{http://www.arm.com/Documentation}{}
\item  Î°´óµÄ´¦ÀíÆ÷ \nameurl{http://www.cs.uregina.ca/~bayko/cpu.html}{}
\item  Microdesign ×ÊÔ´ \nameurl{http://www.mdronline.com}{}
\end{itemize}



\section{Ö»Ê¹ÓÃÒ»¸öÏÔÊ¾Æ÷ (monitor) À´Éè¶¨¶àÌ¨ PostgreSQL µçÄÔ}

 
Èç¹ûÄã²»Ïë»¨Ç®ì¶Ó²¼þµÄÑ¡ÔñÆ÷£¬Äã¿É{\bfseries Ê¹ÓÃ VNC (Vitual Network Computing)
¼¼Êõ}£¬À´×ÔµçÑ¶Òµ¾ÞÈË AT \& T¡£ VNC ÊÇ GPL µÄ£¬ÊÇÒ»¸ö×ÔÓÉÈí¼þ¡£¼®Öø
VNC£¬Äã¿ÉÔÚÒ»¸öÃ»ÓÐÏÔÊ¾Æ÷µÄµçÄÔÖ´ÐÐ PostgreSQL
³ÌÊ½£¬¶øÔÚÔ¶¶ËµçÄÔµÄÏÔÊ¾Æ÷ÏÔÊ¾³öÀ´£¡£¡²»¹ý£¬ÄÇÐ©µçÄÔ±ØÐëÒÔ Ethernet
ÍøÂç½éÃæ¿¨Á¬½Ó¡£VNC ¿ÉÔÚ \nameurl{http://www.uk.research.att.com/vnc}{}
ÕÒµ½¡££¨Òë°´¡ÃVNC ÊÇÊ¹ÓÃ TCP/IP£¬ÀíÂÛÉÏÖ»ÒªÓÐ IP
µØÖ·±ã¿ÉÔÚÔ¶¶ËµçÄÔÁ¬½Ó£¬²»Ò»¶¨Òª Ethernet¡£²»¹ýËÙ¶È¿ÉÄÜºÜÂý¡££©

Äã¿ÉµþÆð¶àÌ¨µçÄÔÖ÷»ú¼°Ö»ÓÃÒ»¸öÏÔÊ¾Æ÷£¬¶øÓÃÒ»¸ö KWM£¨¼üÅÌ¡¢Ó°Ïñ¡¢ÏÔÊ¾Æ÷£©
(Keyborad, Video, Monitor) £¨Òë°´¡ÃM ÊÇ·ñµ±Îª»¬Êó£¿£©Ñ¡ÔñÆ÷À´Ñ¡ÔñËùÓÃµçÄÔ¡£
Õâ²»µ«½ÚÊ¡µØ·½£¬¼õÉÙ»ìÂÒ£¬Ò²½ÚÊ¡ÏÔÊ¾Æ÷¡¢¼üÅÌºÍ»¬Êó£¨Ã¿·Ý×ÜÖµ 100 ÖÁ 500 
ÃÀÔª£©¡£

¼®ÖøÑ¡ÔñÆ÷£¬Äã¿Éµþ¸ß¶àÌ¨ PostgreSQL ËÅ·þÆ÷£¨¿ª·¢¡¢²âÊÔ¡¢Éú²ú£©¡¢»¥ÁªÍøËÅ·þÆ÷¡¢
ftp ËÅ·þÆ÷¡¢ÄÚÁªÍøËÅ·þÆ÷¡¢µçÓÊËÅ·þÆ÷¡¢ÐÂÎÅËÅ·þÆ÷ÔÚÒ»¸ö´ó¹ñ¡£ÕâÑ¡ÔñÆ÷Ò²¿É¿ØÖÆÊÓ´°
95/NT ºÍ OS/2 µçÄÔ¡£

Çë²é¿´ÏÂÁÐÍøÖ·¡Ã
\begin{itemize}
\item  DataComm Warehouse Inc£¬µç»° 1-800-328-2261¡£ËûÃÇÌá¹©ËùÓÐÆ·ÖÖµÄµçÄÔÓ²¼þ 
\nameurl{http://www.warehouse.com}{} 4 ²ºÊÖ¶¯ KVM  Ñ¡ÔñÆ÷ (PS/2) ´óÔ¼ 
\$89.99¡£ Part No. DDS1354
\item  Network Technologies Inc \nameurl{http://www.networktechinc.com/servswt.html}{} (120 ÃÀÔª/PC 8 ²º) 
µÄÇåµ¥ÖÐ°üÀ¨ 'Server Switches' ºÍ 'Video only switches' 
\item  Scene Double Inc, Ó¢¹ú \nameurl{http://www.scene.demon.co.uk/qswitch.htm}{} 
\item  Cybex corporation \nameurl{http://www.cybex.com}{} 
\item  Raritan Inc \nameurl{http://www.raritan.com}{} 
\item  RealStar Solutions Inc \nameurl{http://www.real-star.com/kvm.htm}{} 
\item  Belkin Inc \nameurl{http://www.belkin.com}{} 
\item  Better Box Communications Ltd. \nameurl{http://www.betterbox.com/info.html}{} 
\item  µ½¸½½üµÄÓ²¼þÉÌÆÌ²éÑ¯¡°Server Switch¡±»ò³Æ¡°KVM Auto Switches¡±¡£
\end{itemize}
 

ÔÚ yahoo ËÑÑ°Æ÷ÖÐÕÒ³ö¸ü¶àÓÐ¡°Server Switches¡±»ò¡°KVM Switches¡±µÄ¹«Ë¾¡£

Ã¿¸ö PostgreSQL ×ÊÁÏ¿âËÅ·þÆ÷×îºÃÓÃÒ»²¿×¨ÓÃµÄ unix 
µçÄÔ£¬ÒÔÔöÇ¿±íÏÖ¡£ÈÎºÎÆäËû³ÌÊ½/ÐÐ³Ì¶¼²»ÒªÔÚÕâµçÄÔÉÏÖ´ÐÐ¡£
ÔÄ¶ÁÄãËù×¡µØ·½µÄ±¨ÕÂµÄÉÌÒµ°æÕÒ³öÓÐÄÄÐ©ÉÌÆÌÊÛÂô Intel µçÄÔºÍ 13 
¡õµ¥É«Ó©Ä»£¨Ê®·ÖÁ®ÒËµÄÓ©Ä»£©¡£ÄãÖ»ÐèÒªÓ²¼þ£¬¶ø{\bfseries ²»Ðè}Î¢ÈíÊÓ´° / 
DOS¡£×ÊÁÏ¿âËÅ·þÆ÷²»ÐèÒª²ÊÉ«ÏÔÊ¾Æ÷£¬ÒòÎªÄã¿ÉÔÚÒ»¸ö²ÊÉ«µÄ¸öÈËµçÄÔÉÏÒ£¿Ø¹ÜÀí¡£

Äã¿ÉÔÚÍøÉÏÉÌµêÂòµ½µ¥´¿µÄµçÄÔÓ²¼þ¡£Äã¿ÉÔÚÍøÉÏÅÄÂôÖÐÕÒµ½ºÃµÄ¼ÛÇ®¡£
\begin{itemize}
\item ÍøÉÏÉÌµêÓëÅÄÂô³¡\nameurl{http://www.egghead.com}{}
\item ÍøÉÏÉÌµê\nameurl{http://www.buy.com}{}
\item ÅÄÂô³¡\nameurl{http://www.ubid.com}{}
\end{itemize}


ÔÚÒÔÏÂµØ·½È¡µÃ RedHat£¨»òÆäËû·¢ÐÐ°æ±¾£©Linux µÄ¹âµú¡Ã
\begin{itemize}
\item Linux System Labs ÍøÖ·¡Ã\nameurl{http://www.lsl.com/}{}  7 ÃÀÔª
\item Cheap Bytes Inc ÍøÖ·¡Ã\nameurl{http://www.cheapbytes.com/}{} 7 ÃÀÔª
\end{itemize}
 
È·±£Äã¹ºÂòµÄÓ²¼þ±» RedHat Linux Ö§Ô®¡£¹ºÂòÇ°ÔÚ RedHat µÄ ftp 
Õ¾ÕÒ³ö»ñÍÆ¼öµÄÓ²¼þ£¬Èç SCSI Åä½ÓÆ÷ºÍÏÔÊ¾¿¨¡£ÓÃ´óÔ¼Áù°ÙÃÀÔª±ã¿ÉµÃµ½Ò»Ì¨Ç¿¾¢µÄ 
Intel µçÄÔ£¬ÓÃ RedHat Linux À´Ö´ÐÐ PostgreSQL¡£´ÓÊÓ´° 95¡¢OS/2¡¢Unix 
Motif¡¢ä¯ÀÀÆ÷£¨Èç Redbaron¡¢Opera¡¢Netscape ¼°ÆäËûØ¥¶à¸ö£©¾­ 
odbc/jdbc/perl/tcl À´Á¬½Ó PostgreSQL¡££¨ä¯ÀÀÆ÷ÕýÑ¸ËÙ³ÉÎª±ê×¼µÄ GUI 
¿Í»§ (client)¡££©

Ê¹ÓÃ KWM Ñ¡ÔñÆ÷£¬Äã¿ÉÖ»ÓÃÒ»¸öÏÔÊ¾Æ÷ºÍÒ»¸ö¼üÅÌÀ´¿ØÖÆ¶àÌ¨Ö÷»ú¡£


\section{PostgreSQL µÄÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷}

ÓÐÐ©Ó¦ÓÃ³ÌÊ½ËÅ·þÆ÷¿ÉºÍ PostgreSQL ºÏ×÷£¬¿ª·ÅÔ­Ê¼Âë»¹ÊÇÉÌÒµ°æ±¾¶¼ÓÐ¡£
ÖøÃûµÄ¿ª·ÅÔ­Ê¼ÂëÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷ÓÐÒÔ Perl Îª»ù´¡µÄ SmartWorker¡¢WIRM¡¢
Velocigen¡¢Enhydra£¨Java£©ºÍ Zope£¨Python£©£¬ÉÌÒµµÄÔòÓÐ IBM Websphere¡¢BEA 
Weblogic¡£

½¨ÒéÄãÊ¹ÓÃ±£°²µÄÍòÎ¬ÍøËÅ·þÆ÷Èç Apache + mod\_ssl + OpenSSL¡£ÔÚ \nameurl{http://www.c2.net/products/sh3}{} ²ÎÔÄ Redhat StrongHold ±£°²ËÅ·þÆ÷µÄ×ÊÁÏ¡£

ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷¿ÉÒÔËùÖ§Ô®µÄ³ÌÊ½ÓïÑÔ·ÖÀà¡£
Äã±ØÐëÊ¹ÓÃÒ»¸öÒÔ{\bfseries Äã×îÏ²»¶}µÄÓïÑÔÎª»ù´¡µÄÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷¡£

ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷µÄ·ÖÀàÈçÏÂ¡Ã
\begin{itemize}
\item  ÒÔ PERL ÓïÑÔÎª»ù´¡
\item  ÒÔ PHP ÓïÑÔÎª»ù´¡£¨ºÍ PERL ÏàËÆ£¬Ò²ÓÐµãËÆ Java£©
\item  ÒÔ Python ÓïÑÔÎª»ù´¡£¨Îï¼þµ¼ÏòÃüÁî¸åÓïÑÔ£©
\item  ÒÔ Java ÓïÑÔÎª»ù´¡£¨Sun Microsystems Java£©
\item  ÒÔ Tcl ÓïÑÔÎª»ù´¡£¨Tcl/TK¡õ³ÆÎª¡°Tickle¡±ÃüÁî¸åÓïÑÔ
\item  ÒÔ C++ ÓïÑÔÎª»ù´¡£¨C++ ºÍ CORBA£©
\end{itemize}



\subsection{PERL ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷ \label{perlserv}}

ºÍ¡°C¡±ÓïÑÔÏàËÆ£¬Perl ÓïÑÔÒÑÓÐºÜ³¤ÊÙÃü£¬¶øÇÒ Perl
ÔÚÎ´À´{\bfseries Ò»¶ÎºÜ³¤Ê±¼ä}»¹»á±»¹ã·ºÓ¦ÓÃ£¡ÔÚÄ³Ð©²Ù×÷ÉÏ£¬Perl ±È Java
{\bfseries ¿ìÈý±¶}£¨µ« Java ÔÚÄ³Ð©²Ù×÷ÉÏÒ²±È Perl ¿ì£©¡£ Java 
ÊÇÒ»¸ö·Ç³£¸´ÔÓµÄÏµÍ³£¬¼ÈÓÐÐéÄâ»úÆ÷£¬ÓÖÓÐÖ±ÒëÆ÷£¬Ê¹µÃËü·Ç³£»ºÂý¡¢²»ÎÈ¶¨ºÍ²»¿É¿¿¡£
Perl Ôò¼ò½à¡¢¿ìËÙ£¬¸üÊÇÎï¼þµ¼Ïò¡£

´ËÍâ£¬Perl ³ÌÊ½¿ÉÇáÒ×µØ±àÒë£¬ÒÔ½øÒ»²½¸ÄÁ¼±íÏÖ¡£Ê¹ÓÃ Perl2Exe Õâ¸öÖ¸ÁîÁÐ¹¤¾ßÀ´°Ñ
perl ÃüÁî¸å×ªÎª¿ÉÖ´ÐÐµµ \nameurl{http://www.indigostar.com/perl2exe.htm}{}¡£

PERL ¿ÉÊ¹ÓÃÒÔÏÂÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷
\begin{itemize}
\item  Mason \nameurl{http://www.masonhq.com}{} ÊÇÒ»¸ö¹¦ÄÜÇ¿¾¢£¬ÒÔ Perl 
Îª»ù´¡µÄÍøÒ³¿ª·¢ºÍ´«ËÍÒýÇæ¡£Ê¹ÓÃ Mason£¬Äã¿ÉÔÚÄãµÄ HTML ÖÐÇ¶Èë Perl
Âë£¬ÓÖ¿É×Ô¹²Ïí¡¢¿ÉÖØÓÃµÄÔª¼þ½¨Á¢ÍøÒ³¡£


\item  BingoX \nameurl{http://opensource.cnation.com/projects/BingoX}{}         
ÊÇÒ»¸ö¿ª·ÅÔ­Ê¼Âë¡¢Îï¼þµ¼ÏòµÄÍòÎ¬ÍøÓ¦ÓÃ¼Ü¹¹£¬ÓÃ mod\_perl
±àÐ´£¬ÒÔ´ó·ù¼õÉÙ½¨Á¢´óÐÍ¶¯Ì¬¡¢×ÊÁÏ¿âÇý¶¯µÄÍøÕ¾ºÍÓ¦ÓÃ³ÌÊ½ËùÐèÊ±¼ä¡£
 SmartWorkder ÊÇ Perl Àà±ðµÄ¼¯ºÏ£¬ÈÝÐíÄãµÄÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½³ÉÎªÕæÕýµÄÓ¦ÓÃ³ÌÊ½£¬
¶ø²»ÊÇ HTML Ñù±¾ÖÐËæÒâÇ¶Èë³ÌÊ½Âë¡£
SmartWorker \nameurl{http://www.smartworker.org}{}



\item  Apache-Perl ÕûºÏ¼Æ»®
mod\_perl Ê¹µÃÍêÈ«ÒÔ Perl Ð´³É Apache Ä£×éÓÐ¿ÉÄÜ¡£¶øÇÒ£¬Ç¶Èëµ½ËÅ·þÆ÷µÄ³Ö¾ÃÖ±ÒëÆ÷ 
(persistent interpreter) ±ÜÃâÁËÆô¶¯Íâ²¿Ö±ÒëÆ÷µÄÂé·³ºÍ Perl µÄÆô¶¯Ê±¼ä¡£

²ÎÔÄ \nameurl{http://perl.apache.org}{} ºÍ \nameurl{http://modperl.sourcegarden.org}{} µÄ {\bfseries mod\_perl\_garden} ¼Æ»®¡£


\item  Apache::ASP \nameurl{http://www.apache-asp.org}{}
°Ñ Active Server Pages ÒÆÖ²µ½ Apache ÍòÎ¬ÍøËÅ·þÆ÷£¬Ê¹ÓÃ Perl
×÷ÎªÖ÷»úµÄÃüÁî¸åÓïÑÔ¡£Apache::ASP ÈÝÐí¿ª·¢ÈËÔ±´´Ôì°üÀ¨»·½Ú¹ÜÀí (session
management) ¹¦ÄÜºÍÇ¶Èë Perl ÂëµÄ¶¯Ì¬ÍøÉÏÓ¦ÓÃ³ÌÊ½¡£ÁíÍâ£¬
Ëü»¹ÓÐºÜ¶àÇ¿¾¢µÄÑÓÉì¹¦ÄÜ£¬°üÀ¨ XML tablibs¡¢XSLT ÏÔÏÖ (XSLT
rendering)¡¢»¹ÓÐ²»ÔÚÔ­±¾ ASP API µÄÐÂÊÂ¼þ¡£


\item  WIRM£¨Web Interface Repository Manager£©ÊÇÒ»¸öÒÔ Perl
Îª»ù´¡µÄÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷£¬Ìá¹©Ò»¸ö¸ß½×µÄ±à³Ì»·¾³ÒÔ¿ª·¢ÍøÉÏ×ÊÑ¶ÏµÍ³ (web
information systems)¡£WIRM °üÀ¨Ò»¸öÎï¼þ¹ØÁªÊ½×ÊÁÏ¿âºÍÒ»Ì×ÓÃ×÷ÊÓ¾õ»¯
(visualizing)¡¢ÕûºÏºÍ·ÖÎöÒìÖÊ (heterogeneous) ¶àÃ½Ìå×ÊÁÏµÄ Perl ½éÃæ¡£WIRM
Ìá¹©¹¤¾ßÌæ¶àÃ½Ìå×ÊÁÏ¿â²úÉú¶ÔÄÚÈÝÃô¸ÐµÄ¾°¹Û (context-sensitive views)£¬
Ê¹¿ª·¢ÈËÔ±¿ÉÒÔ¿ìËÙ¿ª·¢ÔÚÄÚÈÝºÍ±í´ï·½Ê½ÊÊÓ¦²»Í¬ÀàÐÍÓÃ¼ÒÎïÌ¬ÍøÒ³¡£
²ÎÔÄ \nameurl{http://www.wirm.org}{}


\item  EmbPerl \nameurl{http://perl.apache.org/embperl}{} ÈÃÄã¿ÉÔÚ HTML
ÎÄ¼þÖÐÇ¶Èë Perl ³ÌÊ½Âë¡£Ê¹ÓÃ Perl ±íÊ¾Äã¿ÉÊ¹ÓÃÒ»ÖÖ¾«ÐÄÅÝÖÆµÄÓïÑÔ£¬ÔÚ WWW
ÔçÒÑ¹ã·ºÀûÓÃ¡£ÄãÒ²¿ÉÓÃÊýÒÔ°Ù¼ÆÔçÐ´ºÃµÄµÄ Perl Ä£×é¡õ°üÀ¨
DBI¡õÀ´´æÈ¡Ô½À´Ô½¶à×ÊÁÏ¿âÏµÍ³¡£


\item  ePerl \nameurl{http://www.engelschall.com/sw/eperl}{} Ö±ÒëÒ»¸ö¼ÓÉÏÁË
Perl 5 ³ÌÊ½µÄ ASCII µµ£¬Ö»´¦Àí Perl 5 ³ÌÊ½Âë¶ø²»Àí»á´¿ ASCII
Êý¾Ý¡£Ëü¿ÉÓÃ²»Í¬·½·¨ÔË×÷¡Ã×÷ÎªÒ»¸ö¶ÀÁ¢µÄ Unix ÂËÆ÷»ò°Ñ Perl 5
Ä£×éÕûºÏµ½Ò»°ãµÄµµ°¸²úÉú¹¤×÷£¬Òà¿É×÷ÎªÒ»ÖÖÇ¿¾¢µÄÍòÎ¬ÍøËÅ·þÆ÷ÃüÁî¸åÓïÑÔ£¬
À´²úÉú¶¯Ì¬ HTML Ò³¡£


\item  XPP \nameurl{http://opensource.cnation.com/projects/XPP}{} ´ú±í¡®XPP
Parses Perl¡¯»ò¡®XPML Page Parser¡¯£¬ÊÇÒ»¸ö¿ìËÙ¼æÓÐÐ§µÄ HTML
·ÖÎöÆ÷£¬¿É·ÖÎöÃûÎª XPML Ò³µÄ¶¯Ì¬ HTML Ò³ÖÐÇ¶ÈëÁËµÄ perlºÍÀàËÆ HTML µÄ±êÇ©¡£


\item  Gamla¡õÒ»¸öÒÔ Perl Îª»ù´¡µÄ RAD ºÍÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷¡£gamla
¼Æ»®µÄÄ¿µÄÊÇ´´ÔìÒ»¸öÓ¦ÓÃ³ÌÊ½¿ìËÙ¿ª·¢£¨RAD£©¹¤¾ßºÍÒ»¸öÒÔ Perl
Îª»ù´¡µÄÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷¡£ËùÓÐ Gamla ¼Æ»®²úÉúµÄÔ­³ÌÊ½Âë¶¼»áÔÚ¹«ÖÚÁìÓò
(public domain) ÊÍ·Å¡£
 
Gamla ÔÚ \nameurl{http://gamla.iglu.org.il}{}


\item  AxKit \nameurl{http://www.axkit.org}{} ÊÇÒ»¸ö Apache£¨ºÍ mod\_perl£©ºÍ 
XML Ó¦ÓÃ³ÌÊ½ËÅ·þÆ÷¡£ËüÄÜ¼´Ê±°Ñ XML ×ª»»ÎªÈÎºÎ¸ñÊ½£¬Èç HTML¡¢WAP »ò´¿ÎÄ×Ö¡£
×ª»»¹ý³Ì¿ÉÊ¹ÓÃ W3C ±ê×¼¼¼¿¼£¬»ò×ÔÐÐÉè¼ÆµÄ³ÌÊ½Âë¡£AxKit Ò²Ê¹ÓÃÄÚÖÃµÄ Perl
Ö±ÒëÆ÷À´Ìá¹©ÓÐÈ¤¶øÇ¿¾¢µÄ¼¼¿¼×÷ XML ×ª»»Ö®ÓÃ¡£

AxKit Ç¿µ÷µÄÊÇ°ÑÄÚÈÝºÍ±í´ï·½·¨·Ö¿ª¡£AxKit µÄ¹ÜÏß (pipelining)
¼¼ÇÉÈÝÐíÄÚÈÝ·Ö²»Í¬½×¶Î×ª»»Îª¿É±íÏÖµÄ¸ñÊ½£¬ÈÝÐí²¿·ÖÆ½Ì¨ÒÔ²»Í¬·½Ê½¿´µ½Êý¾Ý¡£
AxKit ÈÝÐíÍøÒ³Éè¼ÆÔ±¼¯ÖÐ¾«Á¦ì¶ÍøÕ¾Éè¼Æ£¬ÄÚÈÝ¿ª·¢Õß´¿´âÎªÄÚÈÝ¹¤×÷£¬
¶øÍøÕ¾¹ÜÀíÔ±Ò²ÄÜÔÚÆäÇ¿Ïî¾¡ÆäËùÄÜ¡£
\end{itemize}


Perl µÄÉÌÒµÍòÎ¬ÍøËÅ·þÆ÷
\begin{itemize}
\item Zelerate AllCommerce  \nameurl{http://www.zelerate.org/html/eng/home.shtml}{}
ÊÇÒ»¸öÉÌÒµ¡¢ÄÚÈÝ¡¢¿Í»§ºÍ¹ØÏµ¹ÜÀíÏµÍ³¡£Õâ¸ö¸ß±íÏÖ¡¢¿ÉÑÓÕ¹µÄ»¥ÁªÍøÓ¦ÓÃ³ÌÊ½ÒÔ Perl
Ð´³É£¬¼°ÓÃÁËÒ»¸öáá¶Ë×ÊÁÏ¿â¡£


\item VelociGen ·þÎñ XML¡¢×ÊÁÏ¿â»ò¼´Ê±ËÍµ½µÄ¶¯Ì¬ÄÚÈÝ£¬ËÙ¶ÈºÍ¾²Ì¬ HTML
Ò»Ñù¡õ´ïµ½ CGI µÄÁùÊ®±¶£¬¶øÄã²»ÐèÐÞ¸ÄÄãµÄÓ¦ÓÃ³ÌÊ½¡£VelociGen Ò²½åËÅ·þÆ÷¶Ë XML
±êÇ©¡¢ÒâÍâ±£»¤ (crash protection) ºÍ¶à²¿µçÄÔ¼ä¸ºÔØÆ½ºâ£¬Ê¹¿ª·¢¸ü¼òµ¥¡£
 
VelociGen ¿ÉÍêÃÀµØ¼ÓÈëµ½ÈÎºÎÆ½Ì¨ÉÏµÄÈÎºÎÍòÎ¬ÍøËÅ·þÆ÷£¬
ÔöÇ¿ËÅ·þÆ÷µÄ±íÏÖºÍ¼Ó¿ìÒÔ¶¯Ì¬ÄÚÈÝÖ÷µ¼µÄÍøÕ¾µÄ·´Ó¦¡£VelociGen
¿ÉÍ¬Ê±´¦Àí´óÁ¿ÒªÇó£¬±È Java Servlets ¿ìÊ®±¶»ò±È Cold Fusion ¿ìËÄ±¶¡£

Velocigen \nameurl{http://www.binevolve.com/velocigen}{}
\end{itemize}



\subsection{PHP ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷ \label{midgard}}

PHP ¿ÉÓÃÒÔÏÂÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷
\begin{itemize}
\item  Midgard PHP ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷ÒÔ PHP ÃüÁî¸åÓïÑÔÎª»ù´¡£¬¶ø PHP
Ö´ÐÐ¼«Îª¿ìËÙ¡õ±È Java ¿ì¡£Midgrad µÄÖ÷ÍøÕ¾Îª \nameurl{http://www.midgard-project.org}{}¡£PHP ¿ÉÓÃ Zend ±àÒëôßÓÅ»¯Æ÷±àÒë \nameurl{http://www.zend.com}{}¡£PHP Ö´ÐÐµÃºÜ¿ì£¬¶øËÙ¶È±È Java ¿ìÎåÖÁÊ®±¶¡£

²ÎÔÄ \ref{midgardinstall} {(Midgard °²×°)} ºÍ PHP HOWTO
\nameurl{http://www.linuxdoc.org/HOWTO/PHP-HOWTO.html}{}
\item Ariadne
\nameurl{http://www.muze.nl/software/ariadne}{} ÊÇÒ»¸öÍòÎ¬ÍøÓ¦ÓÃÏµÍ³¡£
Ëü°üº¬Ò»¸öÍêÕûµÄ¼Ü¹¹£¬ÓÃ PHP ÇáËÉµØ¿ª·¢ºÍ¹ÜÀíÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½¡£
ÕâÏµÍ³Ê¹ÓÃÒ»¸öÄ£×é»¯µÄ·½Ê½£¬ËùÓÐ½»Ò×¶¼Ê¹ÓÃ³éÏóµÄ½éÃæ¡£
Õâ×ö·¨Îª¸ü¸ÄÏµÍ³¹¤×÷»ò¼ÓÉÏÐÂ¹¦ÄÜ´øÀ´¼«´óµÄ×ÔÓÉ£¬¶øÇÒ²»ÐèÖØÐÂ±àÐ´ÆäËû²¿·Ö¡£
\end{itemize}



\subsection{Lutris Corp "Enhydra Enterprise" (Java) \label{Enhydra}}

Enhydra Ö§Ô® PostgreSQL ×ÊÁÏ¿â¡£

Enhydra ÊÇÒ»¸ö¼«ÎªÁ÷ÐÐµÄ Java/XML/J2EE ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷£¬ÓÉ Lutris 
Corporation ¿ª·¢¡£ËüÊÇÈ«Çò×îºÃµÄ Java/XML ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷¡£ËüÖ§Ô® 
EJB¡¢Servlets¡¢JSP¡¢JNDI¡¢JDBC¡¢JTA¡¢CORBA¡¢XMLC/Rocks¡¢DODS 
ºÍ¹ú¼Ê»¯¡£ËüÒÑÎªºÜ¶àÅ·ÃÀµÄ Fortune 500 ¹«Ë¾Ì½ÓÃ¡£French Telecom 
Ò»Àà¹«Ë¾ÕýÖ±½ÓÔÞÖú Enhydra¡£ËüÒÔ°Ù·Ö°Ù´¿Õý Java Ð´³É£¬¿Éì¶ \nameurl{http://www.enhydra.org}{} È¡µÃ¡£Enhydra ÊÇÒ»¸ö¿ª·ÅÔ­Ê¼Âë×¨°¸£¬
µ«ËüÒÔÉÌÒµÐÎÊ½ÓÉ Lutris Corp ÊÛÂôºÍÖ§Ô®¡£Çë²ÎÔÄ \nameurl{http://www.lutris.com}{}¡£

ÔÚ \nameurl{http://www.enhydra.org/software/documentation/enhydra/NewApp-DODS-Tutorial-PGSQL.html}{PostgreSQL with Enhydra} ÔÄ¶ÁÈçºÎÉè¶¨ PostgreSQL ºÍ Enhydra µÄÖ¸µ¼£¬Ò²Çë²ÎÔÄ \nameurl{http://www.enhydra.org/software/documentation/enhydra/Enhydra-NewApp-DODS-Tutorial.htm}{Setup database with Enhydra} ÒÔÁË½âÈçºÎÎª Enhydra Éè¶¨×ÊÁÏ¿â¡£

Äã¿ÉÓÃ Borland µÄ JBuilder ºÍ Enhydra ºÏ×÷¡£JBuilder ÔÚ \nameurl{http://www.inprise.com}{} ÕÒµ½¡£

Ò²Çëì¶ \nameurl{http://www.linuxdoc.org/HOWTO/Enterprise-Java-for-Linux-HOWTO.html}{} ²ÎÔÄ Enterprise Java HOWTO¡£


\subsection{Zope£¨Python£© \label{Zope}}

Python ½¥½¥³ÉÎª¼«Á÷ÐÐµÄ¡¸´¿¡¹Îï¼þµ¼ÏòÃüÁî¸åÓïÑÔ¡£Zope
ÊÇÒ»¸öÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷£¬Ìá¹©ÁË PostgreSQL ½éÃæ¡£Zope ¿ÉÔÚ \nameurl{http://www.zope.org}{} µÃµ½
Python ¿ÉÔÚ \nameurl{http://www.python.org}{} ÕÒµ½¡£


\subsection{OpenACS£¨Tcl ÓïÑÔ£©\label{OpenACS}}

OpenACS (Open ArsDigita Community System)
\nameurl{http://openacs.org}{}
ÊÇÒ»¸öÓÃÀ´½¨Á¢¿ÉÀ©Õ¹¡¢ÉçÈºÖ÷µ¼ (community-oriented)
ÍøÒ³Ó¦ÓÃ³ÌÊ½µÄÏÈ½ø¹¤¾ßÏä¡£ËüÒÀ¿¿ AOLserver£¬Ò»¸öÍøÒ³ / Ó¦ÓÃ³ÌÊ½ËÅ·þÆ÷£¬ºÍ
PostgreSQL£¬Ò»¸öÕæÕý·ûºÏ ACID µÄ
RDBMS¡£ËüÃÇÊÇÁ½¸öºÍ¿ª·ÅÔ­Ê¼ÂëÊÚÈ¨ÏÂµÄÃâ·Ñ¶ø¸ßÖÊµÄ²úÆ·¡£



ACS ÓÉ ArsDigita ±àÐ´£¬\nameurl{http://www.arsdigita.com}{}£¬ËüÃÇµÄ ACS
(ArsDigita Community System) ³¢ÊÔ¾¡Á¿¶ÀÁ¢ì¶×ÊÁÏ¿â£¬ËäÈ»ËüÔ­±¾ÒÔ Oracle
Îª»ù´¡£¨Òò´Ë Open ACS Òª»¨Ê±¼ä½øÐÐÒÆÖ²£©¡£

Ò²Çë²ÎÔÄ \nameurl{http://www.appserver-zone.com}{}¡£


\subsection{C++, CORBA ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷ \label{corba}}

\begin{itemize}
\item  PortalSphere ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷ÒÔ C++ Ð´³É£¬ÔÚ Unix£¨ºÍ
Linux£©Îª×î¸ßËÙ¶ÈºÍÎÈ¶¨¶ÈÔËÐÐ¡£PortalSphere ÑÏ¸ñµØ×ñ´Ó CORBA ±ê×¼£¬¼ÈÖ§Ô®±ê×¼µÄ
HTTP Í¨Ñ¶Ð­¶¨ºÍ IIOP µã¶ÔµãÐ­¶¨£¬ÒÔÌá¹©³¬¸ßËÙµÄÖ÷´ÓÁ¬½Ó¡£
ºÍËùÓÐÖøÃûµÄ×ÊÁÏ¿âÖ±½Ó½áºÏ£¬ÕâÐ©ÌØÉ«Ê¹ PortalSphere ¿ìÈçÉÁµç£¬
¶øÇÒ¶À¼ÒÓµÓÐÔÚ»¥ÁªÍøÉÏÖ§Ô®ÊµÊ±ÊÂ¼þµÄÄÜÁ¦¡£ PortalSphere ¿É±È HTTP/CGI
¿ìÒ»°Ù±¶¡£Ö±½ÓÁ¬½Óµ½´ó²¿·ÖÖøÃûµÄ×ÊÁÏ¿â£¬¿ÉÑÓÕ¹ÖÁÖ§Ô®³¬¹ýÒ»Íò¸öÓÃ»§Á¬½Ó¡£
 
µ½ \nameurl{http://www.portalsphere.com/overview.html}{} ÁË½â PortalSphere¡£


\item  FlashPoint C++¡¢C¡¢PERL ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷¼Æ»®µÄÄ¿Ç°ÊÇÔÚÒ»¸ö¶àÁ÷
(multi-thread) µÄ»·¾³Ö§Ô®¸ßËÙÍøÉÏÓ¦ÓÃ³ÌÊ½·þÎñ¡¢Ö§Ô®¶àÑùµÄ¿ª·¢ÓïÑÔ£¬°üÀ¨ C ºÍ
C++¡¢ºÍÖ§Ô®ÔÚºÜ¶àÆäËü»·¾³ÏÂÄÑÒÔÖ´ÐÐµÄÈí¼þ¹¤³Ì·½Ê½¡£Ëü¿ÉºÍ Apache
Ò»Æð¹¤¼þ£¬ÊÓºõÄãµÄÐèÒª£¬ÉõÖÁ¿ÉÈ¡´úËü¡£²ÎÔÄ \nameurl{http://www.bouldersoftware.com/products/flashpoint}{} ºÍÏÂÔØ \nameurl{http://www.bouldersoftware.com/products/flashpoint/download.html}{FlashPoint Redhat RPM} Ì×¼þ¡£ 


\item  "C Server Pages" \nameurl{http://cserverpages.20m.com}{}
ÊÇÒ»¸öÓÐÐ§ÂÊºÍ¿ÉÑÓÕ¹µÄÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷£¬ÒÔ C++Ð´³É£¬Ê¹ËüÓµÓÐ´¦ÀíÒÔ C++ 
Ð´³ÉµÄËÅ·þÆ÷Ò³ºÍÇ¶ÈëÁË¶¯Ì¬ÔªËØµÄÑù°æµÄÄÜÁ¦¡£Äã¿ÉÓÃÄãÏ²»¶µÄ·½Ê½£¬»òÁ½ÖÖ¶¼ÓÃ¡£
Äã¿ÉÓÃ C++ ½¨Á¢×Ô¼ºµÄÉÌÒµÎï¼þ¡£ÄãµÄÍøÒ³¿ÉÒÔÊÇÊÐ³¡ÉÏÈÎºÎ ORB µÄ CORBA ¿Í»§¡£
\end{itemize}



\subsection{ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷Ä¿Â¼ \label{webappdir}}

²ÎÔÄ \nameurl{http://198.85.71.76/html.html}{ÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½ËÅ·þÆ÷}
Ä¿Â¼£¬ÄÚÓÐÒ»·Ý¡°»ÆÒ³¡±¡£
 


\section{PostgreSQL µÄÓ¦ÓÃ³ÌÊ½ºÍ¹¤¾ß}


\subsection{PostgreSQL µÄ 4GL ÍòÎ¬Íø×ÊÁÏ¿â³ÌÊ½¡õAppGEN ¿ª·¢ÏµÍ³}

 
AppGEN ¿ÉÔÚ´ËÏÂÔØ
\begin{itemize}
\item  \nameurl{http://www.man.ac.uk/~whaley/ag/appgen.html}{} 
\item  \nameurl{ftp://ftp.mcc.ac.uk/pub/linux/ALPHA/AppGEN}{}. 
\end{itemize}
 
AppGEN ÊÇÒ»ÖÖ¸ß½×µÚËÄ´ú³ÌÊ½ÓïÑÔºÍÓ¦ÓÃ³ÌÊ½²úÉúÆ÷ (application 
generator)£¬ÓÃÒÔ²úÉúÒÔÍòÎ¬ÍøÎª»ù´¡µÄ³ÌÊ½¡£ÕâÐ©³ÌÊ½Ò»°ãÔÚ»¥ÁªÍø»ò¹«Ë¾ÄÚÁªÍøÊ¹ÓÃ¡£
AppGen ³ÌÊ½ÒÔºÏºõ Common Gateway Interface (CGI) ±ê×¼µÄ C ÃüÁî¸å (C scripts) 
Ð´³É£¬´ó²¿·Ö»¥ÁªÍøËÅ·þÆ÷¶¼¿ÉÖ§Ô®¡£

ÒªÊ¹ÓÃ AppGen£¬ÄãÐèÒª¡Ã

PostgreSQL£¬¹ØÁªÊ½×ÊÁÏ¿âÏµÍ³

Ö§Ô® CGI µÄ»¥ÁªÍøËÅ·þÆ÷£¬Èç NCSA µÄ HTTPD

Ò»¸ö ANSI C ±àÒëÆ÷£¬Èç GCC

AppGEN °üÀ¨ÒÔÏÂ Unix £¨Linux£© ¿ÉÖ´ÐÐ³ÌÊ½¡Ã

\begin{itemize}
\item       defgen£¬Ëü»á¸ù¾ÝÂß¼­×ÊÁÏ½á¹¹²úÉúÒ»¸ö»ù´¡µÄÑù°å³ÌÊ½¡£
ÕâÐ©³ÌÊ½¿É¼ÓÈë¡¢¸üÐÂ¡¢É¾³ýºÍÑ°ÕÒ×ÊÁÏ¿âÖÐµÄ¼ÍÂ¼£¬ÓÖ¿É×Ô¶¯±£³Ö²Î¿¼ÕûºÏÐÔ 
(referential integrity)¡£
      
\item       appgen£¬AppGEN µÄ±àÒë³ÌÊ½¡£Ëü»á°Ñ AppGEN µÄÔ´³ÌÊ½Âë±àÒëÎª¿ÉÓÉ 
CGI Ö´ÐÐµÄ C Ô­Ê¼Âë¼°¿É¼´Ê±ÔÚÍøÉÏÊ¹ÓÃ HTML ¸ñÊ½ÎÄ¼þ¡£
  
\item       dbf2sql£¬°Ñ dBase III ÏàÈÝµÄ .dbf µµ×ª»»Îª¿ÉÖ´ÐÐµÄ SQL 
ÃüÁî¸åµÄ¹¤¾ß³ÌÊ½¡£ÕâÊ¹µÃ´ó²¿·Ö´¢´æÔÚ DOS/ÊÓ´°×ÊÁÏ¿âÌ×¼þµÄ×ÊÁÏ¿ÉÒÆÖ²µ½Ò»¸ö SQL 
ËÅ·þÆ÷£¬Èç PostgreSQL¡£
\item ´ËÍâ£¬AppGEN ÊÕ¼¯ÁËÒ»Ð©»áÔÚÖ´ÐÐÆÚ¼äÊ¹ÓÃµÄ HTML ÎÄ¼þ¡¢GIF µµºÍ Java 
Ð¡³ÌÊ½¡£µ±È»£¬ÈçËùÓÐºÃµÄÈí¼þ°ã£¬ËüÒ²°üÀ¨ÍêÕûµÄÔ´³ÌÊ½Âë¡£
\end{itemize}
 

×÷Õß Andrew Whaley ¿ÉÒÔÒÔÏÂÍ¾¾¶½Ó´¥¡Ã 
\begin{itemize}
\item        \onlynameurl{andrew@arthur.smuht.nwest.nhs.uk} 
\end{itemize}
 
 


\subsection{PostgreSQL µÄ»¥ÁªÍø½éÃæ¡õDBENGINE}

dbengine ÊÇ Ingo Ciechowski ËùÐ´µÄÒ»¸öËæ²å¼´ÓÃµÄ PostgreSQL »¥ÁªÍø½éÃæ¡£ËüÔÚ
\begin{itemize}
\item   \nameurl{http://www.cis-computer.com/software/dbengine/ }{} 
\end{itemize}
 
{\bfseries ÓÐ¹Ø DBENGINE¡Ã}
dbengine ÊÇ»¥ÁªÍøÓë Postgres95 Ö®¼äµÄ½éÃæ£¬Ö»Ðè»¨Êý·ÖÖÓ£¬
Ëü±ã¿É´æÈ¡ÈÎºÎÏÖ´æµÄ×ÊÁÏ¿â¡£

PHP ÈÃÄãÔÚÎÄ¼þÖÐ±àÐ´ÀàËÆ Perl µÄÓïÑÔ£¬µ«²»ÊÇÕæµÄ Perl£¬AppGEN ºÍ WDB-P95 
ÐèÒªÄãÎªÃ¿Ò»¸ö×ÊÁÏ¿â½¨Á¢Éè¶¨µµ (configuration files)¡õ¡õÌýÆðÀ´£¬
ÄãËÆºõ¶¼ÒªÏÈÑ§Ò»ÀàÐÂµÄ¼ÙÓïÑÔ (meta language) ²ÅÄÜÆôÓÃ¡£

ºÍÆäËû¹¤¾ß²»Í¬£¬Äã²»ÐèÒªÑ§ÈÎºÎÌØ±ðµÄ³ÌÊ½»òÃüÁî¸åÓïÑÔÀ´Ê¹ÓÃ 
dbengine¡£Ò²²»»áÓÐÃ¿¸ö×ÊÁÏ¿â¶¼ÓÐÉè¶¨µµµÄÇé¿ö£¬ËùÒÔÄã²»ÐèÒªÊìÏ°ÕâÐ©ÐÂ½á¹¹¡£
²»¹ý£¬Èç¹ûÄãÏëÓÃµ½ dbengine µÄÍêÕû¹¦ÄÜ£¬Ñ§Ï° Perl »áÊÇÒ»¸öºÃÖ÷Òâ¡£

Õû¸öÏµÍ³¿É¼®´¦ÀíÒ»¸ö¸½¼ÓµÄ×ÊÁÏ¿âÉè¶¨ºÃ£¬
Ëü»á°üº¬ÓÐ¹ØÈçºÎÀí½âÄãµÄ×ÊÁÏ¿â´æÈ¡µÄ×ÊÁÏ¡£ÄãÉõÖÁ¿ÉÒÔÖ¸¶¨Ðé¼ÙÀ¸ (virtual 
fields)£¬ÓÃÒÔÔÚ×ÊÁÏÏÔÊ¾ÔÚÓ©Ä»Ö®Ç°×÷³ö¼´Ê±¼ÆËã¡£
 


\subsection{PostgreSQL µÄ Apache ËÅ·þÆ÷Ä£×é¡õNeoSoft NeoWebScript}

 
Apache ÊÇÒ»¸öÓÐÃûµÄ»¥ÁªÍøËÅ·þÆ÷¡£Ò»¸ö PostgreSQL µ½ Apache µÄ½éÃæÄ£×éÎ»ì¶¡õ
\begin{itemize}
\item   \nameurl{http://www.neosoft.com/neowebscript/}{} 
\end{itemize}
 
NeoWebScript ÊÇÒ»³ÌÈÝÐíÄã°Ñ²»Í¬¸´ÔÓ³Ì¶ÈµÄ³ÌÊ½Ç¶Èëµ½ HTML µµ³ÌÊ½ÓïÑÔ¡£

µ±ÓÐÈËÒªÇóÒ»¸ö°üº¬ NeoWebScript µÄ HTML ÍøÒ³Ê±£¬Ö§ÊÚ NeoWebScript 
µÄËÅ·þÆ÷±ãÖ´ÐÐÇ¶ÈëÁËµÄÃüÁî¸å (script)£¬²úÉúÒ»¸öº¬ÓÐ×Ô¶©ÄÚÈÝµÄÍøÒ³¡£

NeoWebScript ÊÇÖ±½ÓÔÚÍøÒ³µÄ HTML Âë±àÐ´¹¦ÄÜÇ¿´ó¡¢
ËÅ·þÆ÷Îª»ù´¡µÄ»¥¶¯³ÌÊ½µÄÒ»¸ö·½·¨£¬¸ßËÙ¡¢°²È«¡¢Ò×Ñ§¡£¼®Öø 
NeoWebScript£¬¼´Ê¹¶ÔÐÂÊÖÀ´Ëµ£¬¼ÆÊýÆ÷ (counter)¡¢µçÓÊ±í¸ñ (email 
forms)¡¢Ç½Ö½¡¢Ç©Ãû²¾ (guest books)¡¢·Ã¿Í¼ÍÂ¼¶¼±äµÃ¼òµ¥¡£Çë¿´¿´ NeoWebScript 
¶Ô×Ô¼º¡¢PERL ºÍ JavaScript ×÷³öµÄ±È½Ï¡£

Èç¹ûÄãÏëÔÚÄãµÄ»¥ÁªÍøËÅ·þÆ÷°²×° NeoWebScript£¬
ÄãµÄÍøÂç¹ÜÀíÔ±ÔÚ¿ªÊ¼Ç°ÐèÏÈÔÄ¶ÁËûÃÇµÄ Sysop FAQ¡£¡¶Theory of Operations¡·»á½âÊÍ 
NeoWebScript ÈçºÎÔË×÷£¬¡¶Installation¡·»áÖð²½ËµÃ÷¡£¡¶Management¡·
¹Øì¶Éè¶¨ºÍÖ´ÐÐËÅ·þÆ÷µÄÊÂÒË£¬¡¶Test¡·ÈÃÄãÈ·¶¨ NeoWebScript 
ÔË×÷Õý³££¬¡¶Troubleshooting¡·ºÍËÅ·þÆ÷µÄÎÊÌâÓÐ¹Ø¡£

ÔÚ×Ô¼ºµÄ ISP¡¢ÄÚÁªÍø»òÍâÁªÍøÊ¹ÓÃ NeoWebScript ·ÑÓÃÈ«Ãâ£¬
Äã»áÔÚµÇ¼ÇÏÂÔØÊ±µÃµ½ÍêÈ«µÄÖ´ÕÕ¡£²»¹ý£¬
Èç¹ûÄãÏë°ÑËüÇ¶Èëµ½×Ô¼ºµÄ²úÆ·»òÔÚÉÌÒµµÄËÅ·þÆ÷£¨Èç SSL£©Ê¹ÓÃ£¬Ëü×ÜÖµ 99 ÃÀÔª¡£

NeoWebScript ÊÇÒ»¸öÈÝÐíÄãÔÚÍøÒ³ÖÐÇ¶Èë Tcl/Tk ÓïÑÔ×÷ÎªÃüÁî¸å¹¤¾ßµÄ Apache 
Ä£×é¡£ËüÓÉ Karl Lehenbauer£¬NeoSoft µÄ Chief Technical Officer ·¢Ã÷£¬²¢ÓÉ 
Neosoft µÄ³ÌÊ½Éè¼ÆÊ¦ºÍ¼¼Êõ×«¸åÔ±±àÐ´ÎÄ¼þ¡¢¸ÄÁ¼¼°¼ÓÇ¿¹¦ÄÜ¡£

Apache ÊÇÊÀÉÏ×îÁ÷ÐÐµÄ»¥ÁªÍøËÅ·þÆ÷£¬¾­µ÷²éµÄÍøÕ¾ÖÐÓÐÁùÊ®°Ë°ÍÏÉÊ¹ÓÃ¡£

Tcl/Tk ÊÇÓÉ Dr. John Ousterhout ¿ª·¢µÄÒ»ÖÖÇ¿¾¢¡¢×ÔÓÉ¡¢¿çÆ½Ì¨µÄÃüÁî¸åÓïÑÔ¡£
ËûËµ¹ý¡°Tck/Tk¡±ÈÝÐíÈí¼þ¿ª·¢ÈËÔ±±ÈÊ¹ÓÃÒÔ C »ò C++ Îª»ù´¡µÄ¹¤¾ß¿ìÊ®±¶Íê³É¹¤×÷¡£
ËüÒ²ÊÇÒ»ÖÖÎ°´óµÄ½ºË®ÓïÑÔ (glue language)£¬Ê¹µÃÏÖ´æµÄ³ÌÊ½¹²Í¬¹¤×÷¡¢
¸üÍ¼Ïñ»¯ºÍ¿ÉÓÃì¶»¥ÁªÍø¡£¡±



NeoSoft ´´°ìÈË¼° Chief Technical Officer£¬Karl Lehenbauer ÔÚ¿ªÊ¼Ê±±ãÒÑ²ÎÓë 
Tcl/Tk ¿ª·¢¡£ËûÒ²ºÍ Mark Diehkans Ò»Æð´´×÷ÁË Extended Tcl£¬ÓÖÃûÎª TclX »ò 
NeoSoft Tcl£¬ÑÓÉìÕâÖÖÓïÑÔµÄ¹¦ÄÜ¡£ºÜ¶à Tcl µÄºËÐÄÖ¸Áî¶¼À´×Ô Extended Tcl£¬¶øÓÉ 
Dr. Ousterhout ¼ÓÈëµ½ºËÐÄÓïÑÔÖÐ¡£

NeoSoft Inc., 1770 St. James Place, Suite 500, Houston, TX 77056 USA 
 


\subsection{HTML µÄËÅ·þÆ÷¶ËÑÓÉì HEITML ºÍÒ»¸ö PostgreSQL µÄ 4GL ÓïÑÔ}

 
heitml ÊÇÁíÒ»¸ö postgres ÓëÍòÎ¬Íø¼äµÄ½éÃæ¡£ÓûÖªÏêÇé£¬Çë½Ó´¥
\begin{tscreen}
\begin{verbatim}
 
          Helmut Emmelmann H.E.I. Informationssyteme GmbH 
          Wimpfenerstrasse 23 Tel. 49-621-795141 
          68259 Mannheim Germany Fax. 49-621-795161 
\end{verbatim}
\end{tscreen}
 
\begin{itemize}
\item    Mr.Helmut Emmelmann µÄµçÓÊµØÖ· \onlynameurl{emmel@h-e-i.de} 
\item  Heitml Ö÷ÍøÒ³ \nameurl{http://www.heitml.com}{} 
\item  Heitml ´ÎÍøÒ³ \nameurl{http://www.h-e-i.deom}{} 
\end{itemize}
 

Heitml Í¬Ê±ÊÇ HTML µÄËÅ·þÆ÷¶ËÑÓÉìºÍÒ»ÖÖ 4GL ÓïÑÔ¡£ÍøÒ³±àÐ´ÈËÔ±¿ÉÒÔ HTML 
µÄ·ç¸ñÓÃÀàËÆ HTML ±êÇ©±àÐ´³ÌÊ½¡£

Heitml£¨Òô "Hi"-TML£©ÊÇ HTML µÄÑÓÉì¼°Ò»¸öÈ«ÃæµÄµÚËÄ´úÓïÑÔ£¬
ËüÈÝÐíÒÔ»¥ÁªÍøÎª»ù´¡µÄ³ÌÊ½Ö±½ÓÀûÓÃ SQL ×ÊÁÏ¿âÖÐµÄ×ÊÁÏ£¬¶ø²»ÐèÊ¹ÓÃ¸´ÔÓµÄ CGI 
ÃüÁî¸å¡£

Heitml ÔÚËÅ·þÆ÷¶ËÑÓÉì HTML£¬¶¯Ì¬µØ°Ñ¡°.hei¡±µµ×ª»»Îª HTML ¸ñÊ½£¬
Ê¹ËüÓëÈÎºÎä¯ÀÀÆ÷¼æÈÝ¡£Ëü°üÀ¨´ó¼ÒÊìÏ¤¡¢Ò×ÓÃµÄ HTML Óï·¨£¬
¼°Ìá¹©´óÁ¿Ô¤ÏÈ¿ª·¢ÁËµÄ±êÇ©ºÍ³ÌÊ½¿âÀ´Ó¦¸½ÒÔÍùÓÉ CGI ½øÐÐµÄ¹¤×÷¡£Ïñ XML 
°ã£¬heitml ÈÝÐíÊ¹ÓÃÕß×Ô¶¨±êÇ©¡£¼®Öø heitml£¬Ê¹ÓÃÕß×Ô¶¨µÄ±êÇ©¿É·­ÒëÎª HTML 
¼°´«ËÍ¸øä¯ÀÀÆ÷¡£

Heitml Í¬Ê±ÒÔ HTML Éè¼ÆÕßºÍ×¨ÒµµÄ³ÌÊ½Éè¼ÆÊ¦ÎªÄ¿±ê¡£HTML Éè¼ÆÊ¦¿ÉÊ¹ÓÃ heitml 
±êÇ©À´½¨Á¢¶¯Ì¬µÄÍøÒ³£¬´æÈ¡ SQL ×ÊÁÏ¿â£¬»ò½¨Á¢ÍêÕûµÄÍòÎ¬ÍøÓ¦ÓÃ³ÌÊ½¡£¼ÆÊýÆ÷¡¢
µÇ¼Ç×ÊÁÏ¿â (registration databases)¡¢ËÑÑ°Æ÷±í¸ñ¡¢µçÓÊ±í¸ñ¡¢½×²ãÊ½Ñ¡µ¥ 
(hierachical menus) ¶¼¿ÉÇáËÉµØ¼®ÖøÔÚ´óÁ¿Ôª¼þº¯Ê½¿â (Component Libraries) 
Ô¤½¨µÄÀàËÆ HTML µÄ±êÇ©²úÉú¡£

¶Ô³ÌÊ½Éè¼ÆÊ¦À´Ëµ£¬heitml ÔÚ HTML ÖÐÇ¶ÈëÁËÍêÕûµÄµÚËÄ´ú³ÌÊ½ÓïÑÔ£¬

\begin{tscreen}
\begin{verbatim}
 
(Èç <if>, <while>, ºÍ <let> ±êÇ©)£¬ 
\end{verbatim}
\end{tscreen}
 
ºÍ¶Ôº¬ÕûÊý¡¢ÊµÊý¡¢²¼ÁÖÖµ¡¢×Ö´®ºÍÔª×é (tuple) µÄ±í´ïÊ½Ç¿¾¢ÔËËãÄÜÁ¦¡£
Ôª×éµÄ²Î¿¼Óï·¨ (reference semantics) ¾ÍÏñÎï¼þµ¼ÏòÓïÑÔ£¬¼°´¢´æÔÚ¶ÑµþÖÐ¡£Heitml 
±äÊý£¬°üÀ¨ËùÓÐÔÚ¶ÑµþÖÐµÄ¸´ÔÓ×ÊÁÏ½á¹¹£¬ÔÚ Session Mode ÖÐ¿ÉÔÚ²»Í¬ÍøÒ³¼äÎ¬³Ö¡£
ÄãÒ²¿ÉÒÔ×Ô¶©±êÇ©»ò»·¾³±êÇ© (environment tags)£¬ÉõÖÁÖØÐÂ¶¨Òå HTML ±êÇ©¡£

heitml Ê¹µÃÒÔÏÂÊÂÇéÓÐ¿ÉÄÜ

¡õ¡õÒÔ¾ß½á¹¹¼°Ä£×é»¯ (structured and modular) ·½Ê½¿ª·¢ÍøÒ³£¬´ó·ù¼õµÍÎ¬»¤À§ÈÅ¡£

¡õ¡õ¿ª·¢ÓÐÖÇ»Û¼°»¥¶¯µÄÍøÒ³£¬ÄÚÈÝ¿É¶¯Ì¬µØÊÊÓ¦ÓÃÕßËùÐè¡£

¡õ¡õÎÞÐèÉè¼Æ³ÌÊ½±ã¿ÉÏÔÊ¾ SQL ×ÊÁÏ¿âµÄÄÚÈÝ£¬ÄãÖ»ÐèÒªÊ¹ÓÃÔ¤ÏÈ
¶¨ÒåµÄ¡°dba¡±ÏµÁÐ±êÇ©¡£

¡õ¡õÊ¹ÓÃ Session Variables ¿ª·¢¸´ÔÓµÄ×ÊÁÏ¿â¼°Ä¿Â¼¹ºÎï³ÌÊ½¡£

Heitml ¿É¾­ CGI ½éÃæÔÚ Linux µÄÈÎºÎ»¥ÁªÍøËÅ·þÆ÷ÖÐÖ´ÐÐ£¬¶øÔÚ Apache ÖÐ¿ÉÊ¹ÓÃ 
apache API Ê¹µÃÖ´ÐÐËÙ¶ÈÌØ±ð¿ì£¨±ÜÃâÁË CGI µÄ¹¤×÷£©¡£Ä¿Ç°£¬ËüÖ§Ô® 
mSQL£¨µÚÒ»¼°¶þ°æ£©¡¢PostgreSQL£¨µÚÁù°æ£©¡¢mySQL¡¢¼° the yard 
databases¡£heitml ¿ÉÔÚ Linux¡¢BSDi¡¢Solaris ºÍ SunOS Ö´ÐÐ£¬ÒÔ¼°ÔÚÊÓ´° NT ¼ÓÉÏ 
CGI ºÍ ISAPI¡¢ODBC¡¢ÊÓ´° 95 ÖÐÊ¹ÓÃ¡£

heitml£¨Linux °æ£©¶ÔÑÐ¾¿¡¢·ÇÉÌÒµÐÔºÍ¸öÈËÓÃÍ¾ÊÇÃâ·ÑµÄ¡£ÉÌÒµÍøÕ¾Ðè¸½³öÊÚÈ¨·Ñ¡£
ÉèÓÐÊÔÓÃÆÚÏÞ¶ø¹¦ÄÜÍêÕûµÄÊÔÓÃ°æ¿ÉÃâ·ÑÏÂÔØ¡££¨²»¹ýÒª×¢Òâ£¬Ã¿¸öÄã¿ª·¢µÄ¡°.hei¡±
ÍøÒ³¶¼»áÓ¡³öÒ»¸öÑ¶Ï¢Ö¸³öËüÊÇ·ÇÉÌÓÃ°æ±¾¡£µÇ¼ÇÖ®ááÄã»áÊÕµ½Ò»¸ö¼üÂë£¬
Ê¹Äã¿É¹ØµôÕâÑ¶Ï¢¶øÎÞÐèÖØÐÂ°²×°¡££©

heitml£¨Òô¡°Hi¡±-TML£©¼®Öø¿É×ÔÐÐ¶¨ÒåµÄ±êÇ©ºÍÍêÕûµÄ³ÌÊ½Éè¼ÆÄÜÁ¦´ó·ùÑÓÉì¼°ÔöÇ¿ 
HTML µÄ¹¦ÄÜ¡£ÕâÊ¹¶¯Ì¬µÄÄÚÈÝºÍ×ÊÁÏ¿â³ÌÊ½¿ÉÔÚ HTML ÊÀ½çÖÐ³öÏÖ£¬¶ø²»ÐèÒª CGI 
»òÍâ²¿ÊÖ¸å»ò³ÌÊ½ÓïÑÔ¡£Ò²¾ÍÊÇËµ£¬Ò»¸ö HTML ×÷Õß¿ÉÔÚÍøÒ³ÖÐÇ¶ÈëÓ¦ÓÃ³ÌÊ½¡£
ÕâÖ»ÐèÒªÊ¹ÓÃÐÂµÄ±êÇ©£¬¶ø²»Ðè CGI »ò³ÌÊ½Éè¼Æ¡£ÁíÒ»·½Ãæ£¬
½ø½×Ê¹ÓÃÕß»ò³ÌÊ½Éè¼ÆÊ¦¿É´´Ôì¼°Éè¼ÆÇ¿¾¢µÄ±êÇ©¿â¡£Õâ×ö·¨Ê¹µÃ heitml ¶Ô HTML 
ÐÂÊÖºÍ×¨Òµ³ÌÊ½Éè¼ÆÊ¦¹²Ê±ÊÊÓÃ¡£heitml ÔÚÍòÎ¬ÍøËÅ·þÆ÷ÉÏÖ´ÐÐ¼°¶¯Ì¬µØ²úÉú 
HTML£¬ËùÒÔ heitml ºÍ»¥ÁªÍø±ê×¼¼æÈÝ£¬Ò²ºÍÈÎºÎä¯ÀÀÆ÷¼æÈÝ¡£
ËüÒ»·½ÃæÎªÓÃÕßÌá¹©ÍêÕûµÄ×ÊÁÏ¿â´æÈ¡¹¦ÄÜ£¬ÁíÒ»·½ÃæÊ¹ÓÃÕßÎÞÐèÀí»áÈÎºÎ²»±ØÒªµÄ 
CGI ¸´ÔÓÐÔ¡£heitml ÊÇ¸ù¾ÝÓÐ¹Ø±àÒëÆ÷¹¹ÔìºÍ½»Ò× (transaction) 
ÏµÍ³µÄ×îÐÂÑÐ¾¿³É¹û¶ø¿ª·¢µÄ¡£

heitml Ò³µÄ¿ª·¢¹ý³ÌºÍ HTML Ò³Ò»Ñù£¬¶¼ÊÇÊ¹ÓÃÎÄ×Ö±à¼­Æ÷»ò HTML 
±à¼­Æ÷£¬Ò²Èç³£µØ·ÅÔÚÍòÎ¬ÍøËÅ·þÆ÷ÉÏ¡£²»¹ý£¬ÐÂµÄÍøÒ³¿É°üÀ¨¶¯Ì¬µÄ heitml 
±êÇ©ºÍÊ¹ÓÃ±êÇ©¿â¡£Äã¿ÉÊ¹ÓÃÕâÐ©±êÇ©´æÈ¡×ÊÁÏ¿â¡¢²úÉú¶¯Ì¬ÄÚÈÝ¡¢¼Ä³öµçÓÊ£¬
ÉõÖÁ¿ÉÒÔ¿ª·¢Ç¿¾¢µÄÓ¦ÓÃ³ÌÊ½£¬ÈçµÇ¼Ç×ÊÁÏ¿â (registration database) ºÍ¹ºÎïÏµÍ³¡£

HTML ÐÂÊÖºÍ×¨Òµ³ÌÊ½Éè¼ÆÊ¦Ò»Ñù»áÎªÄÜ¹»¸ßËÙ¶ø¼òÒ×µØÉè¼Æ¾«²ÉµÄÓ¦ÓÃ³ÌÊ½£¬
ÈçÎÒÃÇµÄ»¥¶¯Ç©Ãû²¾£¬¶ø²»ÐèÊ¹ÓÃ¸´ÔÓ¶øÄÑÑ§µÄ CGI ÃüÁî¸å¶ø¾ªÑÈ¡£Õâ¹¤×÷Ö»ÐèÊ¹ÓÃ 
dba ±êÇ©¿âÖÐµÄ¹¤¾ß±ã¿É×öµ½¡£

heitml °üÀ¨²»Í¬ÖÖÀàµÄ±êÇ©¿â£¬ÓÃÒÔ²úÉúÇ©Ãû²¾¡¢×ÊÁÏ¿âÎ¬»¤³ÌÊ½¡¢
¿ÉÑÓÉìµÄ²éÑ¯±í¸ñ¡¢Ç¿¾¢µÄµçÓÊ±í¸ñ»òÍøÒ³µÄ½×²ãÊ½Ñ¡µ¥ 
(hierarchic menu)¡£ÕâÐ©¹¤¾ßÒÑ¿ÉÊ¹ÓÃ£¬ÄãÖ»ÐèÔÚÍøÒ³ÉÏ¼ÓÉÏ¶ÔÓ¦µÄ±êÇ©¡£

×÷ÎªÒ»¸öÓÐ¾­ÑéµÄ³ÌÊ½Éè¼ÆÊ¦£¬Äã¿ÉÈ«ÃæÊ¹ÓÃ heitml µÄ³Ö¾Ã¶¯Ì¬Ôª×é¼Ü¹¹ 
(persistent dynamic tuple architecture)¡Ãheitml ²»µ¥ÊÇÓÐ¶¯Ì¬ÐÍÌ¬ 
(dynamic typing)¡¢È«¹¦ÄÜµÄ±í´ïÊ½¼ÆËã¡¢µÝ»Øº¯ÊýºÍ·á¸»µÄ²ÎÊý´«µÝÌØÉ«µÄÃü¸åÓïÑÔ£¬
Ò²¼®¶¯Ì¬Ôª×é¼Ü¹¹×Ô¶¯±£³ÖÈÎºÎ´óÐ¡µÄ session ×ÊÁÏ¡£

 


\subsection{PostgreSQL µÄ America On-line AOL ÍòÎ¬ÍøËÅ·þÆ÷}

 
AOLserver 2.3 °æÊÇÒ»¸öÃâ·ÑµÄÉÌÒµÍòÎ¬ÍøËÅ·þÆ÷£¬Ëü¿ÉÁ¬½Óµ½ 
PostgreSQL¡£ÓûÖªÏêÇé£¬Çë¿´
\begin{itemize}
\item  AOL ÍòÎ¬ÍøËÅ·þÆ÷Ö÷ÍøÒ³ \nameurl{http://www.aolserver.com}{} 
\item  Philip Greenspun µÄ AOLserver ½éÉÜ \nameurl{http://photo.net/wtr/aolserver/introduction-1.html}{}
\end{itemize}
 
AOLserver ÊÇÒ»¸ö¿ìËÙ£¬È«¶àÁ÷´¦Àí (multithreaded)£¬Ö§Ô® Tcl
µÄÍòÎ¬ÍøËÅ·þÆ÷¡£µ«²»Ö¹ì¶´Ë£¬Ëü»¹ÊÇÒ»¸öÈ«ÃæÖ§Ô®×ÊÁÏ¿âµÄÍòÎ¬Íø¿ª·¢Æ½Ì¨¡£

Ê¹ÓÃ AOLserver£¬Äã¿ÉÓÐ¹«ÓÃ (pooled) µÄ PostgreSQL£¨ºÍÆäËû 
RDBMS£©Á¬½Ó£¬ÓÉ²»Í¬Ö´ÐÐÐ÷ (threads) ·ÖÏí¡£AOLserver ÓÐ Tcl ºÍ C
API£¬ÈÃÄã¿É¿ª·¢Ç¿¾¢µÄ¶¯Ì¬ÍøÒ³¡£ËùÓÐÕâÐ©¶«Î÷¶¼ÔÚ 1995 Äê¿ªÊ¼¡£ËüÒÔ APL
(AOLserver Public License) »ò GPL ÊÚÈ¨£¬Òò´ËÊÇÈ«×ÔÓÉµÄÈí¼þ¡£

¶ÔÍøÒ³À´Ëµ£¬Tcl API ×îÓÐÓÃ¡£AOLserver ÓÐÒ»×éÇ¿¾¢µÄ Tcl ºô½Ð£¬ÀýÈç
ns\_sendmail£¨ÓÃÀ´·¢³öµçÓÊ£©¡¢ns\_httpget£¨ÓÃÀ´È¡»ØÒ»¸ö URL£©¡¢ns\_schedule£¨ÀàÒÔ 
cron µÄ¹¦ÄÜ£¬ÓÃÒÔÅÅ¶¨³ÌÊ½ÔÚÌØ¶¨Ê±¼äÖ´ÐÐ£©µÈµÈ¡£ÄãÒ²¿ÉÓÃ Tcl API À´ÇáÒ×À©Õ¹
AOLserver µÄ¹¦ÄÜ¡£Ã¿Ò»¸ö AOLserver µÄÐéÄâËÅ·þÆ÷¶¼¿ÉÓµÓÐË½¼ÒµÄ Tcl 
ÃüÁî¸å¡°º¯Ê½¿â¡±£¬ÓÉ AOLserver ½âÊÍ£¬²¢¿ÉÈÃ¸ÃÐéÄâËÅ·þÆ÷ÖÐÈÎºÎÍøÒ³Ê¹ÓÃµÃµ½¡£

Äã¿ÉÓÃÈýÖÖ·½·¨Îª AOLserver ¿ª·¢ÍøÒ³¡Ã
\begin{itemize}
\item ´¿ HMTL
\item .tcl Ò³¡õ¡õ¼´¿ÉÓÃ ns\_write ºô½ÐÀ´´«»Ø HTML µÄ tcl ³ÌÊ½¡£
\item .adp Ò³¡õ¡õAOL Dynamic Pages¡£ÄãÒÔ´¿ HTML ¿ª·¢ÍøÒ³£¬µ«Äã¿ÉÓÃ {$<$}\% \%{$>$} »ò
{$<$}\%= \%{$>$} À´Ç¶Èë Tcl Âë£¬ºÍ PHP »ò ASP ÏàËÆ¡£
\end{itemize}


ËäÈ» AOLserver ÊÇÒ»¸öÎ°´óµÄµÄ»¥ÁªÍøËÅ·þÆ÷£¬ÓµÓÐÓÅÁ¼µÄ¼Ü¹¹£¬
ËüµÄ¹âÃ¢ÔÚì¶ËüÁ¬½Ó×ÊÁÏ¿âµÄÄÜÁ¦¡£AOLserver ÓµÓÐ×Ô¼ºµÄ×ÊÁÏ¿â³éÏó²ã (abstraction 
layer)£¬ÈÃÄãÍêÈ«²»ÐèÐÞ¸Ä³ÌÊ½¶øÁ¬½Óµ½²»Í¬ RDBMS¡£ÕâÐ© RDBMS µÄÁ¬½ÓÊÇ¹«ÓÃ 
(pooled)¡¢³ÖÐø (persistent) µÄ£¬ÓÉ²»ÓÃµÄÖ´ÐÐÐ÷·ÖÏí¡£
ÕâÈÝÐíºÜ¿ìµÄÁ¬½áºÍÓÐÐ§ÔËÓÃ×ÊÔ´¡£

AOLserver ÓµÓÐËùÓÐÖ÷ÒªµÄ RDBMS µÄÇý¶¯³ÌÊ½¡ÃPostgreSQL¡¢Oracle¡¢Sybase¡¢
Informix¡¢Illustra¡¢Solid¡¢Interbase ºÍ MySQL¡£
 


\subsection{PostgreSQL µÄÒÉÄÑ / ¼Æ»®×·×ÙÏµÍ³³ÌÊ½¹¤¾ß}

 
ËüÔÚ 
\begin{itemize}
\item   \nameurl{http://www.homeport.org/~shevett/pts/}{} 
\end{itemize}
 
 


\subsection{°Ñ dbase µÄ dbf µµ×ª»»ÖÁ PostgreSQL}

 
dbf2msql ³ÌÊ½ºÍ mSQL ¼° PostgreSQL ºÏ×÷Óä¿ì¡£Äã¿ÉÔÚÒÔÏÂ·½ÕÒµ½
\begin{itemize}
\item  \nameurl{ftp://ftp.nerosworld.com/pub/SQL/dbf2sql/}{} 
\item  \nameurl{ftp://ftp.postgresql.org/pub/incoming/dbf2pg-3.0.tar.gz}{} 
\end{itemize}
 

Õâ³ÌÊ½ÓÉ Faculty of Electrical Engineering TU Delft, NL 
Computer Architecture and Digital Technique section 
µÄ Maarten Boekhold Ð´³É¡£ 
\begin{itemize}
\item  \onlynameurl{M.Boekhold@et.tudelft.nl} 
\end{itemize}
 

ÄãÒ²¿ÉÊ¹ÓÃ python µÄ·½·¨ (method) ÔÚ¶ÁÈë dbf µµ¼°ÔØÈëµ½ postgres ×ÊÁÏ¿â¡£
\begin{itemize}
\item  See \nameurl{http://www.python.org}{} 
\end{itemize}
 


\subsection{°ÑÎ¢Èí MDB ×ÊÁÏ¿â×ª»»ÖÁ PostgreSQL}

¼Æ»®ÖÐµÄ MDB Tools ÊÇÒ»×éº¯Ê½¿âºÍ¹«¾ß³ÌÊ½£¬ÓÃì¶°ÑÎ¢Èí Access ×ÊÁÏ¿â£¨mdb 
µµ£©»ã³öÖÁ¶àÓÃ»§µÄ×ÊÁÏ¿â£¬Èç Oracle¡¢Sybase¡¢DB2¡¢Informix¡¢MySQL¡¢PostgreSQL 
Ö®Àà¡£
\begin{itemize}
\item  ´Ó \nameurl{http://mdbtools.sourceforge.net}{} È¡µÃ MDB Tools
\item  Í¨ÐÅÂÛÌ³ \nameurl{http://lists.sourceforge.net/mailman/listinfo/mdbtools-dev}{}
\end{itemize}



\subsection{Zeos ¿Í»§}

¡°Zeos¡±ÊÇÒ»¸öÓÃÀ´¿ª·¢ºÍ¹ÜÀí×ÊÁÏ¿âÓ¦ÓÃ³ÌÊ½µÄÈí¼þ²úÆ·£¬ÓÃì¶¿ª·ÅÔ­Ê¼Âë SQL
ËÅ·þÆ÷¡õMySQL¡¢PostgreSQL ºÍ InterBase
\nameurl{http://www.zeos.dn.ua/eng/index.html}{}


\subsection{Java µÄ Report Writer}

Generic Report Writer ÊÇÒ»¸öÄ¿Â¼Çý¶¯µÄ±¨¸æ±àÐ´Æ÷¡£Ëü²»ÊÇÍÏ¡õ·Å (drag-and-drop)
½éÃæ¡£¿ÉÓÃì¶ PostgreSQL¡¢MySQL ºÍ Access¡£ËüÒ²ºÜ¿ÉÄÜ¿ÉÓÃì¶ÆäËûÄãÓÐ Type 4 JDBC
version 1 Çý¶¯³ÌÊ½µÄ×ÊÁÏ¿â¡£ËüÔÚ 
\nameurl{http://www.geocities.com/SiliconValley/Ridge/4280/GenericReportWriter/grwhome.html}{}¡£


\section{×ÊÁÏ¿âÉè¼Æ¹¤¾ß¡õÊµÌå¹ØÏµÍ¼ (Entity Relation Tool) ¹¤¾ß}

"DeZign for databases" (\nameurl{http://www.heraut.demon.nl/dezign/index.html}{}) 
ÊÇÒ»¸öÊ¹ÓÃÊµÌå¹ØÏµÍ¼µÄµÄ×ÊÁÏ¿â¿ª·¢¹¤¾ß¡£ËüÒÔÊÓÏñÐÎÊ½Ö§Ô®ÊµÌåºÍ¹ØÏµµÄÅÅÁÐ£¬
²¢×Ô¶¯Îª´ó²¿·ÖÁ÷ÐÐ²úÉú×ÊÁÏ¿â·½°¸ (schema)¡£

¡°DeZign for databases¡±ÔÚÉè¼ÆÊ±Ê¹ÓÃ×Ô¶¯Íâ¼ü×ªÒÆ (automatic foregin key 
migration ?)£¬³É¹¦´Óµ¥Ò»µÄ¹æ¡õÖ§Ô®Âß¼­ºÍÊµÖÊÊý¾ÝµÈ¼¶ (data level)¡£
¶à¿îÏÔÊ¾Éè¶¨°üÀ¨ÊµÌå/Ö÷¼ü/Á¬Íâ¼üµÄÊôÐÔ/²»Á¬Íâ¼üµÄÊôÐÔ¡£¡°DeZign for databases¡±
Ò²Ö§Ô®¶¨ÒåÓò (domain)£¨ÓÃ»§×Ô¶¨×ÊÁÏÐÍÌ¬£©¡£

DeZign ²úÉúµÄ±¨¸æ¿É½«¸´ÔÓµÄÉè¼ÆÒÔ¼ò»¯ÁËµÄÐÎÊ½Ìá½»Óè²»Í¬µÈ¼¶µÄ¹ÜÀí²ã¡£
ÄãÖ»Ðè°´Ò»ÏÂ»¬Êó±ã¿É²úÉú±¨¸æ¡¢×ÊÁÏ×Öµä (datadictionaries) ºÍ×ÊÁÏ¿â¡£
ËüÖ§Ô®ÒÔÏÂ×ÊÁÏ¿â¡ÃOracle¡¢Interbase¡¢IBM DB2¡¢Sybase¡¢Î¢Èí Access
(95/97/2000)¡¢Î¢Èí SQL Server¡¢Paradox¡¢dBase¡¢Informix¡¢SQL-Anywhere¡¢MySQL ºÍ
PostgreSQL¡£

Heraut¡°DeZign for databases¡±ÔÚ£¨\nameurl{http://www.heraut.demon.nl}{}£©¡£
 


\section{PostgreSQL µÄ»¥ÁªÍø×ÊÁÏ¿âÉè¼Æ/Íê³É¹¤¾ß¡õEARP}

 
\begin{itemize}
\item  \nameurl{http://www.oswego.edu/Earp}{} 
\item  \nameurl{ftp://ftp.oswego.edu}{} µÄ¡®pub/unix/earp¡¯Ä¿Â¼¡£ 
\end{itemize}
 
 


\subsection{EARP ÊÇÊ²÷á£¿}

 
ÊÇ David Dougherty µÄ¡°Easily Adjustable Response Program¡±¡£EARP ÊÇÒ»¸öÀûÓÃ 
PostgreSQL ×ÊÁÏ¿âÏµÏµµÄÍøÉÏ×ÊÁÏ¿âÉè¼Æ/ÊµÊ©¹¤¾ß¡£¹¦ÄÜ°üÀ¨¡Ã

\begin{itemize}
\item      Ò»¸öÊÓ¾õ»¯µÄÉè¼ÆÏµÍ³¡£
\item      Ò»¸ö sendmail ½éÃæ¡££¨¿ÉÊÕ·¢µçÓÊ£©
\item      Ò»¸öÔöÇ¿ÁËµÄ±£°²»úÖÆ¡£
\item      Ò»¸ö cgi Çý¶¯³ÌÊ½¡£
\end{itemize}
 
 


\subsection{Ê©ÐÐ}

EARP Ö÷ÒªÊ©ÐÐÒ»¸öÔÚ http ¼à¿Ø³ÌÊ½ (daemon) ÏÂÖ´ÐÐµÄ CGI 
¶þÔªµµÀ´´æÈ¡×ÊÁÏ¿âËÅ·þÆ÷¡£ËùÓÐÉè¼Æ¹¤¾ß¶¼½¨Á¢ÔÚÇý¶¯³ÌÊ½ÖÐ£¬³ýÔÚÍøÉÏ£¬
ÔÙÃ»ÓÐµØ·½ÐèÒª×÷³öÉè¼Æ¡£ÄÇÐ©¹¤¾ß±¾ÉíÐèÒªÒ»¸öÖ§Ô®Í¼ÏñµÄä¯ÀÀÆ÷£¬
ËùÉè¼Æ³öÀ´µÄÎï¼þ¶ÀÁ¢ì¶±àÐ´·½·¨£¬¶øÊÇ¸ù¾Ý¸öÈËºÃ¶ñ¡£

 


\subsection{ËüÈçºÎ¹¤×÷£¿}

 
EARP µÄÆäÖÐÒ»¸öÖ÷ÒªÌØÉ«ÊÇËüÊ¹ÓÃÎï¼þµ¼ÏòµÄ·½·¨À´²úÉúÓÃÒÔÁ¬½Ó×ÊÁÏ¿âµÄ html 
Ò³¡£´ó²¿·ÖÒ³Ãæ¶¼°üº¬¶à¸öÎï¼þ¡£Ã¿¸öÎï¼þ¶¼ÒÔÄ³Ð©¹¤¾ß²úÉú¼°È¡µÃÒ»¸öÃû×Ö£¬
ÕâÐ©Îï¼þ»á±»Ò³Ãæ¹¤¾ß (page tool) ÒÔÒ»¸ö¿Éºô½ÐµÄË³Ðò (callable sequence) 
Á¬½áÔÚÒ»Æð¡£Îï¼þ¿ÉÔÚÆäËûÒ³ÃæÖÐÖØÓÃ¡£ÓÐ¹Ø HTML¡¢²éÑ¯¡¢¶ÁÈ¡Ê¹ÓÃÕßÊäÈë¡¢
¿ÉÑÓÉìµÄ²éÑ¯ºÍÊäÈëÎï¼þ¸ñÊ½»¯ (Extendable Formatting of Query and Input 
objects)¡¢°ÑÏÖÓÐÎï¼þÁ¬½á³ÉÆäËûÎï¼þµÄ»ù±¾¹¤¾ß½ÔÓÐÌá¹©¡£
¸üÏÈ½ø¹¤¾ß°üÀ¨µçÓÊ¹¤¾ßºÍ¶àÁ÷²éÑ¯¹¤¾ß¡£

EARP µÄÁíÒ»¸öÌØÉ«ÊÇÏÈ½øµÄ±£°²¡£ÓÐ¶àÖÖ·½·¨ÏÞÖÆ´æÈ¡ EARP 
ÏµÍ³µÄ²»Í¬²¿·Ö¡£Îª´ïµ½ÏÈ½øµÄ±£°²£¬EARP ¼ì²éÃ¿Ò»¸öÁ¬½Ó£¬
ÒÔÈ·¶¨Ã¿¸öÁ¬½ÓÈËÔ±µÄÉí·Ö (ids) ¼°Èº×é (groups)¡£²»Í¬²¿·ÖµÄ´æÈ¡¶ÀÁ¢¶¨Òå£¬
×îÖÕµÄ×éºÏ¾ö¶¨½á¹ûÄÜ·ñ´æÈ¡ EARP µÄÒ»¸öÌØ¶¨²¿·Ö¡£´ËÍâ£¬
ÊµÊ©ÕâÐ©±£°²ÌØÉ«Ö»ÐèÒ»¸öÖ§Ô®»ù±¾£¨»ò¸ü¼Ñ£©Ê¹ÓÃÕßÈÏÖ¤ (user authentication) µÄ 
http ËÅ·þÆ÷¡£


\subsection{ºÎ´¦È¡µÃ EARP£¿}

EARP ¿É¼®ÄäÃû (anonymous) ftp È¡µÃ¡Ã
\begin{itemize}
\item  \nameurl{ftp://ftp.oswego.edu}{} µÄ 'pub/unix/earp' Ä¿Â¼¡£
\end{itemize}



\section{PHP Hypertext PreProcessor¡õPostgreSQL µÄËÅ·þÆ÷¶Ë html Ç¶ÈëÃüÁî¸åÓïÑÔ\label{PHP}}

ÍòÎ¬Íø½éÃæ¹¤¾ßÎ»ì¶¡Ã
\begin{itemize}
\item  \nameurl{http://www.php.net}{}
\item  \nameurl{http://www.vex.net/php}{}
\end{itemize}

PHP Ò²ÓÐÒ»¸öÃûÎª Zend µÄ±àÒëÆ÷£¬¿É´ó·ù¸ÄÉÆ±íÏÖ¡£Ê×ÏÈÄãÔÚ¿ª·¢¡¢²âÊÔºÍ³ý´íÊ±Ê¹ÓÃ 
PHP ÃüÁî¸åÓïÑÔ¡£µ±×¼±¸ºÃÕýÊ½Ê¹ÓÃÊ±Ê¹ÓÃ Zend ±àÒëÆ÷²úÉú¿ÉÑ¸ËÙÖ´ÐÐµÄÖ´ÐÐµµ¡£

Ç°ÉíÎª Professional Home Pages£¨PHP£©¶øÏÖÔÚ³ÆÎª PHP Hypertext Pre-Processor
\begin{itemize}
\item  ºÜ¶à¹ú¶¨¶¼ÓÐÓ³ÉäÕ¾Ì¨£¬ÃûÎª www.COUNTRYCODE.php.net
\item  \nameurl{http://www.fe.de.php.net}{}
\item  \nameurl{http://www.sk.php.net}{}
\item  \nameurl{http://php.iquest.net/}{}
\item  ÎÊÌâ¿ÉµçÓÊµ½¡Ã
\onlynameurl{rasmus@lerdorf.on.ca}
\end{itemize}

PHP ÊÇÒ»¸öËÅ·þÆ÷¶Ë html Ç¶ÈëÃüÁî¸åÓïÑÔ¡£ËüÈÃÄãÔÚÄãµÄ .HTML 
µµÖÐ¼ÓÈë¼òµ¥µÄÃüÁî¸å£¬Ïñ JavaScript °ã¡£²»¹ý£¬ºÍ JavaScript ²»Í¬£¬PHP 
¶ÀÁ¢ì¶ä¯ÀÀÆ÷¡£JavaScript ÊÇÒ»ÖÖ¿Í»§¶ËµÄ html Ç¶ÈëÃüÁî¸åÓïÑÔ£¬¶ø PHP 
ÊÇËÅ·þÆ÷¶ËÓïÑÔ¡£PHP µÄ¸ÅÄîºÍ Netscape µÄ LiveWire Pro 
²úÆ·ÏàËÆ¡£Èç¹ûÄãÏ²»¶¿ìËÙ¸üÐÂÓÖ°üÀ¨Ô´³ÌÊ½ÂëµÄ×ÔÓÉÈí¼þ£¬Äã´ó¸Å»áÏ²»¶ PHP 3¡£

\begin{itemize}
\item  Ö§Ô® PostgreSQL µÄ³ÌÊ½ÂëÓÉ Adam Sussman Ð´³É
\onlynameurl{asussman@vidya.com}
\end{itemize}





\subsection{Ö÷ÒªÌØÉ«}

\begin{itemize}
\item ±ê×¼µÄ CGI£¬FastCGI ºÍ Apache Ä£×éÖ§Ô®¡õ
×÷ÎªÒ»¸ö±ê×¼µÄ CGI ³ÌÊ½£¬PHP ¿ÉÔÚÖ´ÐÐÈÎºÎ Unix »¥ÁªÍøËÅ·þÆ÷µÄÈÎºÎ Unix 
µçÄÔÉÏ°²×°¡£¼ÓÉÏ¶ÔÐÂ FastCGI ±ê×¼µÄÖ§Ô®£¬PHP ¿É´ÓÖÐµÃµ½ËÙ¶ÈÉÏµÄ¸ÄÉÆ¡£×÷ÎªÒ»¸ö 
Apache Ä£×é£¬ PHP ±ä³É CGI ³ÌÊ½ÍâÒ»¸öÇ¿¾¢¼°{\bfseries ¿ìÈçÉÁµç}µÄÑ¡Ôñ¡£
\item  ´æÈ¡¼ÇÂ¼ (Access Logging)¡õ
¼®Öø PHP µÄ´æÈ¡¼ÍÂ¼¹¦ÄÜ£¬ÓÃÕß¿É×ÔÐÐÎ¬»¤ÃüÖÐÊý×Ö (hit counting) 
¼°×÷³ö¼ÍÂ¼¡£ËüÍêÈ«²»ÀûÓÃÏµÍ³ÖÐÑëµÄ¼ÍÂ¼µµ£¬¶øÇÒ¼´Ê±¼à²ì´æÈ¡¹ý³Ì¡£Log Viewer 
Script Ìá¹©ÁË¸ö±ðÓÃÕßÓµÓÐµÄÒ³ÃæµÄ´æÈ¡ÕªÒª¡£´ËÍâ£¬
±¾Ì×¼þ¿É±»Éè¶¨ÎªÔÚÃ¿Ò³²úÉúÒ»¸öÏÔÊ¾´æÈ¡×ÊÁÏµÄ×¢½Å¡£±¾Ò³µÄ½áÎ²¾ÍÓÐÒ»¸öÀý×Ó¡£
\item  ´æÈ¡¿ØÖÆ (Access Control)¡õ
Ò»¸öÒÔÍòÎ¬ÍøÎª»ù´¡µÄÄÚ½¨Éè¶¨»­Ãæ´¦ÀíÈ¡¿ØÖÆÉè¶¨¡£
ÓÃÕß¿ÉÒÔÎªÄ³ÈËÓµÓÐµÄËùÓÐ»ò¸ö±ðÍøÒ³½¨Á¢¹æÔò£¬ÏÞÖÆË­ÈËÄÜ¼°ËûÄÜÔõÑùÔÄ¶ÁÓÐ¹ØÍøÒ³¡£
¸ù¾ÝÓÃÕßµÄÍøÓò¡¢ä¯ÀÀÆ÷¡¢µçÓÊµØÖ·ÉõÖÁÀ´Ô´ÎÄ¼þ (referring 
document)£¬ÍøÒ³¿ÉÒÔÃÜÂë±£»¤¡¢ÍêÈ«¿´²»µ½¡¢½ûÖ¹¼ÍÂ¼ (logging disabled) 
ºÍ×öÆäËûÊÂ¡£
\item  PostgreSQL Ö§Ô®¡õ
Postgres ÊÇÒ»¸öÏÈ½øµÄ×ÔÓÉ RDBMS¡£ÀûÓÃ PHP£¬ÓÃÕß¿ÉÖ±½ÓÔÚ .HTML µµÖÐÇ¶Èë 
PostgreSQL µÄ¡¸SQL ²éÑ¯¡¹¡£
\item  RFC-1867 µµ°¸ÉÏ´«Ö§Ô®¡õ
µµ°¸ÉÏ´«ÊÇ Netscape 2.0 µÄÐÂ¹¦ÄÜ¡£ËüÈÃÓÃÕß°Ñµµ°¸ÉÏ´«µ½ÍòÎ¬ÍøËÅ·þÆ÷¡£
Ê¹µÃÕâÊÂÐÐ¿ÉµÄÔ­Òò£¬ÊÇÊµ¼ÊµÄ Mime ½âÂëÓÉ PHP Ìá¹©£¬Ëü¿ÉÌá¹©¶îÍâµÄ¿ò¼Ü£¬
ÔÚÊÕµ½ÉÏ´«µÄµµ°¸áá×öÐ©ÓÐÓÃµÄÊÂ¡£
\item  HTTP Îª»ù´¡µÄÈÏÖ¤¿ØÖÆ¡õ
PHP ¿ÉÓÃÀ´ÔÚ Apache ÍòÎ¬ÍøËÅ·þÆ÷ÖÐ½¨Á¢×Ô¶¨µÄÒÔ HTTP Îª»ù´¡µÄÈÏÖ¤»úÖÆ¡£
\item  ±äÊý¡¢ÁÐÕó¡¢ÏàÁªÁÐÕó (Associative Arrays)¡õ
PHP Ö§Ô®±äÊýÐÎÌ¬¡¢ÁÐÕó¡¢ÉõÖÁÈç Perl °ãµÄÏàÁªÁÐÕó¡£ËüÃÇ¿É¼® GET »ò POST 
·½·¨ÔÚÍøÒ³¼ä´«µÝ¡£
\item  Ìõ¼þÊ½¡¢While »ØÈ¦¡õ
PHP Ö§Ô®Ò»ÖÖÀàËÆ C µÄÈ«¹¦ÄÜÃüÁî¸åÓïÑÔ¡£Äã¿ÉÊ¹ÓÃ if/then/elseif/else/endif 
Ìõ¼þÊ½¡¢while »ØÈ¦ºÍ switch/case ÐðÊöÀ´Ö¸ÒýÄãµÄ html Ò³µÄÏÔÊ¾µÄÂß¼­Á÷Ïò¡£
\item  ÑÓÉìÕý¹æ±í´ïÊ½¡õ
Õý¹æ±í´ïÊ½³£±»ÓÃì¶ÑùÊ½Æ¥Åä¡¢ÑùÊ½Ìæ»» (pattern substitutions) 
ºÍÒ»°ãµÄ×Ö´®´¦Àí¡£PHP Ö§Ô®ËùÓÐ³£ÓÃµÄÕý¹æ±í´ïÊ½ÔË×÷¡£
\item  Ô­Ê¼ HTTP ±êÍ·¿ØÖÆ¡õ
Òª½øÐÐ¸ß½×ÍøÕ¾Éè¼Æ£¬Ê¹ÍøÒ³ÊÓÇéÐÎ´«ËÍ×Ô¶¨ HTTP ±êÍ·µÄÄÜÁ¦ÊÇ±ØÐëµÄ¡£
Ò»¸ö¹ß³£ÓÃ·¨ÊÇ´«ËÍÒ»¸ö Location: URL ±êÍ·À´°Ñ¿Í»§¶Ë´«ËÍµ½ÆäËû 
URL¡£ËüÒ²¿ÉÓÃì¶¹Øµô¿ìÈ¡»ò´¦ÀíÍøÒ³Ò³Ê×ÉÏµÄ¡°last update¡±±êÍ·¡£
\item  ¼´Ê± GIF Í¼Ïñ²úÉú¡õ
PHP Ö§Ô® Thomas Boutell µÄ GD Í¼Ïñº¯Ê½¿â£¬Ê¹Ëü¿É¼´Ê±²úÉú GIF Í¼Ïñ¡£
\item  ISP¡°°²È«Ä£Ê½¡±Ö§Ô®¡õ
PHP Ö§Ô®Ò»¸ö¶ÀÓÐµÄ¡°°²È«Ä£Ê½¡±(Safe Mode)£¬Ê¹µÃÔÚÍ¬Ò»ËÅ·þÆ÷ÉÏÓÐ¶à¸öÓÃ»§Ê¹ÓÃ 
PHP ÃüÁî¸åÒ²Ã»°²È«ÎÊÌâ¡£
\item  ÐÂ°æ±¾µÄ PHP ¼ÓÈëÁËºÜ¶àÐÂ¹¦ÄÜ£¬Çë²ÎÔÄÖ÷ÍøÒ³ \nameurl{http://www.php.net}{}
\item  ËüÊÇ×ÔÓÉµÄ£¡
×îááÒ»¸ö±ØÒªµÄÌØÐÔ¡£ÕâÌ×¼þÊÇÍêÈ«×ÔÓÉµÄ¡£ËüÒÔ GNU/GPL 
ÊÚÈ¨£¬ÈÃÄã¿ÉÎªÈÎºÎÄ¿µÄÊ¹ÓÃÕâÈí¼þ£¬°üÀ¨ÉÌÒµÓÃÍ¾¡£ÓûÖªÏêÇé£¬Çë²Î¿´ GNU General 
Public License ÎÄ¼þ¡£
\end{itemize}



\subsection{PHP¡õ¼òÊ·}

³õ³öÏÖÊ±£¬PHP ÊÇÒ»¸öÒÔ Perl Ð´³ÉÐ¡ÇÉ¼òµ¥µÄ cgi °ü×°Æ÷ 
(wrapper)¡£ÕâÌ×¼þ×îÏÈÃûÎª Personal Home Page Tools£¬ááÀ´±äÎª Personal Home 
Page Construction Kit¡£

ÁíÓÐÒ»¹¤¾ßÊÇÐ´À´¼ò»¯ÔÚÍøÒ³ÖÐÇ¶Èë SQL ²éÑ¯µÄ¹¤×÷¡£Ëü»ù±¾ÉÏÊÇÁíÒ»¸ö CGI 
°ü×°Æ÷£¬ÄÜ·ÖÎö (parsed) SQL ²éÑ¯¼°¼ò»¯½¨Á¢¸ù¾ÝÕâÐ©²éÑ¯µÄ±í¸ñºÍÁÐ±íµÄ¹¤×÷¡£
Õâ¹¤¾ßÃûÎª FI (Form Interpreter)¡£

PHP/FI 2.0 °æÍêÈ«ÖØÐ´ÕâÁ½Ì×¼þ£¬½«Ö®ºÏ¶øÎªÒ»¡£Ëü½ø»¯ÖÁ¿É°Ñ¼òµ¥µçÄÔÓïÑÔÇ¶Èë 
HTML µµÖÐ¡£Ëü¼®Öø°ÑËù¼òµ¥µÄÃüÁî¸åÖ±½ÓÇ¶Èë HTML µµÖÐ£¬Ïû³ý´óÁ¿Ð¡ÐÍ Perl cgi 
³ÌÊ½µÄÐèÒª¡£ÕâÑù»á¼Ó¿ìÄãµÄÍøÒ³£¬ÒòÎª fork ¶à´Î Perl µÄÀ§ÈÅÒÑ¾­Ïû³ý¡£
ËüÒ²¼ò»¯ÁË¹ÜÀí´óÐÍÍøÕ¾µÄ¹¤×÷£¬ÒòÎªÄã¿É°ÑÍøÒ³µÄËùÓÐ²¿·Ö·ÅÔÚÒ»¸ö html 
µµÖÐ¡£¼ÓÉÏ¶àÖÖ×ÊÁÏ¿âµÄÖ§Ô®£¬¿ÉÊ¹ÓÃ×ÊÁÏ¿âµÄÍøÒ³µÄ¿ª·¢±äµÃ¼òµ¥¡£
ºÜ¶àÈË¾õµÃÇ¶Èë²éÑ¯±È·Ö±ð½¨Á¢ HTML ºÍ CGI µµ¼òµ¥µÃ¶à¡£

PHP/FI ÒÑ¸ÄÃûÎª PHP¡£


\subsection{ÄÇ÷á£¬ÎÒÄÜÓÃ PHP ×öÊ²÷á£¿}

Èç¹ûÄãÊ¹ÓÃ PHP£¬ÄãÊ×ÏÈ»á×¢Òâµ½ËüÔÚÒ³Î²¼ÓÉÏÕâÍøÒ³Ôø±»ä¯ÀÀ¹ý¶àÉÙ´ÎµÄ×ÊÁÏ
£¨Èç¹ûÄãÔÚÔÚ±àÒëÊ±Ñ¡È¡ÁË access logging£©¡£ÕâÖ»ÊÇ PHP Ëù×öµÄÒ»Ð¡²¿·Ö¡£
ËüµÄÁíÒ»¸öÖØÒª½ÇÉ«ÊÇ×÷ÎªÒ»¸ö±í¸ñÖ±Òë cgi ³ÌÊ½ (form interpreter 
cgi)£¬ÕâÒ²¾ÍÊÇÊ×ÃûÖÐ FI µÄÒâË¼¡£ÀýÈç£¬Èç¹ûÄãÔÚÒ»¸öÍøÒ³ÖÐ½¨Á¢ÁËÒ»¸ö±í¸ñ£¬
ÄãÐèÒªÒ»¸ö³ÌÊ½À´´¦Àí±í¸ñÉÏµÄ×ÊÁÏ¡£¼´Ê¹ÄãÖ»Ïë°Ñ×ÊÁÏ´«ËÍµ½ÁíÒ»ÍøÒ³£¬ÄãÒ²ÐèÒª 
cgi ³ÌÊ½µÄ°ïÖú¡£PHP Ê¹µÃÈ¡µÃºÍ´¦Àí±í¸ñµÄ×ÊÁÏ¼«ÎªÈÝÒ×¡£


\subsection{Ò»¸ö¼òµ¥µÄÀý×Ó}

¼ÙÉèÄãÓÐÒ»ÕÅ±í¸ñ¡Ã
\begin{tscreen}
\begin{verbatim}
<FORM ACTION="/cgi-bin/php.cgi/~userid/display.html" METHOD=POST>
<INPUT TYPE="text" name="name">
<INPUT TYPE="text" name="age">
<INPUT TYPE="submit">
<FORM>
\end{verbatim}
\end{tscreen}

ÄãµÄ display.html ±ã¿É°üÀ¨ÀàËÆµÄ¶«Î÷¡Ã
\begin{tscreen}
\begin{verbatim}
< ?echo "Hi $ name, you are $ age years old!<p>" >
\end{verbatim}
\end{tscreen}

¾ÍÊÇÕâÑù¼òµ¥£¡PHP ×Ô¶¯ÎªÃ¿¸ö±í¸ñÊäÈëÀ¸Î»²úÉúÒ»¸ö±äÊý¡£Ö®ááÄã±ã¿ÉÔÚ ACTION URL 
µµÖÐÊ¹ÓÃÕâÐ©±äÊý¡£

ÔÚÄãÕÒ³öÈçºÎÊ¹ÓÃ±äÊýÖ®ááµÄ²½Öè¾ÍÊÇÔÚÍøÒ³ÖÐÊÔÓÃÒ»Ð©Âß¼­Á÷³Ì±êÇ©¡£ÀýÈç£¬
Èç¹ûÄãÏë¸ù¾ÝÓÃÕßÊäÈëÏÔÊ¾²»Í¬Ñ¶Ï¢£¬Äã¿ÉÊ¹ÓÃ if/else Âß¼­¡£ÔÚÉÏÃæµÄÀý×Ó£¬
ÎÒÃÇ¿É¸Ä±ä display.html£¬Ê¹µÃ²»Í¬¶«Î÷»á¸ù¾ÝÓÃ»§ÊäÈëÏÔÊ¾³öÀ´¡Ã
\begin{tscreen}
\begin{verbatim}
<?
    if($age>50);
        echo "Hi $name, you are ancient!<p>";
    elseif($age>30);
        echo "Hi $name, you are very old!<p>";
    else;
        echo "Hi $name.";
    endif;
>
\end{verbatim}
\end{tscreen}

PHP Ìá¹©Ò»ÖÖ·Ç³£Ç¿¾¢µÄÃüÁî¸åÓïÑÔ£¬ÄÜ×öµ½µÄÊÂ±ÈÒÔÉÏ¼òµ¥µÄÀý×Ó¶àºÜ¶à¡£ÓûÖªÏêÇé£¬
Çë²ÎÔÄÓÐ¹Ø PHP Script Language µÄÕÂ½Ú¡£

ÄãÒ²¿ÉÊ¹ÓÃ PHP À´Éè¶¨ÓÐÊ²÷áÈËÄÜ¿´µ½ÄãµÄÍøÒ³¡£Õâ¿ÉÊ¹ÓÃÒ»¸öÄÚ½¨µÄÉè¶¨»­Ãæ×öµ½¡£
ÀýÈç£¬¼®ÖøËüÄã¿ÉÖ¸¶¨Ö»ÓÐÄ³Ð©ÍøÓòµÄÈË¿É¿´µ½ÄãµÄÍøÒ³£¬
»ò½¨Á¢Ò»Ð©¹æÔòÀ´ÓÃÃÜÂë±£»¤Ä³Ð©ÍøÒ³¡£ÓûÖªÏêÇé£¬Çë²ÎÔÄÓÐ¹Ø Access Control µÄÕÂ½Ú¡£

PHP Ò²ÓÐÄÜÁ¦½ÓÊÕÈÎºÎÒÀÕÕ RFC-1867 ¹æ¶¨µÄä¯ÀÀÆ÷ÉÏ´«µÄµµ°¸¡£
ÕâÌØÉ«Ê¹ÓÃÕßÄÜÉÏ´«ÎÄ×Ö»ò¶þÔªµµ¡£¼®Öø PHP µÄ´æÈ¡¿ØÖÆºÍÂß¼­¹¦ÄÜ£¬
Äã¿ÉÈ«Ãæ¿ØÖÆ»´ÐíË­ÉÏ´«¼°ÉÏ´«áá×öÊ²÷á¡£ÓûÖªÏêÇé£¬Çë²ÎÔÄÓÐ¹Ø File Upload µÄÕÂ½Ú¡£

PHP Ö§Ô® PostgreSQL ×ÊÁÏ¿âÌ×¼þ¡£ËüÖ§Ô®ÔÚ .HTML µµÖÐÇ¶Èë SQL ²éÑ¯¡£

PHP Ò²Ö§Ô® mysql ×ÊÁÏ¿âÌ×¼þ¡£ËüÖ§Ô®ÔÚ .HTML µµÖÐÇ¶Èë SQL ²éÑ¯¡£


\subsection{CGI ¸ÄÏò (Redirection)}




\subsubsection{Apache 1.0.x ÕªÒª}

Ê¹ÓÃ Apache ËÅ·þÆ÷µÄ cgi ¸ÄÏòÄ£×éÊÇÖ´ÐÐ PHP µÄÒ»¸öºÃ·½·¨¡£
Çë×¢ÒâÄãÎÞÐëµ£ÐÄ¸ÄÏòÄ£×é£¬Èç¹ûÄãÊ¹ÓÃ PHP µÄ Apache Ä£×é°æ±¾ (Apache module 
version)¡£ÓÐÁ½¸öÕâÀà¸ÄÏòÄ£×é¡£Ò»¸öÊÇ Dave Andersen ¿ª·¢µÄ¡Ã
\begin{itemize}
\item        \onlynameurl{angio@aros.net}
\end{itemize}

Ëü¿ÉÔÚÒÔÏÂµØ·½ÕÒµ½
\begin{itemize}
\item      \nameurl{ftp://ftp.aros.net/pub/util/apache/mod_cgi_redirect.c}{}
\end{itemize}

ÁíÒ»¸öÒÑ°üÀ¨ÔÚ Apache ÖÐ£¬ÃûÎª mod\_actions.c¡£ÕâÐ©Ä£×é¼«ÎªÏàËÆ£¬
Ö»ÊÇÔÚÓÃ·¨ÉÏÓÐÉÙÐí²î±ð¡£Á½¸ö¶¼²âÊÔ¹ý£¬ÄÜºÍ PHP Ë³ÀûºÏ×÷¡£

²é¿´ Apache µÄÎÄ¼þ¹Øì¶ÈçºÎ¼ÓÈëÒ»¸öÄ£×é¡£Ò»°ãÀ´Ëµ£¬Äã°ÑÄ£×éÃû³Æ¼Óµ½Ò»¸öÃûÎª
Configuration µÄµµ°¸ÖÐ¡£Èç¹ûÄãÊ¹ÓÃ mod\_actions Ä£×é£¬ÄãÒª¼ÓµÄÒ»¾äÊÇ¡Ã

Module action\_module mod\_actions.o

Èç¹ûÄãÊ¹ÓÃ mod\_cgi\_redirect Ä£×é£¬¼ÓÉÏÒÔÏÂÒ»¾ä¡Ã

Module cgi\_redirect\_module mod\_cgi\_redirect.o

ÖØÐÂ±àÒëÄãµÄ httpd ¼°°²×°Ëü¡£ÒªÉè¶¨ cgi ¸ÄÏòÄãÐèÒªÔÚÄãµÄ mime.types 
µµÖÐ½¨Á¢ÐÂµÄ mime ÀàÐÍ£¬»òÔÚÄãµÄ srm.conf µµÖÐÊ¹ÓÃ AddType Ö¸ÁîÀ´¼ÓÉÏ mime 
ÀàÐÍ¡£Ëù¼ÓÉÏµÄ mime ÀàÐÍÓ¦ÀàËÆ¡Ã
\begin{tscreen}
\begin{verbatim}
     application/x-httpd-php phtml
\end{verbatim}
\end{tscreen}

Èç¹ûÄãÊ¹ÓÃ mod\_actions.c Ä£×é£¬ÄãÐèÔÚ srm.conf µµÖÐ¼ÓÉÏÒÔÏÂÒ»ÐÐ¡Ã
\begin{tscreen}
\begin{verbatim}
     Action application/x-httpd-php /cgi-bin/php.cgi
\end{verbatim}
\end{tscreen}

Èç¹ûÄãÊ¹ÓÃ mod\_cgi\_redirect.c Ä£×é£¬ÄãÐèÔÚ srm.conf µµÖÐ¼ÓÉÏÒÔÏÂÒ»ÐÐ¡Ã
\begin{tscreen}
\begin{verbatim}
     CgiRedirect application/x-httpd-php /cgi-bin/php.cgi
\end{verbatim}
\end{tscreen}

²»ÒªÍ¬Ê±Ê¹ÓÃ mod\_actions.c ºÍ mod\_cgi\_redirect.c¡£

°²×°¼°ÕýÈ·Éè¶¨ÁËÕâÐ© cgi ¸ÄÏòÄ£×éáá£¬ÄãÖ»Ðè°ÑÑÓÉìµµÃû¶¨Îª .phtml£¬
±ã¿ÉÒÔÖ¸¶¨Õâµµ°¸ÓÉ PHP ·ÖÎö¡£´ËÍâ£¬Èç¹ûÄãÔÚ srm.conf µµµÄ DirectoryIndex 
Éè¶¨ÐÐ¼ÓÉÏ index.phtml£¬×îÉÏ²ãµÄÍøÒ³±ã»á×Ô¶¯ÓÉ php ·ÖÎö£¬Èç¹ûÄãµÄ index 
µµÃûÎª index.phtml¡£


\subsubsection{Netscape HTTPD}

Äã¿É¼® Netscape Server CGI Redirection 
Ä£×éÀ´Ö¸¶¨×Ô¶¯°Ñ¶ÔÄ³Ð©ÑÓÉìµµÃûµÄµµ°¸µÄÒªÇó¸ÄÏò¸ø PHP¡£ÕâÄ£×é¿ÉÔÚ PHP ÍøÒ³µÄ 
File Archieves ÖÐÕÒµ½¡£Ì×¼þÖÐµÄ README Ã÷È·µØ½âÊÍÁËÈçºÎÉè¶¨ËüÀ´ÓÃì¶ PHP¡£


\subsubsection{NCSA HTTPD}

Ä¿Ç°£¬NCSA ²¢²»Ö§Ô®Ä£×é£¬ËùÒÔ£¬ÒªÊ¹ÓÃ cgi ¸ÄÏòµÄ»°£¬ÄãÒªÐÞ¸ÄËÅ·þÆ÷µÄÔ­Ê¼Âë¡£
Ò»¸ö¶Ô NCSA 1.5 ×öÕâ¹¤×÷µÄÇ¶²¹ÔÚÔÚ PHP µµ°¸´æ¿âÖÐÕÒµ½¡£


\subsection{ÔÚÖ¸ÁîÐÐÖ´ÐÐ PHP}

Èç¹ûÄã½¨Á¢ÁË CGI °æ±¾µÄ PHP£¬ÄãÖ»ÐèÔÚÖ¸ÁîÐÐÊäÈë php.cgi filename£¬¶øfilename 
ÊÇÄãÏë·ÖÎöµÄµµ°¸¡£Äã¿É½¨Á¢¶ÀÁ¢µÄ PHP ÃüÁî¸å£¬Ö»Ðè°ÑÃüÁî¸å (script) 
µÄµÚÒ»ÐÐÐ´ÎªÀàËÆ¡Ã
\begin{tscreen}
\begin{verbatim}
    #!/usr/local/bin/php.cgi -q
\end{verbatim}
\end{tscreen}

¡°-q¡±×èÖ¹Ó¡³ö HTTP ±êÍ·¡£Ï²»¶µÄ»°£¬Äã¿É²»ÓÃÕâÑ¡Ôñ¡£


\subsection{PHPGem Ì×¼þ}

PHPGem ÊÇÒ»¸ö PHP ÃüÁî¸å£¬ÓÃÒÔ¼ÓËÙ±àÐ´Ê¹ÓÃ±í¸ñµÄ PHP ÃüÁî¸å¡£Ëü¿ÉÓÃì¶²»Í¬µÄ 
SQL ËÅ·þÆ÷£¬Èç PostgreSQL¡¢MySQL¡¢mSQL¡¢ODBC ºÍ Adabas¡£
ÄãÊäÈë±í¸ñÀ¸Î»µÄÃèÊöºÍ²ÎÊý£¨À¸Î»Ãû³Æ¡¢À¸Î»µÄ on/off searching (?) µÈµÈ£©£¬
PHPGem Êä³öÁíÒ»¸öÊ¹ÓÃÄÇÐ©±í¸ñµÄ PHP ÃüÁî¸å£¨¼ìÊÓ/¼Ó/ÐÞ¸Ä/É¾³ý/ÖØ¸²ÄÚÈÝºÍËÑË÷£©¡£
PHPGem ¿ÉÊ¹ÓÃ¶à²ã³²×´±í¸ñ (multi-level nested tables, ??)¡£PHPGem 
ÈÝÐíÄãÖ¸¶¨Ã¿¸ö±í¸ñÃ¿¸öÀ¸Î»Ã¿ÈË¡õ´æÈ¡¿ØÖÆ¡£PHPGem Ò²Ö§Ô®Ó°Ïñ¡£

PHPGem ÔÚ \nameurl{http://sptl.org/phpgem}{} ÕÒµ½¡£


\section{PostgreSQL µÄ Python ½éÃæ}

Python ÊÇÒ»¸öÖ±ÒëµÄÎï¼þµ¼ÏòÃüÁî¸åÓïÑÔ¡£ËüÊ¹ÓÃ¼òÒ×£¨ÇáÇÉµÄÓï·¨¡¢
¼òµ¥Ö±½ÓµÄ¾ä×Ó£©£¬ÓÐºÜ¶àÓÃì¶½¨Á¢ GUI µÄÑÓÉì¡¢ÍòÎ¬Íø½éÃæµÈµÈ¡£
Ò»¸öÓÐÖÇ»ÛµÄä¯ÀÀÆ÷£¨ÀàËÆ HotJava£©ÕýÔÚ¿ª·¢ÖÐ£¨Ò»¾Å¾ÅÎåÄêÊ®Ò»ÔÂ£©£¬
Õâ»á¸øÓè³ÌÊ½Éè¼ÆÔ±ºÜ¶à»ú»á¡£Python µÄ°æÈ¨³ÖÓÐÈËÎªºÉÀ¼°¢Ä·Ë¹ÌØµ¤µÄ Stichting S 
Mathematisch Centrum£¬¿É×ÔÓÉÉ¢²¼¡£Ëü°üÀ¨Îï¼þ¡¢Àà±ð (classes)¡¢Ä£×é¡¢ºÍÀýÍâ 
(exceptions) µÄ¶¯Ì¬ÔØÈë¡£Ê¹ÓÃ C ÓïÑÔÀ´½«Æä½éÃæ¼ÓÈëÐÂÏµÍ³º¯Ê½¿âÊÇÖ±½ÓµÄ¹¤×÷£¬Ê¹ 
Python ÔÚ×ÔÐÐÉè¶¨Ê±ÈÝÒ×Ê¹ÓÃ¡£Python ÊÇÒ»¸öÓµÓÐ X ½éÃæµÄ¸ßµÈÃüÁî¸åÓïÑÔ¡£ÔÚ 
Linux ¹âµúÖÐµÄ Python Ì×¼þ°üÀ¨´ó²¿·Ö±ê×¼ Python Ä£×é£¬ÒÔ¼°ÓÃ×÷ Tk ½éÃæµÄ Tix 
widget Ä£×é¡£

PyGreSQL ÊÇÒ»¸öÓÃ×÷ PostgreSQL ×ÊÁÏ¿âµÄ½éÃæ¡£ËüÇ¶ÈëÁË PostgreSQL 
²éÑ¯º¯Ê½¿â£¬Ê¹µÃÔÚ Python ÊÖ¸åÖÐÊ¹ÓÃÇ¿¾¢µÄ PostgreSQL ÌØÐÔÊ®·Ö¼òµ¥¡£PyGreSQL 
ÓÉ D'Arcy J.M. Cain ºÍ Pascal Andre Ð´³É¡£
\begin{itemize}
\item  PyGreSQL µÄÐÂÍøÕ¾ \nameurl{http://www.druid.net/pygresql/}{}
\item  D'Arcy ËùÎ¬»¤µÄ \nameurl{http://www.druid.net/~darcy/}{}
\item  ¾ÉÍøÕ¾ÔÚ \nameurl{ftp://ftp.via.ecp.fr/pub/python/contrib/Database/PyGres95.README }{}
\item  D'Arcy J.M. Cain \onlynameurl{darcy@druid.net}
\item  Pascal Andre \onlynameurl{andre@chimay.via.ecp.fr}
\item  Pascal Andre \onlynameurl{andre@via.ecp.fr}
\end{itemize}





\subsection{ÈçºÎÈ¡µÃ PyGres£¿}

²»Í¬Ì×¼þµÄÖ÷ÍøÕ¾ÔÚ¡Ã
\begin{itemize}
\item  Python \nameurl{ftp://ftp.python.org:/pub/www.python.org/1.5/python1.5b2.tar.gz}{}
\item  PyGreSQL \nameurl{ftp://ftp.druid.net/pub/distrib/PyGreSQL-2.1.tgz}{}
\item  ¾ÉÍøÕ¾ \nameurl{ftp://ftp.via.ecp.fr/pub/python/contrib/Database/PyGres95-1.0b.tar.gz }{}
\end{itemize}

ÎÞÂÛÈçºÎ£¬ÄãÓ¦³¢ÊÔÑ°ÕÒ×î½Ó½üÄãµÄÓ³ÉäÕ¾Ì¨¡£Çë²ÎÔÄ×ÊÁÏÀ´Ô´À´ÕÒÕâÐ©Õ¾Ì¨¡£PygreSQL
Ò²»áÔÚ Python ºÍ PostgreSQL Õ¾Ì¨µÄ contrib Ä¿Â¼ÕÒµ½¡£




\subsection{×ÊÁÏºÍÖ§Ô®}

Èç¹ûÄãÐèÒªÕâÐ©Ì×¼þµÄ×ÊÁÏ£¬Çë²é¿´ÒÔÏÂÍøÒ³¡Ã
\begin{itemize}
\item  Python¡Ã     \nameurl{http://www.python.org/}{}
\item  PostgreSQL¡Ã \nameurl{http://epoch.cs.berkeley.edu:8000/postgres95/index.html}{}
\item  PyGreSQL \nameurl{ftp://ftp.druid.net/pub/distrib/PyGreSQL-2.1.tgz}{}
\item  PyGreSQL ¾ÉÍøÕ¾¡Ã   \nameurl{http://www.via.ecp.fr/via/products/pygres.html}{}
\end{itemize}


Ö§Ô®¡Ã
\begin{itemize}
\item  PyGreSQL µÄÍ¨ÐÅÂÛÌ³¡£Òª²Î¼ÓµÄ»°£¬Äã¿ÉµçÓÊÖÁ¡Ã
\onlynameurl{majordomo@vex.net}
ÔÚÕýÎÄÖÐÐ´¡°subscribe pygresql name@domain¡±£¬°Ñ¡°name@domain¡±
¸ÄÎªÄã×Ô¼ºµÄµçÓÊµØÖ·¡£
\item   Python µÄÐÂÎÅ×é¡Ã     newsgroup comp.lang.python
\item   PyGreSQL :   ÈçÓÐ³ô¡õ±¨¸æ¡¢Òâ¼û¡¢×¢ÊÍ£¬ÇëÕÒ Andre
\onlynameurl{andre@via.ecp.fr}
\end{itemize}



\subsection{²âÊÔ Python ½éÃæ}

Çë²Î¿¼ \ref{Testing PyGreSQL} {(²âÊÔ Python¡õPostgreSQL ½éÃæ)} Ò»½Ú¡£


\section{PostgreSQL ºÍÍòÎ¬ÍøµÄÕ¢Â· (gateway) ¡õ WDB-P95}




\subsection{ÓÐ¹Ø wdb-p95}

WDB-P95 - Ò»¸öÓÉ J. Douglas Dunlop ¿ª·¢µÄ PostgreSQL ×ÊÁÏ¿âÍòÎ¬Íø½éÃæ
ËüÔÚ¡Ã
\begin{itemize}
\item  J Rowe µÄÐÂ WDB ÔÚ \nameurl{http://www.lava.net/beowulf/programming/wdb}{}
\item  ÐÂ°æ±¾µÄ WWW-WDB ÔÚ \nameurl{http://www.eol.ists.ca/~dunlop/wdb-p95/}{}
\item  ÓÐÎÊÌâ»òÏë¼ÓÈëÍ¨ÐÅÂÛÌ³
\onlynameurl{dunlop@eol.ists.ca}
\end{itemize}

ÕâÊÇÒ»¸öÐÞ¸ÄÁËµÄ wdb-1.3a2£¬Ìá¹©Ò»¸ö PostgreSQL µ½ÍòÎ¬ÍøµÄÕ¢Â·¡£
Õâ°æ±¾Ò²ÐèÒªÄÜ´¦Àí HTML ±í¸ñµÄä¯ÀÀÆ÷¡£Ô­±¾µÄ wdb ÎÞ´ËÒªÇó£¬µ«Òª»¹Ô­Ò²²»ÄÑ¡£

Äã¿É³¢ÊÔ CASI Tape ºÍ Image Query¡£Äã¿É¿´¿´Æä Form Definition File 
(FDF)£¬ËüÒ²ÓÃì¶²úÉú CASI Tape ºÍ Image Query£¬Ëü°üº¬ÁËÁ½¸öÁÐ±íµÄÁª½á (join)¡£

Õâ°æ±¾°üº¬ËùÓÐÐèÒªÓÃì¶°²×°ºÍÖ´ÐÐÒÔ WDB-P95 Îª PostgreSQL 
½éÃæµÄµµ°¸¡£Òª°ÑÕâÏµÍ³ÒÆÖ²µ½ÆäËû×ÊÁÏ¿âÓ¦ÆÄÎª¼òµ¥¡õÈç¹ûËüÖ§Ô®±ê×¼µÄ SQL ºÍÓµÓÐ 
Perl ½éÃæ¡£




\subsection{PostgreSQL ËÅ·þÆ÷¡¢pgperl ºÍ httpd ÊÇ·ñÐèÔÚÍ¬Ò»µçÄÔ£¿}

·ñ¡õPostgreSQL ²»ÐèÔÚÍ¬Ò»µçÄÔ¡£Òò WDB-P95 ÓÉ httpd ¼à¿Ø³ÌÊ½ (daemon) 
ºô½Ð£¬ËüÃÇÒªÔÚÍ¬Ò»²¿µçÄÔ¡£ÓÖÒòÎª WDB-P95 Ê¹ÓÃ Pg.pm£¬pgperl Ò²ÒªÔÚÍ¬Ò»µçÄÔ¡£
Pgperl ÊÇÒÔ libpq º¯Ê½¿âÐ´³É£¬ËùÒÔËü¿É´æÈ¡ÍøÂçÉÏÈÎºÎ PostgreSQL 
ËÅ·þÆ÷£¬¾ÍÈçÆäËû PostgreSQL ¿Í»§¡£ÈçÏÂËùÊö¡Ã

(ÍòÎ¬Íø¿Í»§ (Netscape)) ={$>$} (HTTP ËÅ·þÆ÷ (NCSA's http) + WDB-P95 + pgperl + libpq)={$>$} (PostgreSQL ËÅ·þÆ÷)

À¨ºÅ () ´ú±íµçÄÔ¡£

Ã¿²¿µçÄÔ¿ÉÊÇ²»Í¬ÀàÐÍ¡ÃNT¡¢SUN¡¢HP¡­¡­µ«ÄãÐèÒªÔÚÄã´òËãÖ´ÐÐ WDB-P95 µÄµçÄÔµÄ 
libpq ½éÃæº¯Ê½¿â£¬ÒòÎªÄãÒªÓÃËüÀ´±àÒë pgperl¡££¨ÕâÏµÍ³Éè¼Æ³É»áÊ¹ÓÃ HTML 
±í¸ñ£¬ËùÒÔ×îºÃÓÐÒ»ÐÂ½üµÄÍòÎ¬Íø¿Í»§¶Ë¡££©


\section{"C", "C++", ESQL/C ÓïÑÔ½éÃæºÍ PostgreSQL µÄÖðÎ»ÔËËãÔª (Bitwise Operators)}




\subsection{"C" ½éÃæ}

ËüÒÑ°üº¬ÔÚ·¢ÐÐ°æ±¾ÖÐ£¬ÃûÎª¡®libpq¡¯¡£ºÍ Oracle OCI¡¢Sybase DB-lib¡¢Informix 
CLI º¯Ê½¿âÏàËÆ¡£




\subsection{"C++" ½éÃæ}

ËüÒÑ°üº¬ÔÚ·¢ÐÐ°æ±¾ÖÐ£¬ÃûÎª¡®libpq++¡¯¡£
Çë²Î¿¼ \ref{Testing libpq} {(²âÊÔ libpq, libpq++ ½éÃæ)} Ò»½Ú¡£


\subsection{ESQL/C}

PostgreSQL ESQL/C 'Embedded C Pre-compiler' ÀàËÆ Oracle Pro*C¡¢Informix 
ESQL/C¡£PostgreSQL ESQL/C ÊÇÒ»ÖÖ SQL Ó¦ÓÃ³ÌÊ½½éÃæ (API)£¬Ê¹ C 
³ÌÊ½Éè¼ÆÊ¦ÄÜ×ÔÐÐÉè¼Æ¿ÉÓµÓÐ¹ÜÀí×ÊÁÏ¿âµÄÄÜÁ¦µÄÓ¦ÓÃ³ÌÊ½¡£PostgreSQL ESQL/C 
ÈÝÐíÄãÊ¹ÓÃÄãËùÊìÏ¤µÄµÚÈý´úµçÄÔÓïÑÔ¶øÓÖÄÜÀûÓÃµ½½á¹¹»¯²éÑ¯ÓïÑÔ (SQL) µÄÓÅµã¡£

ESQL/C °üº¬ÒÔÏÂÈí¼þ¡Ã
\begin{itemize}
\item  ESQL/C º¯Ê½¿âÌá¹©¾ß×ÊÁÏ¿âËÅ·þÆ÷´æÈ¡ÄÜÁ¦µÄ C º¯Ê½¡£
\item  ESQL/C ±êÍ·µµÌá¹©¶Ô ESQL/C ³ÌÊ½ÓÐÓÃµÄ×ÊÁÏ½á¹¹¡¢³£ÊýºÍ¾Þ¼¯µÄ¶¨Òå¡£
\item  ESQL/C Ô¤´¦ÀíÆ÷£¬Ò»¸ö°Ñ°üº¬ SQL ¾ä×ÓµÄ C 
µµ×ª»»Îª¿ÉÖ´ÐÐµµµÄÔ´³ÌÊ½Ô¤´¦ÀíÆ÷¡£

£¨Òë°´¡ÃÓ¦Îª°Ñº¬Ç¶ÈëÊ½ SQL µÄ C µµ°¸×ª»»Îª±ê×¼µÄ C µµ°¸£¬²¢¿ÉÓÉ gcc ±àÒëÎª¿ÉÖ´ÐÐµµ¡£ÁíÍâ£¬PostgreSQL µÄ SQL Ç¶ÈëÊ½ SQL Ô¤´¦ÀíÆ÷Ó¦ÃûÎª ecpg¡££©
\end{itemize}

ËüÔÚ
\begin{itemize}
\item  PostgreSQL µÄ ESQL/C ÒÑ°üº¬ÔÚ·¢ÐÐ°æ±¾ÖÐ¡£
\item  Ö÷ÍøÕ¾ \nameurl{ftp://ftp.lysator.liu.se/pub/linus}{}
\item µçÓÊ¡Ã
\onlynameurl{linus@epact.se}
\end{itemize}

Çë²Î¿¼ \ref{Testing ecpg} {(²âÊÔ ecpg ½éÃæ)} Ò»½Ú¡£

ÒªÊ¹ÓÃ Vim ²ÊÉ«±à¼­Æ÷±àÐ´¡®ecpg¡¯µµ£¨*.pgc£©£¬ÄãÒªÕâÑù×ö¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ su - postgres
bash$ mkdir $HOME/vim
½¨Á¢Ò»¸öÃûÎª¡®$HOME/vim/myfilestypes.vim¡¯µÄµµ°¸£¬ÄÚÓÐÒÔÏÂÊýÐÐ

    " myfiletypefile
        au! BufRead,BufNewFile *.pgc    set filetype=esqlc
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÄãÓ¦¸ÃÓÐÒ»¸ö \$HOME/.gvimrc µµ¡£·ñÔòÇë×Ô¼ºÖÆÔìÒ»¸ö£¬Çë²Î¿¼ÔÚ 
\nameurl{http://metalab.unc.edu/LDP/HOWTO/Vim-HOWTO.html}{} µÄ Vim HOWTO ÎÄ¼þ¡£

ÔÚ \$HOME/.gvimrc ¼ÓÉÏÒÔÏÂÒ»ÐÐ 
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
let myfiletypefile = "~/vim/myfiletypes.vim"
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÏÖÔÚÈç¹ûÄãÓÃ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ gvim sample.pgc
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

±à¼­µµ°¸£¬Äã¿ÉµÃµ½ÒÀÓï·¨Í»³öÄÚÎÄ (syntax highlight) µÄÑÕÉ«¡£


\subsection{PostgreSQL µÄÖðÎ»ÔªÔËËãÔª}

ÖðÎ»ÔªÔËËãÔªÓÉ Nicolas Moldavsky Ð´³É
\begin{itemize}
\item        \onlynameurl{nico@overnet.com.ar}
\end{itemize}

Êµ¼ùÖðÎ»ÔªÔËËã£¨AND¡¢OR¡¢XOR¡¢Î»Ôª²¹Êý (bitwise complement)£©µÄ 
pgsql¡°C¡±º¯Ê½¡£¿É¾­ÄäÃû FTP µÃµ½¡Ã
\begin{itemize}
\item  \nameurl{ftp://ftp.overnet.com.ar/pub/utils/linux/bitpgsql.tgz}{}
\end{itemize}

°üÀ¨ÁË Linux µÄ Makefile¡£


\section{PostgreSQL µÄÈÕÎÄ¼ÙÃûÂë (Kanji Code)}

ËüÔÚÒÔÏÂÍøÖ·¡Ã
\begin{itemize}
\item   \nameurl{ftp://ftp.sra.co.jp/pub/cmd/postgres/}{}
\end{itemize}



\section{ÒÆÖ² PostgreSQL µ½ÊÓ´° 95 / ÊÓ´° NT}

ÊÓ´° NT °æµÄ PostgreSQL ¶þÔªµµ¿ÉÔÚÒÔÏÂµØ·½ÕÒµ½¡Ã
\begin{itemize}
\item  ÊÓ´° NT PostgreSQL ¶þÔªµµ \nameurl{http://www.askesis.nl}{}
\item  \nameurl{http://www.postgresql.org}{}
\end{itemize}

ÏÂÔØ¿ÉÖ´ÐÐµµ£¬½«Ëü½âÑ¹£¬²¢´ÓµÚÊ®Èý²½¿ªÊ¼¸ú´Ó\ref{installpgsql} {(°²×° PostgreSQL)}¡£

Èç¹ûÄãÏëÖØÐÂ±àÒëÔ­³ÌÊ½Âë£¬Çë¸ú´ÓÒÔÏÂÖ¸Ê¾¡£ÒÆÖ²µ½ÊÓ´° NT ÒªÊ¹ÓÃ Cygnus 
cygwin32 Ì×¼þ£¬Ëü°üÀ¨ÊÓ´° NT/95 µÄ gcc¡¢gmake¡£
\begin{itemize}
\item  Cygwin 32 Ì×¼þÔÚ \nameurl{http://www.cygnus.com/misc/gnu-win32}{}
ÕÒµ½
\end{itemize}

µ½´ËÍøÒ³È¡µÃ cdk.exe µµ£¨gnu-win32 µÄ×ÔÎÒ½âÑ¹µµ£©
£¨Òë°´¡Ã´Ë¹¤¾ßÒÑ¸ÄÃûÎª cygwin£¬ÍøÖ·Îª \nameurl{http://sourceware.cygnus.com}{}¡££©


\subsection{NT °æµÄ×÷Õß}

PostgreSQL NT °æµÄ×÷ÕßÎª¡õ
\begin{itemize}
\item  Daniel Horak 
\onlynameurl{horak@mmp.plzen-city.cz}
\item  Joost Kraaijeveld
\onlynameurl{JKraaijeveld@askesis.nl}
\item  Kevin Lo
\onlynameurl{kevlo@FreeBSD.org}
\item  NT °æµÄÍøÒ³ÔÚ \nameurl{http://www.freebsd.org/~kevlo/postgres/portNT.html}{}
\end{itemize}



\subsection{°²×° Cygwin Ì×¼þ}

\begin{enumerate}
\item  ÏÂÔØ \nameurl{ftp://go.cygnus.com/pub/sourceware.cygnus.com/cygwin/latest/full.exe}{}
\item  Ö´ÐÐ full.exe£¬°²×°µ½ c:$\backslash$Unix$\backslash$Root Ä¿Â¼¡£
\item  Ö´ÐÐ Cygwin£¬¼üÈë¡®mount --help¡¯ÒÔÔÄ¶ÁÎÄ¼þ¡£Äã¿ÉÓÃ -f
Ñ¡ÏîÇ¿ÖÆ¹ÒÉÏ¡£Ö®ááÖ´ÐÐ¡°umount / " ºÍ¡°mount c:$\backslash$Unix$\backslash$Root /¡±
\end{enumerate}



\subsection{Éè¶¨ Bash ÊÓ´°}

°²×° Cygwin Ì×¼þáá£¬Çë½øÐÐÒÔÏÂ¹¤×÷ÒÔÉè¶¨¹¤×÷»·¾³¡Ã

1. °²×° Vi ±à¼­Æ÷¡®Vim¡¯¡£Çë²ÎÔÄ
\nameurl{http://metalab.unc.edu/LDP/HOWTO/Vim-HOWTO.html}{}

2. cygwin bash µÄÔ¤¶¨ÊÓ´°ÊÇÒ»¸öØ¥ËÄÐÐ£¬µ×É«ÎªºÚÉ«µÄÊÓ´°¡£ÒªÉè¶¨ bash
ÊÓ´°µÄµ×É«ºÍ´óÐ¡£¬°´¿ªÊ¼-{$>$}¿ØÖÆÌ¨-{$>$}MS DOS Ö÷¿ØÌ¨£¬°Ñµ×É«Éè¶¨ÎªºÚÉ«£¬
´óÐ¡¸ÄÎªÆßÊ®ÐÐ¡£

£¨»ò£©ÓÒ»÷ÊÓ´°±êÌâÁÐ£¬¸Ä±äÄÚÈÝ¡£

3. ±à¼­ c:$\backslash$cygnus$\backslash$cywinb20 ÖÐµÄ cygnus.bat ºÍ×÷ÒÔÏÂÉè¶¨¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
set HOME=c:\cygnus\cygwinb20
bash --login
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


¼°±à¼­ ~/.bash\_profile ¼ÓÉÏÕâ¼¸ÐÐ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
set -o vi
PATH=$PATH:/usr/local/bin:/usr/bin
export PATH
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


4. ÒªÆôÓÃÖ¸ÁîÁÐÀúÊ·±à¼­£¬¼üÈë¡õ

bash\$ set -o vi

Ê¹ÓÃ l¡¢k¡¢j¡¢h£¬Äã¿ÉÓÃ vi
Ö¸Áî±à¼­Ö¸ÁîÁÐÀúÊ·¡£Äã¿ÉÖØ¸²ºÍÐÞ¸ÄÖ®Ç°µÄÖ¸Áî£¬ÒÔ½ÚÊ¡´ò×ÖÊ±¼ä¡£

5. Äã¿ÉÓÃÒÔÏÂÖ¸Áî¹ÒÉÏ´Åµú»ú / Ä¿Â¼¡õ

\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ umount /
bash$ mount "c:\cygnus"  /
bash$ mount "c:\cygnus\cygwin-b20\postgres" /usr/local/pgsql
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


6. ÓÃÒÔÏÂÖ¸ÁîÔÄ¶ÁÏßÉÏÇóÖúÑ¶Ï¢¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ mount --help
bash$ ls --help
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}





\subsection{°²×° Andy Piper ¹¤¾ß}

\begin{enumerate}
\item µ½ \nameurl{ftp://ftp.xemacs.org/pub/xemacs/aux/}{} ÏÂÔØ 
cygwin-b20-local.tar.bz2 µ½ 
c:/Unix/Root Ä¿Â¼¡£ 
\item  cd c:/Unix/Root; bunzip2 cygwin-b20-local.tar.bz2 
\item  tar -xvf cygwin-b20-local.tar 
\item  cd /local/bin; sh check\_cygwin\_setup.sh 
\item  Íê³ÉµÚËÄ²½áá£¬Äã»á¿´µ½ÒÔÏÂÑ¶Ï¢¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
You don't have /bin would you like to mount cygwin as /bin?" 
[ y/n ]   
Ñ¡¡®n¡¯£¬ÆäËûÎÊÌâÔòÑ¡¡®y¡¯¡£
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  mount c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/bin 
/bin 
\item  cd c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32; mkdir 
libexec share 
man etc sbin info 
\item  cp -R /local/$\{$ bin,libexec,share,man,etc,sbin,info,include $\}$
\end{enumerate}



\subsection{°²×° Ludovic Lange µÄ Cygwin32 IPC Ì×¼þ}

\begin{enumerate}
\item  µ½ \nameurl{http://www.multione.capgemini.fr/tools/pack_ipc}{} ÏÂÔØ 
cygwin32\_ipc-1.03.tgz µ½ c:/Unix/Root Ä¿Â¼¡£
\item  tar -zxvf cygwin32\_ipc-1.03.tgz 
\item  cd cygwin32\_ipc-1.03/src and run 'make' 
\item  mkdir -p c:/usr/local/$\{$bin,include,lib,include/sys$\}$ 
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
cp /cygwin32_ipc-1.03/bin/* c:/usr/local/bin 
cp /cygwin32_ipc-1.03/include/sys/* c:/usr/local/include/sys 
cp /cygwin32_ipc-1.03/lib/* c:/usr/local/lib 
cp c:/usr/local/bin/* /bin 
cp c:/Unix/Root/cygwin-b20/H-i586-cygwin32/bin/* /bin 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  mount c:/usr/local/bin /usr/local/bin 
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
mount c:/usr/local/include /usr/local/include 
mount c:/usr/local/lib /usr/local/lib 
cp /local/lib/* /usr/local/lib 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\end{enumerate}



\subsection{°²×° PostgreSQL \label{installpgsql}}

\begin{enumerate}
\item  ÏÂÔØ×îÐÂµÄ PostgreSQL Ô´³ÌÊ½Âë
\item  Postgres °ÑËùÓÐµµ°¸µ±×÷¶þÔªµµ£¬ËùÒÔ»áÓöµ½ lf/cf 
ÎÊÌâ£¬ÎÒÃÇÒª×öµÚ¶þÖÁÎå²½¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
mkdir -p c:/Postgres/{Source,Binary} 
mkdir c:/Postgres/Binary/pgsql 
mkdir -p /usr/src/pgsql 
mkdir -p /usr/local/pgsql 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  °Ñ Postgres Ô´³ÌÊ½Âë¿½±´µ½ c:/Postgres/Source Ä¿Â¼£¬Ö®áá
tar -zxvf postgresql-6.5.3.tar.gz 
\item  mv postgresql-6.5.3 pgsql 
\item  ÏÖÔÚ¹ÒÉÏ¸÷¸öÄ¿Â¼¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
mount -b c:/Postgres/Binary/pgsql /usr/local/pgsql 
mount c:/Postgres/Source/pgsql /usr/src/pgsql 
mount c:/Unix/Root/cygwin-b20/share /sw/cygwin-b20/share 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  mkdir -p /usr/local/pgsql/$\{$bin,include,lib,data$\}$ 
\item  cd /usr/src/pgsql/src/win32 
\item  ¿½±´±êÍ·µµ¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
cp un.h c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include/sys 
cp endian.h c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include 
cp tcp.h c:/Unix/Root/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include/netinet 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  ln -s /usr/local/lib /usr/src/pgsql/src/backend/libpostgres.a 
\item  cd /usr/src/pgsql/src, Ö®ááÖ´ÐÐ './configure' 
\item  make {$>$} make.txt 2{$>$}\&1 
\item  make install  {$>$} make.install.txt 2{$>$}\&1 
\item  cp /usr/local/pgsql/lib/pq.dll /usr/local/pgsql/bin 
\item  ÔÚ make install Ö®ááÄãÒª°Ñ bin ºÍ lib Ä¿Â¼ÖÐµÄÎÄ×Öµµ×ª»»£¬ÒÔÇå³ý cr/lf 
ºÍ eof Ö®Àà¶«Î÷¡£
\item  ÔÚ / Ä¿Â¼Ê¹ÓÃÈÎºÎ±à¼­Æ÷²úÉú .bashrc ÈçÏÂ¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
PATH=$PATH:/usr/local/pgsql/bin:/usr/local/bin 
PGDATA=/usr/local/pgsql/data 
PGLIB=/usr/local/pgsql/lib 
LD_LIBRARY_PATH=/usr/local/pgsql/lib:/usr/local/lib 
export LD_LIBRARY_PATH PATH PGDATA PGLIB 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  source /.bashrc, Ö®ááÖ´ÐÐ 'initdb --username=xxxx' 
Òª×¢Òâ×ÊÁÏ¿âÏµÍ³µÄÓµÓÐÈË²»¿ÉÒÔÊÇ root/administrator¡£
\item  ±à¼­ /usr/local/pgsql/data/pg\_hba.conf µµ£¬Èç¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
host        all     163.17.11.109   255.255.255.0   trust 
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}
\item  ipc-daemon.exe\& 
\item  postmaster -i\& 
\item  Ö´ÐÐ ' psql -h host\_name template1'
\end{enumerate}



\section{Í¨ÐÅÂÛÌ³}




\subsection{PostgreSQL µÄµçÓÊ»§¿Ú}

ÒÔÏÂµØ·½È¡µÃÃâ·ÑµçÓÊ
\begin{itemize}
\item  ÔÚ Yahoo \nameurl{http://www.yahoo.com}{} »÷Ñ¡ e-mail
\item  In Lycos \nameurl{http://www.lycos.com}{} »÷Ñ¡ new e-mail accounts
\item  In hotmail \nameurl{http://www.hotmail.com}{} »÷Ñ¡ new e-mail accounts
\end{itemize}


¶©ÔÄ PostgreSQL Í¨ÐÅÂÛÌ³£¬¶ø Yahoo ÓÐÒ»¸ö¸½¼ÓÌØÉ«£¬¿ÉÎª PostgreSQL 
µçÓÊ½¨Á¢¶ÀÁ¢µÄÄ¿Â¼£¬ÃâÖÂÈÅÂÒÄãÆäËûµÄµçÓÊ¡£ÔñÑ¡Ä¿Â¼ Email- $>$ Options- $>$ 
Filters ¼°¼ðÑ¡ seperate folder for email¡£
Äã¿ÉÓÃÕâ¸öµçÓÊ»§¿ÚÔÚÊÀ½çÈÎºÎµØ·½ÊÕ·¢µçÓÊ£¬Ö»ÒªÄãÄÜÉÏÍø¡£

Èç¹ûÄãÓÐÆäËûµçÓÊ£¬Äã¿ÉÓÃ¡°Mail Filters¡±À´×Ô¶¯°Ñ PostgreSQL 
ÓÊ¼þ·Åµ½¶ÀÁ¢µÄÄ¿Â¼£¬ÒÔÃâ»ìÂÒ¡£


\subsection{Ó¢ÎÄÍ¨ÐÅÂÛÌ³}

Çë²ÎÔÄÖ÷ÍøÒ³µÄ Mailing Lists ÏîÄ¿¡Ã
\begin{itemize}
\item  \nameurl{http://www.postgresql.org/}{}
\item °ÑÎÊÌâµçÓÊÖÁ¡Ã
\onlynameurl{pgsql-questions@postgresql.org}
\item  ¿ª·¢ÈËÔ± \onlynameurl{pgsql-hackers@postgresql.org}
\item  ÓÐ¹ØÒÆÖ²µÄÎÊÌâ \onlynameurl{pgsql-ports@postgresql.org}
\item  ÎÄ¼þÎÊÌâ \onlynameurl{pgsql-docs@postgresql.org}
\end{itemize}

Äã»áÔÚÒ»ÈÕÖ®ÄÚ´ÓµçÓÊÊÕµ½´ð°¸»ò»Ø¸²¡£

ÄãÒ²¿É¶©ÔÄÍ¨Ñ¶ÂÛÌ³¡£Òª¶©ÔÄ»òÍ£Ö¹¶©ÔÄ£¬µçÓÊÖÁ
\begin{itemize}
\item  \onlynameurl{pgsql-questions-request@postgresql.org}
\item  \onlynameurl{pgsql-hackers-request@postgresql.org}
\item  \onlynameurl{pgsql-ports-request@postgresql.org}
\item  \onlynameurl{pgsql-docs-request@postgresql.org}
\end{itemize}

Ñ¶Ï¢µÄÕýÎÄÖ»¿ÉÓÐÒ»ÐÐ

subscribe

£¨»ò£©

unsubscribe


\subsection{Í¨ÐÅÂÛÌ³´æ¿â}

Í¨ÐÅÂÛÌ³Ò²ÒÔ html ¸ñÊ½´æ¿âÔÚÒÔÏÂµØ·½¡Ã
\begin{itemize}
\item  ¾­ MHonarc ÔÙ¾­ WWW µÄÃ¿ÈÕÄ¿Â¼
\nameurl{http://www.postgresql.org/mhonarc/pgsql-questions}{}
\item  \nameurl{ftp://ftp.postgresql.org}{} Ä¿Â¼ /pub/majordomo
\end{itemize}

PostgreSQL Ö÷ÍøÒ³ÖÐÒ²ÓÐÒ»¸ö×¨Îª pgsql ÎÊÌâ¶øÉèµÄËÑÑ°ÒýÇæ¡£


\subsection{Î÷°àÑÀÎÄÍ¨ÐÅÂÛÌ³}

Ä¿Ç°ÓÐÒ»¸ö¡¸·Ç¹Ù·½¡¹µÄÎ÷°àÑÀÎÄ PostgreSQL Í¨ÐÅÂÛÌ³¡£Òª¶©ÔÄµÄ»°£¬ÓÃÕßÐèµçÓÊÖÁ¡Ã
\begin{itemize}
\item  \onlynameurl{majordomo@tlali.iztacala.unam.mx}
\end{itemize}

Ñ¶Ï¢µÄÕýÎÄÖ»¿ÉÓÐÒ»ÐÐ

inscripcion pgsql-ayuda


\section{ÎÄ¼þºÍ²Î¿¼Êé}




\subsection{ÓÃ»§Ö¸ÒýºÍËµÃ÷Êé}

PostgreSQL ·¢ÐÐ°æ±¾ÖÐÒÑ°üÀ¨ÒÔÏÂ¸÷ÏîµÄ postscript¡¢HTML ¸ñÊ½ ºÍ unix 
man-pages¡£ËüÃÇÔÚ /usr/doc/postgresql* Ä¿Â¼ÖÐ¡£Èç¹ûÄãÄÜÉÏÍø£¬
Äã¿ÉÔÚÒÔÏÂµØ·½ÕÒµ½ÏÂÁÐÎÄ¼þ¡Ã \nameurl{http://www.postgresql.org/docs}{}

\begin{itemize}
\item  "Installation Guide"
\item  "User Guide" for PostgreSQL
\item  "Implementation Guide" ÏêÏ¸ËµÃ÷ PostgreSQL ×ÊÁÏ¿âµÄÄÚ²¿ÔË×÷
\item  ÏßÉÏËµÃ÷Êé
\item  HTML ¸ñÊ½µÄÏßÉÏËµÃ÷Êé
\item  Postscript ¸ñÊ½µÄÏßÉÏËµÃ÷Êé£¬ÓÃÒÔÁÐÓ¡
\end{itemize}



\subsection{ÏßÉÏÎÄ¼þ}

\begin{itemize}
\item  ÄÚ½¨×ÊÁÏÐÍÌ¬ºÍÔËËãÔªµÄÃûµ¥ºÍ½âËµ
\begin{tscreen}
\begin{verbatim}
A ÊÇ·ñ PSQL Ö¸ÁîµÄÒ»²¿·Ö
\end{verbatim}
\end{tscreen}
\item  Ö§Ô®µÄ SQL ¹Ø¼ü×ÖÃûµ¥
\begin{tscreen}
\begin{verbatim}
ÔÚÔ´³ÌÊ½ /tools Ä¿Â¼ÖÐÓÐÒ»¸öÃüÁî¸å (script)
\end{verbatim}
\end{tscreen}
\item  Ö§Ô®µÄ¾äÓïÃûµ¥
\begin{tscreen}
\begin{verbatim}
Ê¹ÓÃ psql \h Ö¸Áî
\end{verbatim}
\end{tscreen}
\item  PostgreSQL µÄ»ù±¾µÄ¹ØÁªÊ½×ÊÁÏ¿â¸ÅÄî£¨ÊµÊ©·½·¨£©ºÍÊý¸öÏßÉÏÀý×Ó£¨²éÑ¯£©
\begin{tscreen}
\begin{verbatim}
¿´ src/test ÖÐµÄ regression ²âÊÔ£¬Çë²ÎÔÄ <ref name="Àý×Ó RPM" 
id="Examples RPM">¡£Äã»áÕÒµ½ regress/sql ºÍ suite/*.sql Ä¿Â¼¡£
\end{verbatim}
\end{tscreen}
\item  PostgreSQL Ö¸µ¼
\begin{tscreen}
\begin{verbatim}
SQL Ö¸µ¼¸å¼þÔÚ src/tutorial Ä¿Â¼ÖÐ
\end{verbatim}
\end{tscreen}

Ò²Çë²ÎÔÄ±¾ÎÄ¼þ¸½Â¼ÒÒ \ref{Appendix B} {(¸½Â¼ÒÒ)} µÄ¡°³õÑ§Õß SQL Ö¸µ¼¡±¡£
\end{itemize}



\subsection{ÓÐÓÃµÄ²Î¿¼Êé}

\begin{itemize}
\item  "Understanding the New SQL: A Complete Guide" - Jim Melton ºÍ 
Alan R.Simon Öø
\begin{tscreen}
\begin{verbatim}
Morgan Kaufman Publisher ÊÇÆäÖÐÒ»±¾×îºÃµÄ SQL Êé¡£Õâ±¾ÊéÒÔ SQL92 Îª×¼¡£
\end{verbatim}
\end{tscreen}
\item  "A Guide to THE SQL STANDARD" - C.J.Date Öø
\begin{tscreen}
\begin{verbatim}

Addison-Wesley Publishing company Ò²ÊÇÒ»±¾ºÃÊé¡£ÓÐ¹Ø SQL µÄÃû×÷¡£
\end{verbatim}
\end{tscreen}
\item SQL - The Standard Handbook,  Ò»¾Å¾Å¶þÄêÊ®Ò»ÔÂ
\begin{tscreen}
\begin{verbatim}
Stephen Cannan ºÍ Gerard Otten
McGraw-Hill Book Company Europe , Berkshire, SL6 2QL, England
\end{verbatim}
\end{tscreen}
\item SQL Instant Reference, 1993
\begin{tscreen}
\begin{verbatim}
Martin Gruber, Technical Editor: Joe Celko
SYBEX Inc.  2021 Challenger Drive Alameda, CA 94501
\end{verbatim}
\end{tscreen}
\item  C.J.Date, "An introduction to Database Systems"
(µÚÁù°æ), Addison-Wesley, 1995, ISBN 0-201-82458-2
\begin{tscreen}
\begin{verbatim}
Õâ±¾ÊÇ×ÊÁÏ¿â¹ÜÀíÏµÍ³µÄÊ¥¾­¡£Õâ±¾ÊéÏêÏ¸ËµÃ÷Õý¹æ»¯ (normalization)¡¢SQL¡¢»Ö¸´ 
(recovery)¡¢²¢ÐÐÐÔ (concurrency)¡¢±£°²¡¢ÕûºÏÐÔ (integrity)¡¢
¶ÔÔ­±¾µÄ¹ØÁªÄ£Ê½µÄÑÓÉì¡¢ÏÖ½ñµÄ»°ÌâÈçÖ÷´ÓÏµÍ³ºÍÎï¼þµ¼ÏòÄ£Ê½¡£
Ò²°üÀ¨´óÁ¿²Î¿¼×ÊÁÏÒÔ¹©ÉîÈëÑÐ¾¿¡£Ïò´ó²¿·ÖÓÃ»§ÍÆ¼ö¡£
\end{verbatim}
\end{tscreen}
\item  Stefan Stanczyk, "Theory and Practice of Relational Databases",
UCL Press Ltd, 1990, ISBN 1-857-28232-9
\begin{tscreen}
\begin{verbatim}
Õâ±¾ÊéÏêÏ¸ËµÃ÷¹ØÁªÊ½×ÊÁÏ¿â¡¢¹ØÏµ´úÊý (relational algebra)¡¢¹ØÏµÑÝËã (calculus)
ºÍÕý¹æ»¯µÄÀíÂÛ¡£µ«Ëü²»°üº¬ÏÖÊµÊÀ½çµÄÎÊÌâºÍ½Ï¸´ÔÓµÄÀý×Ó¡£Ïò´ó²¿·ÖÓÃ»§ÍÆ¼ö¡£
\end{verbatim}
\end{tscreen}
\item "The Practical SQL Handbook" µÚÈý°æ£¬
Addison Wesley Developers Press
ISBN 0-201-44787-8
\begin{tscreen}
\begin{verbatim}
Ïò´ó²¿·ÖÓÃ»§ÍÆ¼ö¡£
\end{verbatim}
\end{tscreen}
\item  Michael Stonebraker, "Readings in Database Systems",
Morgan Kaufmann, 1988, ISBN 0-934613-65-6
\begin{tscreen}
\begin{verbatim}
ÕâÊÇ¹ýÈ¥ÊýÄêÓÐ¹Ø×ÊÁÏ¿âµÄÂÛÎÄ¼¯¡£Ëü²»ÊÇ¸øÒ»°ãÓÃÕß¿´£¬¶øÊÇ½ø½×µÄÑ§Éú£¨ÑÐ¾¿Éú£©
»ò×ÊÁÏ¿â¿ª·¢ÈËÔ±¡£
\end{verbatim}
\end{tscreen}
\item  C.J.Date, "Relational Database - Selected Readings",
Addison-Wesley, 1986, ISBN 0-201-14196-5
\begin{tscreen}
\begin{verbatim}
ÕâÊÇ¹ýÈ¥ÊýÄêÓÐ¹Ø×ÊÁÏ¿âµÄÂÛÎÄ¼¯¡£Ëü²»ÊÇ¸øÒ»°ãÓÃÕß¿´£¬¶øÊÇ½ø½×µÄÑ§Éú£¨ÑÐ¾¿Éú£©
»ò×ÊÁÏ¿â¿ª·¢ÈËÔ±¡£
\end{verbatim}
\end{tscreen}
\item  Nick Ryan ºÍ Dan Smith, "Database Systems Engineering",
International Thomson Computer Press, 1995, ISBN 1-85032-115-9
\begin{tscreen}
\begin{verbatim}
Õâ±¾ÊéÉîÈëËµÃ÷´æÈ¡·½·¨ºÍ´¢´æ¼¼¿¼¡£
\end{verbatim}
\end{tscreen}
\item  Bipin C. Desai, "An introduction to Database Systems",
West Publishing Co., 1990, ISBN 0-314-66771-7
\begin{tscreen}
\begin{verbatim}
Ëü²»ÊÇ¸øÒ»°ãÓÃÕß¿´£¬¶øÊÇ½ø½×µÄÑ§Éú£¨ÑÐ¾¿Éú£©»ò×ÊÁÏ¿â¿ª·¢ÈËÔ±¡£
\end{verbatim}
\end{tscreen}
\item  Joe Celko "INSTANT SQL Programming"
\begin{tscreen}
\begin{verbatim}
Wrox Press Ltd.
Unit 16, 20 James Road, Tyseley
Birmingham, B11 2BA, England
1995
\end{verbatim}
\end{tscreen}
\item  Michael Gorman "Database Management Systems: Understanding and 
Applying Database"
\begin{tscreen}
\begin{verbatim}
Technology
QED and John Wiley
1991
\end{verbatim}
\end{tscreen}
\item  Michael Gorman "Enterprise Database for a Client/Server Environment"
QED and John Wiley
\begin{tscreen}
\begin{verbatim}
ËµÃ÷½¨Á¢¾­ÓÉ repository metamodels µÄÖ÷´Ó×ÊÁÏ¿âÓ¦ÓÃ³ÌÊ½µÄÒªÇóºÍ ANSI
±ê×¼ SQL 1993 µÄÓ¦ÓÃ¡£
\end{verbatim}
\end{tscreen}
\end{itemize}


»¹ÓÐÊýÒÔ°Ù¼ÆÓÐ¹Ø SQL µÄÊé£¡µ½Êéµê¿´¿´°É¡£


\subsection{ANSI/ISO SQL ¹æ¸ñÎÄ¼þ¡õSQL 1992, SQL 1998}

ANSI/ISO SQL ¹æ¸ñÎÄ¼þ¿ÉÔÚÏÂÁÐÍøÕ¾ÕÒµ½¡Ã
\begin{itemize}
\item  \nameurl{http://www.naiua.org/std-orgs.html}{}
\item  \nameurl{http://www.ansi.org/docs}{} ³¸¶¯µµ°¸ cat\_c.html 
¼°Ñ°ÕÒ¡°Database SQL¡±¡£
\item  SQL92 ±ê×¼ \nameurl{http://www.jcc.com}{} ³¸¶¯µµ°¸ sql\_stnd.html¡£
\item  ANSI/ISO SQL ¹æ¸ñ \nameurl{http://www.contrib.andrew.cmu.edu/~shadow/sql.html}{} 
Äã»áÔÚ´ËÕÒµ½ SQL µÄ²Î¿¼×ÊÁÏ¡£
\end{itemize}



\subsection{ANSI/ISO SQL 1992 µÄÓï·¨}

Çë²ÎÔÄ±¾ÎÄ¼þµÄ¸½Â¼¼× \ref{Appendix A} {(¸½Â¼¼×)}


\subsection{ANSI/ISO SQL 1998 µÄÓï·¨}

SQL 1998 (SQL 3) ¹æ¸ñÈÔÔÚ¿ª·¢ÖÐ¡£²Î¿´±¾ÎÄ¼þµÄ¡°µç×ÓÍ¾¾¶È¡µÃ SQL3 ²Ý°¸¡±
\ref{SQL 1998} {()}


\subsection{³õÑ§Õß SQL µ¼Òý}

²Î¿´±¾ÎÄ¸½Â¼ÒÒ \ref{Appendix B} {()}


\subsection{SQL92 µÄÊ±Ì¬ÑÓÉì (Temporal Extension)}

\begin{itemize}
\item SQL92 µÄÊ±Ì¬ÑÓÉìµÄÎÄ¼þ
\nameurl{ftp://FTP.cs.arizona.edu/tsql/tsql2/}{}
\item Temporal SQL-3 ¹æ¸ñ
\nameurl{ftp://FTP.cs.arizona.edu/tsql/tsql2/sql3/}{}
\end{itemize}


ÕâÄ¿Â¼ÖÐ°üÀ¨Ò»¸ö SQL-92 ÓïÑÔ¹æ¸ñµÄÊ±Ì¬ÑÓÉì¡£ÕâÖÖÐÂÓïÑÔ±»ÃûÎª TSQL2¡£

ÕâÀïµÄÓïÑÔ¹æ¸ñÊÇÕâÓïÑÔµÄ×îÖÕ°æ±¾¡£

¿ÉÖ±½ÓÁªÂç TSQL2 Éè¼ÆÎ¯Ô±»áµÄÖ÷Ï¯¡ÃRichard T.Snodgrass, 
Department of Computer Science, University of Arizona, Tucson, AZ 85721,
\begin{itemize}
\item        \onlynameurl{rts@cs.arizona.edu}
\end{itemize}

TSQL2 Language Design Committee µÄµçÓÊµØÖ·ºÍÈë»áÏêÇé¿ÉÔÚÓïÑÔ¹æ¸ñ×îááµÄ
Ò»ÕÂÕÒµ½¡£

ÕâÄ¿Â¼ÖÐµÄÄÚÈÝÈçÏÂ¡£

spec.dvi,.ps    TSQL2 ÓïÑÔ¹æ¸ñ£¬Ò»¾Å¾ÅËÄÄê¾ÅÔÂ³ö°æ

bookspec.ps     TSQL2 ÓïÑÔ¹æ¸ñ£¬ÄÚÈÝÈçÔÚ TSQL2 µÄÊé°ã£¬Ò»¾Å¾ÅÎåÄêÊ®ÔÂ
³ö°æ£¨Çë²ÎÔÄÏÂÎÄ£©

sql3            Ìá½»¸ø ANSI ºÍ ISO SQL3 ³ïÎ¯»áµÄÐÞ¶©½¨Òé

ºÍÓïÑÔ¹æ¸ñÒ»Æð£¬ÕâÀï»¹ÊÕ¼¯ÁËÒ»Ð©ÓÐ¹ØÉè¼ÆÉÏµÄ¾ö¶¨µÄÆÀÂÛ¡¢Ìá¹©Àý×Ó¡¢
ºÍÑÐ¾¿ÈçºÎÊµ¼ùÕâÓïÑÔ¡£ÕâÐ©ÆÀÂÛÔ­±¾ÊÇ¸ø TSQL2 Language Design Committee 
µÄ½¨Òé¡£ËüÃÇÏÖÔÚÓÐÁíÒ»¸öÓÃ´¦¡ÃÌá¹©ÓÐ¹Ø TSQL2 ¹¹ÔìµÄÀý×Ó¡¢
ÍÆ¶¯Éè¼ÆÊ±×÷³öµÄ´óÁ¿¾ö¶¨¡¢±È½Ï TSQL2 ºÍ¹ýÈ¥Ê®ÎåÄêÓÐÈËÌáÒé¹ýµÄ´óÁ¿ÓïÑÔ¡£
±ØÐëÇ¿µ÷£¬ÇëÐ©ÆÀÂÛÄ¿Ç°²»ÊÇ TSQL2 ÓïÑÔ¹æ¸ñµÄÒ»²¿·Ö£¬¶øÊÇ¶ÔËüµÄ²¹³äºÍ·¢Õ¹¡£
ÕâÓïÑÔ¹æ¸ñÒÑÊÇ TSQL2 µÄ×îÖÕ¾ö¶¨¡£

ÕâÐ©ÆÀÂÛ£¬¼ÓÉÏÓïÑÔ¹æ¸ñ¡¢Êý¸öË÷ÒýºÍÆäËûÖ§Ô®²ÄÁÏ£¬ÒÑ¾­¼¯½á³ÉÊé¡Ã

Snodgrass, R.T., editor, The TSQL2 Temporal Query Language, Kluwer
Academic Publishers, 1995, 674+xxiv Ò³¡£

ÊéÖÐÓÐÒ»¸ö½ÚÂ¼ÁËµÄÆÀ¼Û£¬ÍêÕûµÄÆÀ¼ÛÔÚ´ËÄ¿Â¼ÖÐµÄ eval.ps Ìá¹©¡£

tl2tsql2.pl µµÊÇÒ»¸ö°Ñ»ñ½ÓÊÜµÄÊ±Ì¬Âß¼­ (temporal logic) ·­ÒëÎª TSQL2 µÄ 
prolog ³ÌÊ½¡£Õâ³ÌÊ½ÓÉ Michael Boehlen Ð´³É¡£
\begin{itemize}
\item        \onlynameurl{boehlen@iesd.auc.dk}
\end{itemize}

¸÷Î»¿É½Ó´¥ËûÒÔÈ¡µÃÒ»·Ý½âÊÍÕâ·­Òë¹ý³ÌµÄÂÛÎÄ¡£ÕâÊÇÕâ³ÌÊ½µÄ¾É°æ±¾¡£ÐÂ°æ±¾ÔÚ
\begin{itemize}
\item  \nameurl{http://www.cs.auc.dk/general/DBS/tdb/TimeCenter/Software}{}
\end{itemize}

(the TimeDB and Tiger systems).


\subsection{µÚÁã²¿·Ö¡õÈ¡µÃ ISO/ANSI SQL ÎÄ¼þ \label{SQL 1998}}

ÕâÎÄÕÂËµÃ÷ÈçºÎ£¨ºÏ·¨µØ£©È¡µÃÒ»·Ý SQL-92 ±ê×¼ºÍÔõÑùÈ¡µÃÒ»·Ý¡°ÏÖÊ±µÄ¡±SQL3 ²Ý°¸¡£

Õâ±ê×¼°æÈ¨ËùÓÐ£¬ ANSI ±ê×¼µÄ³ÖÓÐÈËÎª ANSI£¬ISO ±ê×¼µÄ³ÖÓÐÈËÎª ISO¡£

ÏÖÊ±ÓÐÁ½£¨2£©¸ö SQL ±ê×¼£¬·Ö±ðÓÉ ANSI ºÍ ISO ³ö°æ¡£ÕâÁ½·Ý±ê×¼Ã¿¸ö×Ö¶¼Ò»Ä£Ò»Ñù£¬
³ýÁËÒ»Ð©Ð¡½Ú£¬ÈçÎÄ¼þ±êÌâ¡¢Ò³Ê×¡¢¶Ì¾ä¡°International Standard¡±ºÍ¡°American 
Standard¡±Ö®Àà¡£



¹ºÂò SQL-92 ±ê×¼

The ISO standard, ISO/IEC 9075:1992, Information Technology - Database
Languages - SQL£¬Ä¿Ç°£¨Ò»¾Å¾ÅÈýÄêÈýÔÂ£©ÔÚ ANSI ÓÐ´æ»õ¼°¿ÉµÃµ½¡Ã
\begin{tscreen}
\begin{verbatim}
     American National Standards Institute
     1430 Broadway
     New York, NY 10018 (USA)
     Phone (sales): +1.212.642.4900
\end{verbatim}
\end{tscreen}

¼ÛÇ® US\$230.00¡£ANSI °æ£¬ANSI X3.135-1992, American National Standard for 
Information Systems - Database Language SQL£¬Ä¿Ç°²¢ÎÞ´æ»õ£¬
µ«Ó¦¸Ã¿ÉÔÚÒ»¾Å¾ÅÈýÄêÈýÔÂÏÂÑ®ÖÁÎåÔÂÉÏÑ®¼äµÃµ½¡£¹À¼ÆËüµÄ¼ÛÇ®ÊÇ US\$225.00¡£

Èç¹ûÄã´Ó ANSI ¹ºÂòÈÎºÎÒ»·ÝÎÄ¼þ£¬ÄãÐèÒª¸ø 7\% µÄÊÖÐø·Ñ£¨¼´´óÔ¼ 
US\$9.10£©¡£º£ÍâÓÊ¼Ä¿Ï¶¨»á¸ü¹ó¡£ANSI ÒªÇóËùÓÐµ¥¾Ý¶¼°éËæÒ»·Ý¹«Ë¾¶©µ¥µÄ¸´Ó¡±¾£¬
»òÕßÄã¿ÉÒÔÃÀÔª¼ÄÒ»ÕÅÃÀ¹úµÄÒøÐÐµÄÖ§Æ±£¬ËûÃÇ»áÔÚ½áÁËÕËáá¼Ä¸øÄã¡£
£¨ÀýÍâÇé¿ö¡ÃÈç¹ûÄãµÄ×éÖ¯ÊÇ ANSI µÄ¹«Ë¾»áÔ± (corporate member)£¬ANSI 
»á°ÑÎÄ¼þ¼Ä¸øÄã¶øÏò¹«Ë¾ÊÕÇ®¡££©

ÔÚÃÀ¹ú¹úÍâ£¬ISO ±ê×¼Ò²¿É´Ó×÷Îª ISO (International Organization for 
Standardization) »ò IEC (International Electrotechnical Commission) 
»áÔ±µÄ±¾ÍÁ¹úÓª»ú¹¹£¨¹ú¼ÒµÄ±ê×¼×éÖ¯£©¹ºÂò¡£¹úÓª»ú¹¹¼°ÆäµØÖ·µÄÃûµ¥¿É´Ó ANSI 
»òÆäËû¹úÓª»ú¹¹È¡µÃ¡£ËüÃÇÒ²¿É´Ó ISO µÃµ½¡Ã
\begin{tscreen}
\begin{verbatim}
     International Organization for Standardization
     Central Secretariat
     1, rue de Varembi
     CH-1211 Genhve 20
     Switzerland
\end{verbatim}
\end{tscreen}

Èç¹ûÄãÏëÒÔ¸ü·½±ã¿ì½ÝµÄ·½·¨¶©¹ºÕâ±ê×¼£¬ÄãÐèÒª¸½³ö´ú¼Û¡£Äã¿É´ÓÒÔÏÂ×éÖ¯ÒÔ 
US\$308.00 ¶©¹º ISO/IEC 9075:1992, Information Technology - 
Database Languages - SQL¡Ã
\begin{tscreen}
\begin{verbatim}
     Global Engineering Documents
     2805 McGaw Ave
     Irvine, CA 92714 (USA)
     USA
     Phone (works from anywhere): +1.714.261.1455
     Phone (only in the USA): (800)854-7179
\end{verbatim}
\end{tscreen}

ÎÒ²»ÖªµÀÕâÊÇ·ñ°üÀ¨»õÔË·Ñ£¬µ«ÎÒ¹À¼Æ£¨ÆðÂë£©¹ú¼Ê»õÔË»á¶îÍâÊÕ·Ñ¡£
ËûÃÇ»áÆÄÎª¿ì½ÝµØ°ÑÎÄ¼þ¼Ä¸øÄã£¬ÉõÖÁ»á½ÓÊÜ¡°Ö÷ÒªµÄÐÅÓÃ¿¨¡±¡£Global »¹Ã»ÓÐ ANSI 
°æ£¬»òËûÃÇÃ»ÓÐ¼ÛÇ®»ò¹À¼ÆÊ±¼ä£¨µ«ÎÒÔ¤¼ÆËü»áÔÚ ANSI ³ö°æááÊýÖÜÖ®ÄÚ³öÏÖ£¬¼ÛÇ®½Ó½ü 
US\$300.00£©¡£



¹ºÂòÒ»·Ý SQL3 ²Ý°¸ (Working Draft)

Äã¿É´Ó ANSI X3 Secretariat, CBEMA (Computer and Business Equipment Manufacturers
Association) ¹ºÂòÒ»·Ý SQL3 ²Ý°¸µÄ¸´Ó¡±¾¡£ËûÃÇÒâÍ¼È·±£ÄÜÌá¹©¡°×î½ü¡±°æ±¾µÄ 
SQL3 ²Ý°¸£¬²¢ÒÔ US\$60.00 ÖÁ US\$65.00 ³öÊÛ¡£Äã¿ÉÒÔÒÔÏÂÍ¾¾¶½Ó´¥ CBEMA¡£
\begin{tscreen}
\begin{verbatim}
     CBEMA, X3 Secretariat
     Attn: Lynn Barra
     1250 Eye St.
     Suite 200
     Washington, DC 20005 (USA)
\end{verbatim}
\end{tscreen}

Lynn Barra Ò²¿ÉÒÔµç»°ºÅÂë +1.202.626.5738 ½Ó´¥ÒÔÒªÇóÒ»·Ý£¬²»¹ýÓÊ¼ÄËÆºõ½ÏÓÐÀñÃ²¡£

µç×Ó¾¶È¡µÃ SQL3 ²Ý°¸

×îÐÂ°æ±¾£¨ÒÔÐ´±¾ÎÄÊ±Îª×¼£©µÄ SQL3£¨ANSI ºÍ ISO£©²Ý°¸£¨ºÍËùÓÐ¸½¼þ£©
¿ÉÔÚÒÔÏÂÕ¾Ì¨ÒÔ¡°anonymous ftp¡±»ò¡°ftpmail¡±µÃµ½¡Ã
\begin{tscreen}
\begin{verbatim}
     gatekeeper.dec.com

  ÔÚ

     /pub/standards/sql/
\end{verbatim}
\end{tscreen}

ÕâÄ¿Â¼ÖÐÓÐ¶à¸öµµ°¸£¬°üÀ¨ PostScript µµºÍ´¿ÎÄ×Öµµ£¨¸ñÊ½²»ºÜÃÀ¹Û£¬
µ«¿ÉÔÚÓ©Ä»ÉÏÎÞÐëÌØ±ðÈí¼þÔÄ¶Á£©¡£

Ò»°ãÀ´Ëµ£¬Äã¿ÉÕÒµ½ÀàËÆÃû³ÆµÄµµ°¸¡Ã
\begin{tscreen}
\begin{verbatim}
     sql-bindings-mar94.ps
     sql-bindings-mar94.txt
     sql-cli-mar94.ps
     sql-cli-mar94.txt
     sql-foundation-mar94.ps
     sql-foundation-mar94.txt
     sql-framework-mar94.ps
     sql-framework-mar94.txt
     sql-psm-mar94.ps
     sql-psm-mar94.txt
\end{verbatim}
\end{tscreen}

Íê³ÉÐÂ°æ±¾µÄÎÄ¼þáá£¬¡°mar94¡±»á¸Ä±äÀ´ËµÃ÷ÐÂµÄ³ö°æÈÕÆÚ£¨ÀýÈç¡°aug94¡±ÊÇ¹À¼ÆÔÚ
¡°mar94¡±Ö®ááµÄ°æ±¾£©¡£

ÁíÍâ£¬ÎªÕÕ¹Ë²»ÄÜ´Ó FTP È¡µÃµµ°¸Ãûµ¥µÄ¶ÁÕß£¬ÎÒÃÇÔÚÄ¿Â¼ÖÐ·ÅÖÃÁËÒ»¸öÃûÎª
\begin{tscreen}
\begin{verbatim}
     ls
\end{verbatim}
\end{tscreen}

µÄµµ°¸¡£Õâµµ°¸£¨ÉñÆæ£¡£©°üÀ¨ÁËÄ¿Â¼ÄÚµÄµµ°¸Ãûµ¥¡£



´Ó Ftp Ö±½Ó»ñµÃµµ°¸

ÕâÊÇÊ¹ÓÃ FTP µÄÀý×Ó¡£ËüÌØ±ðËµÃ÷ÈçºÎÁ¬½Óµ½ gatekeeper.dec.com£¬
µ½´ï·ÅÖÃÕâÐ©µµ°¸µÄÄ¿Â¼£¬¼°°Ñµµ°¸´«ËÍµ½ÄãµÄµçÄÔ¡£Òª×¢ÒâµÄµÄµçÄÔÒªÓÐÉÏÍø¹¦ÄÜ¡£
Ç©ÈëÃû³ÆÊÇ¡®ftp¡¯£¬ÃÜÂëÔòÊÇÄãµÄµçÓÊµØÖ·£¨¼´ËùÎ½¡®anonymous ftp¡¯£©¡£Ö¸Áî¡®type 
binary¡¯ÊÇÓÃÀ´È·±£ÊÕµ½µÄµµ°¸ÖÐÃ»ÓÐÎ»Ôª±»½ØÈ¥¡£¡®get¡¯Ò»´ÎÈ¡µÃÒ»¸öµµ°¸¡£
ÔÚÃüÁî¸å (script) ÖÐµÄ×¢½â»áÔÚ½ÇÀ¨ºÅÄÚ $<$ ¼´ÊÇÈç´Ë $>$¡£
\begin{tscreen}
\begin{verbatim}
  % ftp gatekeeper.dec.com
  Connected to gatekeeper.dec.com.
  220- *** /etc/motd.ftp ***
       Gatekeeper.DEC.COM is an unsupported service of DEC Corporate Research.
       <¡­µÈÒ»»á¡­>
  220 gatekeeper.dec.com FTP server (Version 5.83 Sat ... 1992) ready.
  Name (gatekeeper.dec.com:<ÄãµÄµÇÈëÃû³Æ>): ftp  <anonymous Ò²¿É>
  331 Guest login ok, send ident as password.
  Password: <¼üÈëÄãµÄµçÓÊµØÖ·>
  230 Guest login ok, access restrictions apply.
  Remote system type is UNIX.  <Ê²÷áÒ²Ã»ËùÎ½>
  Using binary mode to transfer files.
  ftp> cd pub/standards/sql
  250 CWD command successful.
  ftp> dir
  200 PORT command successful.
  150 Opening ASCII mode data connection for /bin/ls.
  total 9529
  -r--r--r--  1 root     system     357782 Feb 25 10:18 x3h2-93-081.ps
  -r--r--r--  1 root     system     158782 Feb 25 10:19 x3h2-93-081.txt
  -r--r--r--  1 root     system     195202 Feb 25 10:20 x3h2-93-082.ps
  -r--r--r--  1 root     system      90900 Feb 25 10:20 x3h2-93-082.txt
  -r--r--r--  1 root     system    5856284 Feb 25 09:55 x3h2-93-091.ps
  -r--r--r--  1 root     system    3043687 Feb 25 09:57 x3h2-93-091.txt
  226 Transfer complete.
  ftp> type binary
  200 Type set to I.
  ftp> get x3h2-93-082.txt
  200 PORT command successful.
  150 Opening BINARY mode data connection for x3h2-93-082.txt (90900 bytes).
  226 Transfer complete.
  90900 bytes received in 0.53 seconds (166.11 Kbytes/s)
  ftp> quit
  % <Õâµµ°¸ÒÑ³ÉÎªÄãµÄµçÄÔÖÐµÄ x3h2-93-082.txt>
\end{verbatim}
\end{tscreen}

Ã»ÓÐ ftp Ö§Ô®µÄÇé¿öÏÂÈ¡µÃµµ°¸

Digital Equipment Corporation ºÍÊý¼äÆäËû¹«Ë¾ÏàËÆ£¬Ìá¹© ftp email 
·þÎñ¡£Ëü¿ÉÄÜÐèÒªÊýÌì²ÅÓÐ»ØÓ¦£¬µ«ËüÎª²»ÄÜÖ±½ÓÉÏÍøµÄÈËÌá¹©ÁËµÈÍ¬ ftp 
µÄ·þÎñ¡£ËÅ·þÆ÷µÄµØÖ·Îª¡Ã

ftpmail@decwrl.dec.com

ÒÔÏÂÃüÁî¸å»áÈ¡µÃ×îÐÂ°æ±¾µÄ SQL3 ÎÄ¼þµÄ PostScript °æ¡Ã
\begin{tscreen}
\begin{verbatim}
     reply joe.programmer@imaginary-corp.com
     connect gatekeeper.dec.com anonymous
     binary
     compress
     uuencode
     chdir /pub/standards/sql
     get x3h2-93-091.ps
     quit
\end{verbatim}
\end{tscreen}

µÚÒ»¾äÖ¸Áî¸æËßËÅ·þÆ÷Òª°Ñµµ°¸´«¸øÄã£¬ÄãÐèÒª°Ñ
¡°joe.programmer@imaginary-corp.com¡±»»ÎªÄãµÄµçÓÊµØÖ·¡£ÕâÀý×ÓÖÐµÄµµ°¸ 
x3h2-93-091.ps »áÒÔ uuencode ÁËµÄ compress µµ¸ñÊ½£¬·Ö³ÉÈýÊ®ËÄ·âµçÓÊ»Ø¸²¡£
Èç¹ûÄãµÄ»·¾³Ã»ÓÐÌá¹©ÖØ×éµµ°¸µÄ¹¤¾ß£¬ÄãÐèÒªÓÃÏÂÁÐÃüÁî¸åÒÔ´¿ÎÄ×ÖÄ£Ê½È¡µÃµµ°¸¡Ã
\begin{tscreen}
\begin{verbatim}
     reply joe.programmer@imaginary-corp.com
     connect gatekeeper.dec.com anonymous
     chdir /pub/standards/sql
     get x3h2-93-091.ps
     quit
\end{verbatim}
\end{tscreen}

µ«Çë×¢Òâ£¬Õâ .ps µµ´ó¸Å»á±»·ÖÎª³¬¹ýÆßÊ®·ÝÀ´»Ø¸²£¡

ÒªÈ¡µÃÈÎºÎ²»ÊÇ x3h2-93-091.ps µÄµµ°¸£¬Ö»Ðè°Ñ¡°x3h2-93-091.ps¡±
»»ÎªÄãÏëÒªµÄµµ°¸µÄÃû³Æ¡£ÒªÈ¡µÃËùÓÐµµ°¸µÄÃûµ¥£¬°Ñ¡°x3h2-93-091.ps¡±»»Îª
¡°dir¡±¡£


\subsection{µÚÒ»²¿·Ö¡õISO/ANSI SQL µ±Ç°Çé¿ö}

ÕâÕÂÊÇÓÐ¹Ø SQL ±ê×¼ºÍÆäµ±Ç°Çé¿öµÄ×ÊÁÏÀ´Ô´¡£

µ±Ç°Çé¿ö¡Ã

Ä¿Ç°ÕýÔÚ½øÐÐ¿ª·¢¹¤×÷£¬ÒÔ¸Ä½ø SQL ÎªÎª¼ÆËãÉÏÍêÕûµÄÓïÑÔ (computationally 
complete language)£¬ÒÔ¿ÉÓÃì¶³Ö¾Ã¡¢¸´ÔÓµÄÎï¼þ¡£Õâ°üÀ¨¡ÃÒ»°ã»¯ºÍ×¨ÃÅ»¯µÈ¼¶ 
(generalization and specialization hierarchies)¡¢¶à¼¶¼Ì³Ð (multiple 
inheritance)¡¢×Ô¶©×ÊÁÏÐÎÌ¬¡¢¼¤·¢ (triggers) ºÍÅÐ¶Ï 
(assertions)¡¢ÖªÊ¶¿âÏµÍ³Ö§Ô® (support for knowledge based systems)¡¢»ØµÝ²éÑ¯Ê½ 
(recursive query expression) ºÍ¸½¼Ó×ÊÁÏ¹ÜÀí¹¤¾ß¡£ËüÒ²°üÀ¨³éÏó×ÊÁÏÐÍÌ¬ 
(ADTs)¡¢Îï¼þÊ¶±ð×Ö (object identifiers)¡¢·½·¨ (methods)¡¢¼Ì³Ð 
(inheritance)¡¢¶àÐÍ (polymorphism)¡¢°ü×° (encapsulation)¡¢
ºÍËùÓÐÆäËûÓëÎï¼þ×ÊÁÏ¹ÜÀíÓÐ¹ØµÄ¹¦ÄÜµÄ¹æ¸ñ¡£

Ò»¾Å¾ÅÁùÄêÇï¼¾£¬SQL3 Êý¸ö²¿·Ö½øÐÐÁËÒ»´Î ISO CD ²»¼ÇÃûÍ¶Æ±¡£ÕâÊý²¿·ÖÊÇ 
SQL/Framework¡¢SQL/Foundation ºÍ SQL/Bindings¡£Ò»ÈçËùÁÏ£¬
Í¶Æ±½á¹ûÊÇÔÚÊÕµ½Ô¼¾Å°Ù¸öÆÀÂÛÏÂÔâ·ñ¾ö¡£Ò»ÔÂÏÂÑ®¾ÙÐÐÁËÒ»´Î ISO DBL ±à¼­»áÒé 
(editing meeting)£¬´¦ÀíÁË´óÁ¿ÔÚÆÀÂÛÖÐÌá¼°»òÁíÍâÌá½»µÄÎÊÌâ½â¾ö·½·¨¡£
ÓÉì¶¸Ã´Î»áÒéÎ´ÄÜ´¦ÀíËùÓÐÆÀÂÛ£¬»áÒé½«»áÑÓ³¤¡£
±à¼­»áÒé¶¨ì¶Ò»¾Å¾ÅÆßÄêÆßÔÂÔÚÂ×¶ØÍê³É¡£

¾Ý¹À¼Æ£¬ÔÚÆßÔÂµÄ±à¼­»áÒéÖ®áá£¬»áÔÙÌá³ö¶ÔÓÐ¹ØÄÇÐ©²¿·ÖµÄ SQL ½øÐÐ×îááµÄ CD 
Í¶Æ±¡£×îáá CD ¹ý³Ì»á»¨´óÔ¼Áù¸öÔÂ£¬Ö®áá»áÓÐ DBL ±à¼­»áÒé¡¢DIS Í¶Æ±ºÍ¿ì½ÝµÄ 
IS Í¶Æ±¡£

ISO µÄ³ÌÐòÔÚ SQL/92 Ö®áá¸Ä±äÁË£¬ËùÒÔ SQL Î¯Ô±»áÈÔÔÚÃþË÷Õâ¹ý³ÌµÄÏêÇé¡£

Èç¹ûÊÂÊÂË³Àû£¬SQL3 µÄÕâÐ©²¿·Ö»áÔÚ 1998 ÄêááÆÚ³ÉÎª¹Ù·½ ISO/IEC 
±ê×¼£¬²»¹ýÊ±¼ä·Ç³£½ôÆÈ¡£

ÔÚÒ»¾Å¾ÅÈýÄê£¬ANSI ºÍ ISO ¿ª·¢Î¯Ô±»á¾ö¶¨°ÑÖ®ááµÄ SQL 
·¢Õ¹·ÖÎª¶à²¿·ÖµÄ±ê×¼¡£ÕâÐ©²¿·Ö°üÀ¨¡Ã

\begin{itemize}
\item    Part 1: Framework A non-technical description of how the document is
structured.
\item    Part 2: Foundation The core specification, including all of the new ADT
features.
\item    Part 3: SQL/CLI The Call Level Interface.
\item    Part 4: SQL/PSM The stored procedures specification, including
computational completeness.
\item    Part 5: SQL/Bindings The Dynamic SQL and Embedded SQL bindings taken
from SQL-92.
\item    Part 6: SQL/XA An SQL specialization of the popular XA Interface
developed by X/Open
\item    Part 7:SQL/TemporalAdds time related capabilities to the SQL standards.
\end{itemize}


ÔÚÃÀ¹ú£¬SQL3 µÄÕûÌåÍ¬Ê±µ±×÷ ANSI ±¾ÍÁ (Domestic, "D") ×¨°¸ºÍ ISO 
×¨°¸´¦Àí¡£Ä¿Ç°¹À¼ÆÍê³ÉÊ±¼äÊÇÒ»¾Å¾Å¾ÅÄê¡£

SQL/CLI ºÍ SQL/PSM ÏÖÕýÒÔ×î¸ßËÙ¶È´¦Àí£¬ÒÔ×÷Îª SQL-92 µÄÐÞ¶©¡£ÔÚÃÀ¹ú£¬
ËüÃÇÖ»±»µ±×÷¹ú¼Ê (International, "I") ×¨°¸´¦Àí¡£ SQL/CLI 
ÔÚÒ»¾Å¾ÅÎåÄêÍê³ÉÁË¡£SQL/PSM Ó¦¸Ã»áÔÚ 1996 ÄêÎ´¶ÎÍê³É¡£

³ýÁË SQL3 Íâ£¬»¹ÓÐÒ»Ð©¸½¼ÓµÄ¼Æ»®¡Ã

\begin{itemize}
\item    SQL/MM An ongoing effort to define standard multi-media packages using
the SQL3 ADT capabilities.
\item    Remote Data Access (RDA)
\end{itemize}


±ê×¼Î¯Ô±»áºÍ¹ý³Ì (Standards Committee and Process)

ÊÂÊµÉÏ£¬ÊÀÉÏÓÐ¶à¸ö SQL ±ê×¼Î¯Ô±»á¡£ISO ÓÐÒ»²¿·ÖÊÇÒ»¸ö¹ú¼Ê SQL 
±ê×¼Ð¡×é¡£¶à¸ö¹ú¼Ò¶¼ÓÐÒÔ SQL ÎªÖØµãµÄÎ¯Ô±»á¡£ÕâÐ©¹ú¼Ò£¨Í¨³££©ÅÉ³ö´ú±í²ÎÓë 
ISO/IEC JTC1/SC 21/WG3 DBL »áÒé¡£Ö÷¶¯²ÎÓë ISO SQL ±ê×¼ÖÆ¶¨µÄ¹ú¼ÒÊÇ¡Ã

\begin{itemize}
\item    °ÄÖÞ
\item    °ÍÎ÷
\item    ¼ÓÄÃ´ó
\item    ·¨¹ú
\item    µÂ¹ú
\item    ÈÕ±¾
\item    º«¹ú
\item    ºÉÀ¼
\item    Ó¢¹ú
\item    ÃÀ¹ú
\end{itemize}


NIST È·ÈÏ (NIST Validation)

ÔÚÃÀ¹ú£¬SQL Êµ¼ùµÄÈ·ÈÏ¹¤×÷ÓÉ National Institute of Standards and Training 
(NIST) ½øÐÐ¡£NIST Ä¿Ç°ÓÐÒ»Ì×ÈëÃÅ¼¶ (entry level) SQL-92 µÄ²âÊÔÌ×¼þ¡£NIST 
È·ÈÏÒªÇóµÄÏêÇé±»¶¨ÒåÎªÒ»Ïî Federal Information Processing Standard 
(FIPS)¡£Ä¿Ç°¶Ô SQL µÄÒªÇó¶¨Òåì¶ FIPS 127-2¡£±¾ÎÄ¼þµÄ Postscript ºÍÎÄ×ÖÄ£Ê½¿É´Ó 
NIST È¡µÃ¡£Ä¿Ç°Í¨¹ý SQL È·ÈÏµÄ²úÆ·Ãûµ¥Ò²¿ÉÔÚ NIST È¡µÃ¡£

±ê×¼ SQL ¿¯ÎïºÍÎÄ¼þ (Standard SQL Publications and Articles)

SQL ±ê×¼ÓÐÁ½¸ö°æ±¾¡£Á½¸ö¶¼¿É´Ó ANSI È¡µÃ¡Ã

\begin{itemize}
\item    ISO/IEC 9075:1992, "Information Technology --- Database Languages ---
SQL"
\item    ANSI X3.135-1992, "Database Language SQL"
\end{itemize}


³ý·âÃæºÍ¶ÔÆäËû±ê×¼µÄ²Î¿¼Íâ£¬SQL ±ê×¼µÄÁ½¸ö°æ±¾ÍêÈ«Ò»Ñù¡£
Á½¸ö°æ±¾¶¼¿É´ÓÒÔÏÂµØ·½È¡µÃ¡Ã
\begin{tscreen}
\begin{verbatim}
     American National Standards Institute
     1430 Broadway
     New York, NY 10018
     USA
     Phone (sales): +1.212.642.4900
\end{verbatim}
\end{tscreen}

³ý SQL-92 ±ê×¼Íâ£¬ÏÖÔÚ»¹ÓÐÒ»·Ý¼¼ÊõÕýÎó±í (Technical Corrigendum) £¨³ý´í£©¡Ã
\begin{tscreen}
\begin{verbatim}
   * Technical Corrigendum 1:1994 to ISO/IEC 9075:1992
\end{verbatim}
\end{tscreen}

TC 1 Ó¦¸Ã¿É´Ó ANSI È¡µÃ¡£TC 1 Ö»ÓÐ ISO °æ±¾¡õ¡õËüÊÊÓÃì¶ ISO ºÍ ANSI °æ±¾µÄ 
SQL-92¡£

³ý±ê×¼Íâ£¬Ò²ÓÐ¹Øì¶ 1992 SQL ±ê×¼µÄÊé¡£ÕâÐ©ÊéÌá¹©Ò»¸ö±ÈÊµ¼Ê±ê×¼Ò×Àí½âµÄÃèÊö¡£

ÓÐ¹ØµÄ±ê×¼

SQL ÉçÈºÒ²¶Ô¶à¸öÆäËû±ê×¼ÓÐÐËÈ¤¡£Õâ½Ú°üÀ¨Ò»Ð©ÓÐ¹ØÕâÐ©Å¬Á¦µÄÖ¸Õë¡£
µ±¸ü¶à×ÊÁÏÔÚÍøÉÏ³öÏÖáá£¬Õâ¸öÃûµ¥Ò²»á¸ü³¤¡£

\begin{itemize}
\item   SQL Environments (FIPS 193)
\item    Next Generation Repository Systems (X3H4) - Ò»·ÝºôÓõ²ÎÓë "Developing 
Standards for the Next Generation Repository Systems" µÄÐÂÎÅ¸å¡£
\end{itemize}



\subsection{µÚ¶þ²¿·Ö¡õISO/ANSI SQL »ù½ð (ISO/ANSI SQL Foundation)}

SQL3 Å¬Á¦µÄÒ»¸öÖØÒª²¿·ÖÔÚ SQL »ù½ðÎÄ¼þÖÐ¡Ã

\begin{itemize}
\item    »ù±¾µÄ SQL/PSM ÄÜÁ¦£¨À´×Ô SQL/PSM-92£©
\item    ÐÂµÄ×ÊÁÏÐÍÌ¬
\item    ¼¤·¢ (Triggers)
\item    ×Ó±í¸ñ (Subtables)
\item    ³éÏñ×ÊÁÏÐÍÌ¬ (Abstract Data Types, ADT)
\item    Îï¼þµ¼ÏòÄÜÁ¦
\end{itemize}


¶ÔÎï¼þµ¼ÏòÄÜÁ¦ÓÐÊý¸öÏÈ¾öÒªÇó¡Ã

\begin{itemize}
\item    ¶¨Òå¸´ÔÓÔË×÷µÄÄÜÁ¦
\item    °Ñ¸´ÔÓµÄÔË×÷´¢´æÔÚ×ÊÁÏ¿âÖÐ
\item    ºô½ÐÍâ²¿³ÌÐò£¬ÓÐÐ©²»ÄÜÓÃ SQL ×öµ½µÄÔË×÷£¬»òÐèÒªºÍÍâÃæ¹µÍ¨
\end{itemize}


ÕâÐ©ÄÜÁ¦ÒÑ¶¨ÒåÎª SQL/PSM µÄÒ»²¿·Ö

ÏÖÔÚÓÐ´óÁ¿¹¤×÷ì¶Á¶ÖÆ SQL-3 Îï¼þÄ£ÐÍ£¬Ê¹ËüºÍ ODMG Ìá³öµÄÎï¼þÄ£ÐÍ¿´Æë¡£ÕâÅ¬Á¦ÔÚ 
X3H2 ºÍ ISO DBL ÎÄÕÂÖÐÃèÊö¹ý¡ÃÈÝÄÉ SQL3 ºÍ ODMG¡£ÔÚ SQL3/OQL Merger 
×î½üµÄ¸üÐÂ°æÒ²¿ÉµÃµ½¡£

SQL3 Ê±¼ä±í

ÓÐ¹Ø SQL3 µÄ¹¤×÷ÕýÔÚ½øÐÐ£¬µ«×îÖÕ±ê×¼»¹ÓÐ´ýÊýÄêáá²Å³öÏÖ¡£

\begin{itemize}
\item   ¹ú¼ÊÐÔÍ¶Æ±°Ñ SQL3 »ù´¡´Ó²Ý°¸ÌáÉýÎªÎ¯Ô±²Ý°¸ (Committee Draft, CD)
ÔÚÒ»¾Å¾ÅÁùÈÕÇï¼¾½øÐÐ¡£
\item   ¹À¼ÆÍ¶Æ±»á´øÀ´´óÁ¿ÆÀÂÛ
\item   ½«»áÐèÒªµÚ¶þ´Î CD Í¶Æ±
\item   Draft International Standard Í¶Æ±¶à°ë»áÔÚ 1998 ÄêÖÐ½øÐÐ
\item   ¹ú¼Ê±ê×¼¿ÉÔÚÒ»¾Å¾Å¾ÅÄêÖÐÍê³É
\end{itemize}


ANSI °æµÄ±ê×¼µÄ±àÅÅÒ²²î²»¶à¡£


\subsection{µÚÈý²¿·Ö¡õISO/ANSI SQL ºô½Ð¼¶½éÃæ (Call Level Interface)}

SQL/CLI ÊÇÒ»ÖÖ¶Ô SQL ×ÊÁÏ¿âµÄºô½Ð¼¶½éÃæ¡£ËüÉè¼ÆÎªÖ§Ô®°ü¹ü (shrink-wrapped) 
µÄÓ¦ÓÃ³ÌÊ½¡£CLI Ô­±¾ÓÉ SQL Access Group (SAG) µÄÒ»¸öÐ¡×éÎ¯Ô±»á´´Ôì¡£ SAG/CLI 
¹æ¸ñÔÚ 1992 ÄêÒÔÎ¢Èí Open DataBase Connectivity (ODBC) ¹æ¸ñ¹«²¼¡£Ò»¾Å¾ÅÈýÄê£¬
SAG °Ñ CLI Ìá½»µ½ ANSI ºÍ ISO SQL Î¯Ô±»áÖÐ¡£(SQL Access Group ÏÖÒÑ½áºÏµ½ 
X/Open consortium ÖÐ¡£)

SQL/CLI Ìá¹©ÁËÒÔÏÂÊÂÏîµÄ¹ú¼Ê±ê×¼¡Ã



\begin{itemize}
\item    ¶ÀÁ¢ì¶Êµ¼ù·½·¨µÄ CLI À´´æÈ¡ SQL ×ÊÁÏ¿â
\item    Ö÷´Ó¹¤¾ß (Client-server tools) ¿ÉÇáÒ×¼®¶¯Ì¬Á´½áº¯Ê½¿â´æÈ¡×ÊÁÏ¿â
\item    Ö§Ô®¼°¹ÄÀø·á¸»µÄÖ÷´Ó¹¤¾ß
\end{itemize}


SQL/CLI Ê±¼ä±í

¶Ô±ê×¼µÄ¿ª·¢¹ý³Ì£¬SQL/CLI ÕýÒÔ¾ªÈËµÄËÙ¶È´¦ÀíÖÐ¡£

\begin{itemize}
\item    SQL/CLI ÊÇ¶Ô 1992 SQL ±ê×¼£¨SQL-92£©µÄ²¹ÒÅ
\item    Ò»¾Å¾ÅÎåÄêÍê³É£¬³ÉÎª ISO ±ê×¼
\item    ISO/IEC 9075-3:1995 Information technology -- Database languages -- SQL
-- Part 3: Call-Level Interface (SQL/CLI)
\item    Ä¿Ç° SQL/CLI ÕýÅ¬Á¦¼ÓÉÏ SQL3 ¹¦ÄÜ
\end{itemize}



\subsection{µÚËÄ²¿·Ö¡õ ISO/ANSI SQL ³Ö¾Ã´¢´æÄ£×é (Persistent Stored Modules)}

SQL/PSM ¼®ÒÔÏÂ¹¦ÄÜÀ©³ä SQL¡Ã

\begin{itemize}
\item    ³ÌÐòÓïÑÔ (Procedural language) ÑÓÉì
\item    ¸´¾ä (Multi-statement) ºÍ´¢´æ³ÌÐò
\item    Íâ²¿º¯ÊýÓë³ÌÐòºô½Ð (External function and procedure calls)
\end{itemize}


³ý×÷ÎªÓÐ¼ÛÖµµÄÓ¦ÓÃ³ÌÊ½¿ª·¢¹¤¾ß£¬SQL/PSM Îª SQL3 Ìá¹©ÁËÎï¼þµ¼ÏòÄÜÁ¦µÄ»ù´¡Ö§Ô®¡£

¸´¾äºÍÄÚ´æ³ÌÐò

¸´¾äºÍÄÚ´æ³ÌÐòÎªÖ÷´Ó»·¾³Ìá¹©¶àÖÖºÃ´¦¡Ã

\begin{itemize}
\item    ±íÏÖ¡õÓÉì¶ÄÚ´æ³ÌÐò¿ÉÖ´ÐÐ¶à¾ä SQL Óï¾ä£¬Óë¿Í»§¾­ÍøÂçµÄ¹µÍ¨¿É¼õÉÙ¡£
\item    ±£°²¡õÓÃÕß¿ÉÒÔÓÐÈ¨Àû¾­ÄÚ´æ³ÌÐò¸üÐÂÒ»¸ö»ò¶à¸ö±í¸ñ£¬µ«Ã»È¨Ö±½Ó¸üÐÂ¡£
\item    ·ÖÏí³ÌÊ½Âë¡õ²»ÐèÃ¿¸ö´æÈ¡×ÊÁÏ¿â¿Í»§¹¤¾ß¶¼ÖØÐ´ºÍÖØÊÔÄÚ´æ³ÌÐòµÄ³ÌÊ½Âë¡£
\item    ¿ØÖÆ¡õÎªÓ¦ÓÃ³ÌÊ½µÄÖ´ÐÐÌá¹©µ¥Ò»µÄ¶¨ÒåºÍ¿ØÖÆ¡£
\end{itemize}


³ÌÐòÓïÑÔÑÓÉì

³ÌÐòÓïÑÔ¼®Á÷Ïò¿ØÖÆºÍÆäËû±à³Ì¼¼ÇÉÎª SQL ¼ÓÉÏ´«Í³³ÌÊ½ÓïÑÔµÄ¹¦ÄÜ¡£

Á÷Ïò¿ØÖÆÓï¾ä

\begin{itemize}
\item    If-then-else
\item    »ØÈ¦½á¹¹ (Looping constructs)
\item    ÀýÍâ´¦Àí (Exception handling)
\item    Case Óï¾ä
\item    Begin-End Çø¿é
\end{itemize}


³ÌÐòÓïÑÔÑÓÉì»¹°üÀ¨ÆäËû±à³Ì¼¼ÇÉ¡Ã

\begin{itemize}
\item    ±äÊýÐû¸æ
\item    Set Óï¾ä£¬ÓÃì¶¸³Öµ (assignment)
\item    È¡µÃÐÐ³Ì (process) ºÍ×´Ì¬µÄ×ÊÁÏ
\end{itemize}


´ËÍâ£¬ËùÓÐ´«Í³ SQL ÓïÑÔ¶¼¿É°üº¬ÔÚ¶à¾äµÄ³ÌÐòÖÐ¡£

Íâ²¿º¯ÊýÓë³ÌÐòºô½Ð

Ò»¸ö¾­³£ÔÚ´óÁ¿×ÊÁÏ¿â²úÆ·µÄ wish lists ÖÐ³öÏÖ£¬¶øÓÐ²¿·ÖÊµ¼ùµ½µÄÌØÉ«£¬
ÊÇºô½ÐÓÃÕßËùÐ´£¬ÔÚ×ÊÁÏ¿âÈí¼þÍâµÄ³ÌÐò¡£

\begin{itemize}
\item    ÈÝÐíÄ³¸öµçÄÔ»òÓ¦ÓÃ³ÌÊ½¼ÓÉÏ×Ô¼ºµÄ×ÊÁÏ¿âº¯Êý
\item    ¿ÉÔÚÕû¸ö×ÊÁÏ¿âÓ¦ÓÃ³ÌÊ½Ê¹ÓÃ
\end{itemize}


Õâ¹¦ÄÜµÄºÃ´¦ÊÇËüÈÃ×ÊÁÏ¿â£¨Òò´Ë°üÀ¨×ÊÁÏ¿âÓ¦ÓÃ³ÌÊ½£©Ê¹ÓÃ·á¸»µÄ³ÌÐòºÍº¯Êý£¬
·á¸»µÃ²»ÄÜÓÉÒ»¸ö±ê×¼×éÖ¯¶¨³ö¡£

SQL/PSM Ê±¼ä±í

SQL/PSM ·¢Õ¹Ñ¸ËÙ¡Ã

\begin{itemize}
\item    SQL/PSM ÊÇ SQL-92 µÄ²¹ÒÅ
\item    ÓÐ¹Ø°Ñ SQL/PSM 
´Ó¹ú¼Ê±ê×¼µÄ²Ý°¸±äÎª¹ú¼Ê±ê×¼µÄ¹ú¼ÊÍ¶Æ±ÔÚÒ»¾Å¾ÅÁùÄêÒ»ÔÂÍê³É¡£
\item    Ò»¾Å¾ÅÁùÄêÎåÔÂµÄ±à¼­»áÒéÎ´ÄÜ½â¾öËùÓÐÆÀÂÛ
\item    PSM ±à¼­»áÒé°²ÅÅì¶Ò»¾Å¾ÅÁùÄê¾ÅÔÂÈýÊ®ÈÕÖÁÊ®ÔÂËÄÈÕÆÚ¼äÖØ¿ª
\item    °²ÅÅ½ôÆÈ£¬µ« PSM ÓÐ¿ÉÄÜÔÚÒ»¾Å¾ÅÁùÄê¼ä³ö°æ
\item    ¹Ù·½ÈÎÃüÎª¡Ã
ISO/IEC DIS 9075-4:199? Information technology -- Database languages --
SQL -- Part 4: SQL Persistent Stored Modules (SQL/PSM)
\item    ÏÖÕýÎª SQL3 ¼ÓÉÏ SQL/PSM Ö§Ô®¹¤×÷¡£
\end{itemize}



\subsection{µÚÎå²¿·Ö¡õ ISO/ANSI SQL/½áºÏ (Bindings)}

Îª·½±ã²Î¿¼£¬³ÌÊ½ÓïÑÔµÄ½áºÏ±»³é³ö³É¶ÀÁ¢µÄÎÄ¼þ¡£Ä¿Ç°µÄ°æ±¾¼´ÊÇ SQL-92 
µÄ¶¯Ì¬ºÍÇ¶Èë½áºÏ (dynamic and embedded bindings) µÄ½ÚÂ¼¡£

³ÌÊ½ÓïÑÔ½áºÏÈÔÓÐ²»Í¬µÄÎÊÌâÓÐ´ý½â¾ö¡£

¶Ô´«Í³³ÌÊ½ÓïÑÔÀ´Ëµ£¬×ÊÁÏÐÍÌ¬ºÍ SQL-92 µÄ¿ÉÒÔ»¥Ïà¶ÔÓ¦¡£²»¹ý£¬ SQL 
Îï¼þºÍ³ÌÊ½ÓïÑÔ±äÊýÖ®¼äµÄ¶ÔÓ¦±ØÐë¶¨Òå¡£

¶ÔÎï¼þµ¼ÏòÓïÑÔÀ´Ëµ£¬Ä¿Ç°µÄ SQL ×ÊÁÏÐÍÌ¬¡¢SQL 
Îï¼þÄ£ÐÍºÍÎï¼þµ¼Ïò³ÌÊ½ÓïÑÔÖ®¼äµÄ¶ÔÓ¦¹ØÏµ±ØÐë¶¨Òå¡£

Îï¼þÄ£ÐÍÐèÔÚ¹«¿ªÕâÐ©Ö®Ç°ÎÈ¶¨ÏÂÀ´¡£

ÓïÑÔ½áºÏÍê³ÉÊ±»á³ÉÎª SQL3 µÄÒ»²¿·Ö¡£


\subsection{µÚÁù²¿·Ö¡õISO/ANSI SQL XA ½éÃæ×¨ÃÅ»¯ £¨SQL/XA£©}

Õâ¹æ¸ñ»áÎª×Ü½»Ò×¹ÜÀíÔ± (global Transaction Manager) ºÍ SQL ×ÊÔ´¹ÜÀíÔ± 
(SQL Resource Manager) Ö®¼äÓ¦ÓÃ³ÌÊ½½éÃæ (API) Ìá¹©±ê×¼¡£Ëü»á¸ù¾Ý ISO/IEC 
10026 µÄÄÚÈÝ£¬¡°·ÖÉ¢½»Ò×´¦Àí (Distributed Transaction Processing£©¡±
±ê×¼»¯º¯Êýºô½Ð£¬SQL ×ÊÔ´¹ÜÀíÔ±»áÓÃÒÔÖ§Ô®·Ö¶þ½×¶ÎµÄÈ·¶¨ (two-phase 
commit)¡£»ù´¡µÄÎÄ¼þÊÇ×Ô¾­ X/Open Åú×¼¶øÀ´×ÔÒ»·Ý X/Open ³ö°æÎï£¬ËüÇå³þµÄÖ¸Ã÷ 
xa\_close, xa\_commit, xa\_complete, xa\_end, xa\_forget, xa\_open, xa\_prepare, 
xa\_recover, xa\_rollback ºÍ xa\_start µÈ¶à¸öº¯Êý£¬ÒÔ SQL 
×ÊÁÏÐÍÌ¬µÄÊäÈëºÍÊä³ö²ÎÊýµÄÓï·¨¡£

ISO Ä¿Ç°Õý³¢ÊÔ¾¡¿ì×·ÉÏ (fast-tract) X/Open XA ¹æ¸ñ¡£
Õâ¸ö¹ý³ÌÔ­·â²»¶¯²ÉÓÃÒ»¸öÄ¿Ç°µÄÒµ½ç¹æ¸ñ¡£ÒÔ ISO SC21£¬JTC 1 µÈ¼¶µÄ XA 
¾¡¿ì×·ÉÏÍ¶Æ±ÔÚÒ»¾Å¾ÅÎåÄêËÄÔÂ¶þÊ®ÆßÈÕ¿ªÊ¼£¬Ò»¾Å¾ÅÎåÄêÊ®ÔÂ¶þÊ®ÆßÈÕ½áÊø¡£Èç¹û XA 
¹æ¸ñ¾­ 75\% Æ±ÊýºÍ 2/3 µÄ JTC 1 p-members Åú×¼£¬Ëü»á³ÉÎªÒ»¸ö¹ú¼Ê±ê×¼¡£
Èç¹û¾­¾¡¿ì×·ÉÏÍ¶Æ±Åú×¼£¬SQL/XA ¿ÉÔÚ 1996 Äê³ÉÎª±ê×¼¡£


\subsection{µÚÆß²¿·Ö¡õÊ±Ì¬ ISO/ANSI SQL }

Ê±Ì¬ SQL ´¦ÀíºÍÊ±¼äÓÐ¹ØµÄ×ÊÁÏ¡£Æä¸ÅÄîÊÇÔÚ²éÑ¯×ÊÁÏÊ±ÀûÓÃËüÔÚÒ»¸öÌØ¶¨Ê±¼äµÄÇé¿ö¡£
Ê±Ì¬ SQL ÊÇÒ»·ÝÓÉ Rick Snodgrass ÔÚÒ»¾Å¾ÅËÄÄêÊ®¶þÔÂËùÐ´£¬ÃèÊöÕâ¸ÅÄîµÄÎÄ¼þ¡£

X3 Ðû²¼È·ÈÏÒ»¸öÐÂ¼Æ»®£¬ISO/IEC 9075 Part 7:
SQL/Temporal ÊÇÒ»·Ý¹Øì¶ SQL/Temporal µÄÐÂÎÅ¸å
\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------
                                Temporal SQL
                                ************
Rick Snodgrass£¨TSQL2 Î¯Ô±»áÖ÷Ï¯£©
31-Dec-1994
\end{verbatim}
\end{tscreen}

ÓÐÈËÖÊÒÉ¹ý SQL 3 ¶Ô¸½¼ÓÊ±¼äÖ§Ô®µÄÎÊÌâ£¨ÈçÔÚ DBL R10-75 ÌáÒé£¬ÒªÇó SQL 
ÓÐÐÂµÄ²¿·ÖÀ´´¦ÀíÊ±¼äÐÔµÄ×ÊÁÏ¿â£©¡£ÆäÂÛµãÊÇ³éÏó×ÊÁÏÐÎÌ¬ (ADT's) ×ãÒÔÖ§Ô®Ê±Ì¬¡£
ÔÚÕâ×ÊÑ¶ÐÔµÄÏîÄ¿£¬ÎÒÊ¹ÓÃ¾ßÌåÀý×ÓÀ´ÂÛÖ¤ÓµÓÐ³éÏó×ÊÁÏÐÎÌ¬µÄÀ¸Î»²»ÄÜ´¦ÀíÊ±Ì¬²éÑ¯¡£
ÌØ±ðÀ´Ëµ£¬ºÜ¶àÊ±¼äÐÔµÄ²éÑ¯²»ÊÇºÜÄÑÓÃ SQL Ä£Äâ£¬¾ÍÊÇÐèÔÚ¹ý³ÌÓïÑÔÖÐÊ¹ÓÃÇ¶ÈëÊ½ 
SQL¡£ÆäËûÑ¡ÔñÔÚ TSQL2£¬Ò»¸ö¶Ô SQL-92 µÄÊ±Ì¬ÑÓÉìÖÐÌá³öÁË¡£


\subsubsection{µ¼ÑÔ}

ÓÐÐ§Ê±¼ä (Valid-time) µÄÖ§Ô®³¬³öÒ»¸öÊ±Ì¬ ADT µÄÄÜÁ¦¡£Ê¹ÓÃááÕß£¬
Ò»¸öÀ¸Î»±»Ö¸¶¨ÎªÊ±Ì¬ÁìÓò£¬Èç DATE »ò INTERVAL£¨ÉÔáá»áÓÐÀý×Ó£©¡£¼®ÖøÓÐÐ§Ê±¼ä£¬
±í¸ñµÄÃ¿ÐÐËæÖøÊ±¼ä¸Ä±ä£¬ÒòÎªÏÖÊµ¸Ä±äÁË¡£ÁªÏµµ½Ò»¸öÓÐÐ§Ê±¼ä±í¸ñµÄÄ³ÐÐµÄÊ±¼ä´Á¼Ç 
(timestamp)£¬»á±»²éÑ¯ÓïÑÔÀí½âÎª¸ÃÐÐÖÐ¸÷À¸ÊýÖµµÄ×éºÏÓÐÐ§µÄÊ±¼ä¡£
Õâ¸öÎÞÐëÑÔÃ÷µÄÊ±¼ä´Á¼ÇÊ¹µÃ²éÑ¯¿ÉÒÔ¼òµ¥Ò×Ã÷µØ±í´ï³öÀ´¡£


\subsubsection{¸ö°¸ÑÐ¾¿¡õ´¢´æÏÖÊ±×ÊÁÏ}

The University of Arizona µÄ Office of Appointed Personnel 
ÔÚ×ÊÁÏ¿âÖÐÓÐÐ©×ÊÁÏ£¬°üÀ¨¹ÍÔ±Ãû×Ö¡¢Ä¿Ç°Ð½½ðºÍÄ¿Ç°Ö°Î»¡£
ÕâÐ©¿ÉÓÃÒ»¸ö¼òµ¥µÄ±í¸ñ±í´ï³öÀ´¡£
\begin{tscreen}
\begin{verbatim}
        Employee(Name, Salary, Title)
\end{verbatim}
\end{tscreen}

Ê¹ÓÃÕâ¸ö±í¸ñÑ°ÕÒÒ»¸ö¹ÍÔ±µÄÐ½½ðÊ®·Ö¼òµ¥¡£
\begin{tscreen}
\begin{verbatim}
        SELECT Salary
        FROM Employee
        WHERE Name = 'Bob'
\end{verbatim}
\end{tscreen}

ÏÖÔÚ OAP ÏëÔÙ¼ÇÂ¼³öÉúÈÕÆÚ¡£ÎªÐ©£¬ÔÚ±í¸ñÖÐ¼ÓÁËÒ»À¸£¬²úÉúÒÔÏÂ¸ÙÄ¿ (schema)¡Ã
\begin{tscreen}
\begin{verbatim}
        Employee(Name, Salary, Title, DateofBirth DATE)
\end{verbatim}
\end{tscreen}

ÕÒÑ°Ò»Ãû¹ÍÔ±µÄ³öÉúÈÕÆÚ¸öÑ°ÕÒÐ½½ðÀàËÆ¡£
\begin{tscreen}
\begin{verbatim}
        SELECT DateofBirth
        FROM Employee
        WHERE Name = 'Bob'
\end{verbatim}
\end{tscreen}



\subsubsection{¸ö°¸ÑÐ¾¿¡õ´¢´æÀúÊ·×ÊÁÏ}

OAP Ïë°ÑÊÜ¹ÍÀúÊ·µçÄÔ»¯¡£Îª´Ë£¬ËûÃÇ¼ÓÉÏÁ½À¸£¬
Ò»À¸Ö¸³ö±íÊ¾´ËÐÐµÄ×ÊÁÏºÎÊ±¿ªÊ¼ÓÐÐ§£¬ÁíÒ»Ö¸³ö×ÊÁÏºÎÊ±Ê§Ð§¡£

Employee (Name, Salary, Title, DateofBirth, Start DATE, Stop DATE)

ÒÔ×ÊÁÏÄ£ÐÍ (data model) Ëµ£¬ÕâÐ©ÐÂÀ¸Î»ºÍ DateofBirth ºÁÎÞ·Ö±ð¡£²»¹ý£¬
ËüÃÇµÄ´æÔÚ²úÉú¶àÖÖ½á¹û¡£


\subsubsection{¸ö°¸ÑÐ¾¿¡õÍ¶Ó³ (Projection)}

ÒªÕÒ³ö¹ÍÔ±Ä¿Ç°µÄÐ½½ð»á½ÏÎªÀ§ÄÑ¡£
\begin{tscreen}
\begin{verbatim}
        SELECT Salary
        FROM Employee
        WHERE Name = 'Bob' AND Start <= CURRENT_DATE AND CURRENT_DATE <= Stop
\end{verbatim}
\end{tscreen}

Õâ¾ä²éÑ¯±ÈÖ®Ç°µÄ¸´ÔÓ¡£ÔªÐ×ºÜÃ÷ÏÔÊÇÐÂÔöµÄÁ½À¸¡£OAP Ïë·¢³öÐ½½ðÀúÊ·¸ø¸÷Ô±¹¤¡£
ÌØ±ðµØ£¬ÓÐÐèÒªÕÒ³öÃ¿Ò»Ãû¹ÍÔ±ÔÚÊÕÊÜÒ»¸öÐ½³êµÄ×î³¤Ê±¼ä¡£²»ÐÒµØ£¬ÓÃ SQL 
²»ÄÜ×öµ½¡£Ò»Ãû¹ÍÔ±ÔÚÐ½³êµ÷ÕûÆÚ¼äÖ°ÏÎ¿ÉÓÐ¶à´Î±ä¸ü¡£
\begin{tscreen}
\begin{verbatim}
Name    Salary  Title             DateofBirth   Start           Stop
----    ------  -----             -----------   -----           ----
Bob     60000   Assistant Provost 1945-04-09    1993-01-01      1993-05-30
Bob     70000   Assistant Provost 1945-04-09    1993-06-01      1993-09-30
Bob     70000   Provost           1945-04-09    1993-10-01      1994-01-31
Bob     70000   Professor         1945-04-09    1994-02-01      1994-12-31

                               Í¼ 1
\end{verbatim}
\end{tscreen}

Òª×¢ÒâÓÐÈýÐÐ Bob µÄÐ½½ðÍ£ÁôÔÚ \$70,000¡£ËùÒÔ£¬½á¹ûÓ¦¸ÃÊÇ Bob ÓÐÁ½ÐÐ¡£
\begin{tscreen}
\begin{verbatim}
Name    Salary  Start           Stop
----    ------  -----           ----
Bob     60000   1993-01-01      1993-05-30
Bob     70000   1993-06-01      1994-12-31
\end{verbatim}
\end{tscreen}

ÁíÒ»·½·¨ÊÇ°ÑÐ½½ðºÍÖ°¼¶×ÊÁÏÓ¡¸øÓÃÕß£¬¶øÓÉÓÃÕßÕÒ³öËûµÄÐ½³êºÎÊ±±ä¸ü¡£
Õâ·½·¨¼È²»ÎüÒý£¬Òà²»Êµ¼Ê¡£ÁíÒ»·½·¨ÊÇ¾¡Á¿Ê¹ÓÃ SQL¡£
\begin{tscreen}
\begin{verbatim}
CREATE TABLE Temp(Salary, Start, Stop)
AS      SELECT Salary, Start, Stop
        FROM Employee;
\end{verbatim}
\end{tscreen}

repeat
\begin{tscreen}
\begin{verbatim}
        UPDATE Temp T1
        SET (T1.Stop) = (SELECT MAX(T2.Stop)
                         FROM Temp AS T2
                         WHERE T1.Salary = T2.Salary AND T1.Start < T2.Start
                                AND T1.Stop >= T2.Start AND T1.Stop < T2.Stop)
        WHERE EXISTS (SELECT *
                      FROM Temp AS T2
                      WHERE T1.Salary = T2.Salary AND T1.Start < T2.Start
                                AND T1.Stop >= T2.Start AND T1.Stop < T2.Stop)
        until no rows updated;

DELETE FROM Temp T1

WHERE EXISTS (SELECT *
              FROM Temp AS T2
              WHERE T1.Salary = T2.Salary
                        AND ((T1.Start > T2.Start AND T1.Stop <= T2.Stop)
                        OR (T1.Start >= T2.Start AND T1.Stop < T2.Stop))
\end{verbatim}
\end{tscreen}

»ØÈ¦ÖÐÕÒ³öÖØµþ»òÏàÁÚ¶øÐèÒªºÏ²¢µÄÊ±¶Î¡£ÔÚ×î»µµÄÇé¿ö£¬»ØÈ¦»áÖ´ÐÐ log N ´Î£¬N 
Ö¸Ò»Á¬´®ÖØµþ»òÏàÁÚµÄÍ¬Ð½½ð¼ÍÂ¼µÄÊýÁ¿¡£¶ÁÕß¿É×ÔÐÐÄ£Äâ²éÑ¯ÔÚÒÔÉÏÀý×ÓµÄÖ´ÐÐ£¬
ÒÔÑéÖ¤ËüµÄÕýÈ·ÐÔ¡£

µÚÈýÖÖ·½·¨ÊÇÊ¹ÓÃ SQL Îª±í¸ñ¿ªÆôÒ»¸öÓÎ±ê 
(cursor)¡£ÎªÃ¿¸öÐ½½ð¹ÜÀíÒ»¸ö¸÷¶ÎÂäµÄÁ´±í (linked list)¡£ÕâÁ´±í¿ªÊ¼Ê±ÐèÎª¿Õ°×¡£
\begin{tscreen}
\begin{verbatim}
DECLARE emp_cursor CURSOR FOR
        SELECT Salary, Title, Start, Stop
        FROM Employee;
OPEN emp_cursor;
loop:
        FETCH emp_cursor INTO :salary, :start, :stop;
        if no-data returned then goto finished;
        find position in linked list to insert this information;
        goto loop;
finished:
CLOSE emp_cursor;
\end{verbatim}
\end{tscreen}

ÖØ¸²ÖÁÁ´±í½áÊø£¬Ó¡³öÈÕÆÚºÍÐ½½ð¡£

Èç¹ûÓÎ±êÊÇ ORDER BY Start£¬Á´±í²¢·Ç±ØÒª¡£

ÎÞÂÛÈçºÎ£¬Ò»¾ä¼òµ¥µÄ²éÑ¯ÊÇ²»Ò×ÓÃ SQL-92 µÄ¹¦ÄÜ±í´ï³öÕâÄ¿µÄ¡£Ê¹ÓÃ TSQL2 
µÄ»°Õâ²éÑ¯»áºÜ¼òµ¥¡£
\begin{tscreen}
\begin{verbatim}
        SELECT Salary
        FROM Employee
\end{verbatim}
\end{tscreen}



\subsubsection{°¸ÀýÑÐ¾¿¡õÁ¬½á (JOIN)}

Ò»¸ö¸ü¼¤½øµÄ·½·¨ÊÇ°Ñ¸ÙÄ¿ÖØÕû£¬°ÑÐ½½ð¡¢Ö°¼¶¡¢³öÉúÈÕÆÚ×ÊÁÏ·Ö¿ª£¬
´Ó¶ø±Ü¿ª³éÈ¡Ð½³êÀúÊ·Ê±Óöµ½µÄÎÊÌâ¡££¨Îª·½±ã¼Æ£¬ÎÒÃÇÒÔááµÄÌÖÂÛÖÐ²»ÔÙ¿¼ÂÇ³öÉúÈÕÆÚ¡££©
\begin{tscreen}
\begin{verbatim}
        Employee1 (Name, Salary, Start DATE, Stop DATE)
        Employee2 (Name, Title, Start DATE, Stop DATE)
\end{verbatim}
\end{tscreen}

Employee1 ±í¸ñÈçÏÂ¡Ã
\begin{tscreen}
\begin{verbatim}
Name    Salary  Start           Stop
----    ------  -----           ----
Bob     60000   1993-01-01      1993-05-30
Bob     70000   1993-06-01      1993-12-31
\end{verbatim}
\end{tscreen}

ÕâÊÇ Employee2 ±í¸ñ¡£
\begin{tscreen}
\begin{verbatim}
Name    Title                   Start           Stop
----    ------                  -----           ----
Bob     Assistant Provost       1993-01-01      1993-09-30
Bob     Provost                 1993-10-01      1994-01-31
Bob     Professor               1994-02-01      1994-12-31
\end{verbatim}
\end{tscreen}


¸Ä±äÖ®áá£¬È¡µÃ¹ÍÔ±Ð½½ð×ÊÁÏ±äµÃ¼òµ¥¡£
\begin{tscreen}
\begin{verbatim}
        SELECT Salary, Start, Stop
        FROM Employee1
        WHERE Name = 'Bob'
\end{verbatim}
\end{tscreen}

µ«Èç¹û OAP ÏëÒ»¸ö±í¸ñÖÐ°üÀ¨Ð½½ð¡¢Ö°Î»µÄÊ±¶Î£¨¼´ OAP ÏëÒ»¸öÏñÍ¼ 1 
ÐÎÊ½µÄ±í¸ñ£©£¿Ò»¸ö·½·¨ÊÇÓ¡³öÁ½¸ö±í¸ñ£¬¶øÈÃÓÃÕßÕÒ³öÓÐ¹Ø×éºÏ¡£ÁíÒ»·½·¨ÊÇÍêÈ«Ê¹ÓÃ 
SQL¡£²»ÐÒµØ£¬Õâ²éÑ¯Òª·ÖÎö Employee1 Ã¿ÐÐºÍ Employee2 
µÄÖØµþÇé¿ö£¬ÓÐËÄÖÖ¿ÉÄÜ³öÏÖ¡£
\begin{tscreen}
\begin{verbatim}
SELECT Employee1.Name, Salary, Dept, Employee1.Start, Employee1.Stop
FROM Employee1, Employee2
WHERE Employee1.Name = Employee2.Name
     AND Employee2.Start <= Employee1.Start AND Employee1.Stop < Employee2.Stop
UNION
SELECT Employee1.Name, Salary, Dept, Employee1.Start, Employee2.Stop
FROM Employee1, Employee2
WHERE Employee1.Name = Employee2.Name
     AND Employee1.Start >= Employee2.Start AND Employee2.Stop < Employee1.Stop
        AND Employee1.Start < Employee2.Stop
UNION
SELECT Employee1.Name, Salary, Dept, Employee2.Start, Employee1.Stop
FROM Employee1, Employee2
WHERE Employee1.Name = Employee2.Name
     AND Employee2.Start > Employee1.Start AND Employee1.Stop < Employee2.Stop
        AND Employee2.Start < Employee1.Stop
UNION
SELECT Employee1.Name, Salary, Dept, Employee2.Start, Employee2.Stop
FROM Employee1, Employee2
WHERE Employee1.Name = Employee2.Name
     AND Employee2.Start > Employee1.Start AND Employee2.Stop < Employee1.Stop
\end{verbatim}
\end{tscreen}

ÕýÈ·ÕÒ³öËùÓÐÇéÐÎÊÇÒ»¼þ¾ßÌôÕ½ÐÔµÄ¹¤×÷¡£Ê¹ÓÃ 
TSQL2£¬½øÐÐÒ»¸ö¾ßÊ±Ì¬µÄÁ¬½á¾ÍÈçÈËÃÇËùÆÚÍû¡£
\begin{tscreen}
\begin{verbatim}
        SELECT Employee1.Name, Salary, Dept
        FROM Employee1, Employee2
        WHERE Employee1.Name = Employee2.Name
\end{verbatim}
\end{tscreen}



\subsubsection{¸ö°¸ÑÐ¾¿¡õ¾Û¼¯ (AGGREGATES)}

ÏÖÔÚ OAP ±»ÎÊ¼°×î¸ßÐ½³êÊÇÊ²÷á£¿¼ÓÉÏÊ±¼äÇ°£¬ÕâºÜ¼òµ¥¡£
\begin{tscreen}
\begin{verbatim}
        SELECT MAX(Salary)
        FROM Employee
\end{verbatim}
\end{tscreen}

ÏÖÔÚ¼ÓÉÏÁËÐ½½ðÀúÊ·£¬ÎÒÃÇÒªÕÒ³ö²»Í¬Ê±¼ä×î¸ßÐ½½ðµÄÀúÊ·¡£ÎÊÌâµ±È»ÊÇ SQL 
²¢²»Ìá¹©¾ßÊ±Ì¬µÄ¾Û¼¯¡£¼òµ¥µÄ·½·¨ÊÇÓ¡³öÓÐ¹Ø×ÊÁÏ£¬ÓÃÈËÊÖÕÒ³ö×î´óÖµ¡£
ÁíÒ»¸ö·½·¨ÊÇÈ¡ÇÉ£¬°ÑÒ»¸öµ±Ê±µÄ (snapshot) ¾Û¼¯²éÑ¯×ª»¯Îª²»Ê¹ÓÃ¾Û¼¯µÄ²éÑ¯£¬
ÔÙ×ª»¯ÎªÊ±Ì¬¾Û¼¯¡£ÄÇ¸ö²»Ê¹ÓÃ¾Û¼¯µÄ²éÑ¯ÓÃì¶ÕÒ³ö²»´óì¶Ëü±¾ÉíÊýÖµµÄÐ½½ð¡£
\begin{tscreen}
\begin{verbatim}
        SELECT Salary
        FROM Employee AS E1
        WHERE NOT EXISTS (SELECT *
                          FROM Employee AS E2
                          WHERE E2.Salary > E1.Salary)
\end{verbatim}
\end{tscreen}

°ÑÕâ¸ö²éÑ¯±äÎªÊ±Ì¬²éÑ¯²¢²»ÏÔÇ³¡£ÒÔÏÂÊÇÒ»ÖÖ·½·¨¡£
\begin{tscreen}
\begin{verbatim}
CREATE TABLE Temp (Salary, Start, Stop)
AS      SELECT Salary, Start, Stop
        FROM Employee;
INSERT INTO Temp
        SELECT T.Salary, T.Start, E.Start
        FROM Temp AS T, Employee AS E
        WHERE E.Start >= T.Start AND E.Start < T.Stop AND E.Salary > T.Salary;

INSERT INTO Temp
        SELECT T.Salary, T.Stop, E.Stop
        FROM Temp AS T, Employee AS E
        WHERE E.Stop > T.Start AND E.Stop <= T.Stop AND E.Salary > T.Salary;
DELETE FROM Temp T
WHERE EXISTS (SELECT *
              FROM Employee AS E
              WHERE ((T.Start => E.Start AND T.Start < E.Stop)
                        OR (E.Start >= T.Start AND E.Start < T.Stop))
                    AND E.Salary > T.Salary;
\end{verbatim}
\end{tscreen}

Õâ·½·¨½¨Á¢¸¨Öú±í¸ñ¡£ÎÒÃÇÔÚÕâ¸ö±í¸ñÖÐ¼ÓÉÏÁ½¸öÊ±¶ÎÖÐÖØµþ²¿·ÖµÄÉÏ¡¢ÏÂ²¿·Ö¡£
Ö®ááÎÒÃÇ°ÑËùÓÐ×Ó²éÑ¯ÖÐÕÒ³öµÄ¼ÍÂ¼É¾³ý£¬Òò´ËÓ°Ïìµ½ NOT 
EXISTS¡£×îááÎÒÃÇ´Ó¸¨Öú±í¸ñÖÐÕÒ³ö×î³¤µÄÊ±¶Î£¬ÏñÖ®Ç°ÎÒÃÇÕÒ³öÐ½½ð×ÊÑ¶°ã¡£
Èç´ó¼ÒËùÁÏ£¬ÕâÑùµÄ SQL ¾ä×ÓÖ´ÐÐÊ±Ð§ÂÊ·Ç³£µÍ£¬ÒòÎªÄÇÐ©¸´ÔÓµÄ³²×´²»µÈ²éÑ¯¡£

µÚÈý¸ö·½·¨ÊÇ¾¡Á¿ÉÙÓÃ SQL£¬¶øÔÚÖ÷»úÉÏËùÓÃµÄÓïÑÔÖÐÓÃÓÎ±êÕÒ³ö×î³¤µÄÀúÊ·¡£

Ê¹ÓÃ TSQL2 ÔÙ´Î¼òµ¥Ö±½Ó¡£
\begin{tscreen}
\begin{verbatim}
        SELECT MAX(Salary)
        FROM Employee
\end{verbatim}
\end{tscreen}



\subsubsection{ÕªÒª}

´ó²¿·Ö×ÊÁÏ¿âÓ¦ÓÃ³ÌÊ½¶¼ÐèÒª´¦ÀíËæÊ±¼ä¸Ä±äµÄ×ÊÁÏ¡£ÓÐÐ§Ê±¼äÔÚ SQL 
²¢²»Ö§Ô®¡£ºÜ¶àÊ±Ì¬²éÑ¯²»ÊÇºÜÄÑÒÔ SQL Ä£Äâ£¬¾ÍÊÇÐèÒª°Ñ SQL 
Ç¶Èëµ½³ÌÐòÓïÑÔÖÐ£¬ÒòÎª SQL ÔÚ×ÊÁÏÄ£ÐÍºÍ²éÑ¯ÓïÑÔ½á¹¹ÖÐÈ±·¦¶ÔÓÐÐ§Ê±¼äµÄÖ§Ô®¡£

ÁíÒ»·½Ãæ£¬ÎÒÃÇÊ¾¡õ³ö¼ÓÉÏÓÐÐ§Ê±¼äÖ§Ô®ÐèÒª¶Ô DBMS Ê©ÐÐ×÷³öÒ»Ð©¸Ä±ä£¬
µ«ÄÜÏ·¾çÐÔµØ¼ò»¯Ò»Ð©²éÑ¯£¬²¢Ê¹ÆäËû²éÑ¯±äµÃÓÐ¿ÉÄÜ¡£½«À´Ò²¿Éì¶´¢´æ½á¹¹¡¢
Ë÷Òý·½·¨µÄ×î¼Ñ»¯ (optimization)¡£¶ø×î¼Ñ»¯µÄ²ßÂÔ¿Éµ¼ÖÂ±íÏÖ´ó·ùÌáÉý¡£

ËæÖø SQL3 µÄÒ»¸öÐÂ²¿·ÖÖ§Ô®ËæÊ±¼ä¸Ä±äµÄ×ÊÁÏ£¬ÎÒÃÇ¿ÉÒÔ¿ª¡õ´¦ÀíÕâÀàÓ¦ÓÃ£¬¸ÄÁ¼ 
SQL3 ´¦ÀíÊ±Ì¬×ÊÁÏµÄÄÜÁ¦¡£
\begin{tscreen}
\begin{verbatim}
----------------------------------------------------------------------------
           Accredited Standards Committee* X3, Information Technology
NEWS RELEASE

ÎÄ¼þ±àºÅ¡Ã       PR/96-0002

»Ø¸²¡Ã       Barbara Bennett at bbennett@itic.nw.dc.us

             X3 Ðû²¼ÈÏ¿ÉÒ»¸öÕâ×¨°¸, ISO/IEC 9075 Part 7:  SQL/Temporal

Washington D.C., 1996 ÄêÒ»ÔÂ
----------------------------------------------------------------------------
\end{verbatim}
\end{tscreen}

-- Accredited Standards Committee X3, Information Technology Ðû²¼ÈÏ¿ÉÒ»¸öÓÐ¹Ø 
SQL/Temporal Ö§Ô®µÄÐÂ×¨°¸£¬ISO/IEC 9075 Part 7£¬²¢°ÑÓÐ¹Ø¹¤×÷½»Óè Technical 
Committee X3H2, Database¡£Õâ¸ö½¨ÒéÖÐµÄ±ê×¼¶©Ã÷½«³öÏÖµÄ SQL3 
±ê×¼µÄÒ»¸öÐÂ²¿·Ö£¬ÈçµÚÆß²¿·Ö Temporal SQL Îª SQL µÄÒ»¸öÑÓÉì£¬ÔÚ SQL 
×ÊÁÏ¿â»·¾³Ö§Ô®´æÈ¡ºÍ´¦Àí¾ßÊ±Ì¬µÄ×ÊÁÏ¡£ÏÂ´Î X3H2 
»áÒé¶¨ì¶Ò»¾Å¾ÅÁùÄêÈýÔÂÊ®Ò»ÖÁÊ®ËÄÈÕÔÚ¿°ÈøË¹ (Kansas) ¾ÙÐÐ¡£

ÈçÓÐ²éÑ¯£¬¿ÉÓÊ¼ÄÍù¡Ã
\begin{tscreen}
\begin{verbatim}
        Chairman of X3H2,
        Dr. Donald R. Deutsch,
        Sybase, Inc., Suite 800,
        6550 Rock Spring
        Drive, Bethesda, MD  20817.
        Email: deutsch@sybase.com.
\end{verbatim}
\end{tscreen}

ÏÖÕýÑ°Çó¿ÉÄÜµÄ×¨ÀûºÍÆäËûÇ¡µ±µÄÊÂÏî£¨°æÈ¨¡¢ÉÌ±ê£©¡£Õâ°ÑÓÐ¹Ø×ÊÁÏ¼Ä½»¡Ã
\begin{tscreen}
\begin{verbatim}
        X3 Secretariat at
        1250 Eye Street
        NW, Suite 200,
        Washington DC  20005.
        Email: x3sec@itic.nw.dc.us
        FAX:  (202)638-4922.
\end{verbatim}
\end{tscreen}



\subsection{µÚ°Ë²¿·Ö¡õISO/ANSI SQL ¶àÃ½Ìå (SQL/MM)}

Ò»¸öÎª½¨Á¢ÓÃì¶¶àÃ½ÌåÓ¦ÓÃ³ÌÊ½µÄ SQL Îï¼þº¯Ê½¿âµÄÐÂ ISO/IEC 
¹ú¼Ê±ê×¼»¯¼Æ»®ÔÚÒ»¾Å¾ÅÈýÄê³õÆÚ»ñÅú×¼½øÐÐ¡£Õâ¸öÐÂ±ê×¼»¯ÐÐ¶¯ÃûÎª SQL Multimedia 
(SQL/MM)£¬Ëü»áÓÃ²ÝÄâÖÐµÄ SQL3 ¹æ¸ñÖÐµÄ³éÏó×ÊÁÏÐÍÌ¬£¨ADT£©¹æ¸ñºÍÄ¿±êÖ¸¶¨ SQL 
ADT ¶¨ÒåÌ×¼þ¡£

SQL/MM Ä¿±êÎª±ê×¼»¯¿ÆÑ§ºÍ¹¤³Ì¡¢È«ÎÄºÍÎÄ¼þ´¦Àí¡¢¹ÜÀí¶àÃ½ÌåÎï¼þ£¬ÈçÓ°Ïñ¡¢ÉùÒô¡¢
¶¯»­¡¢ÒôÀÖºÍÂ¼ÏñµÄÎï¼þº¯Êý¿â¡£Ëü¶àÊý»áÌá³öÒ»ÖÖÓÃì¶ÆäËû JTC1 
±ê×¼×éÖ¯£¨ÈçÓÐ¹ØÎÄ¼þµÄ SC18¡¢Ó°ÏñµÄ SC24¡¢ÕÕÆ¬ºÍ¶¯×÷Í¼ÏñµÄ SC29£©¶¨ÒåµÄÎï¼þµÄ 
SQL ÓïÑÔ½áºÏ (binding)¡£

SQL/MM µÄ×¨°¸¼Æ»®Ö¸³öËü»á³ÉÎªÒ»·Ý¶à²¿·Ö±ê×¼£¬°üº¬²»¶¨ÊýÁ¿µÄ²¿·Ö¡£
µÚÒ»²¿·Ö»áÊÇÆäËû²¿·ÖÈçºÎ½¨³ÉµÄ¿ò¼Ü¡£ÆäËûÃ¿¸ö²¿·Ö»á×¨×¢ì¶Ò»¸öÌØ¶¨µÄ SQL 
Ó¦ÓÃ³ÌÊ½Ì×¼þ¡£ÒÔÏÂÎªÒ»¾Å¾ÅËÄÄê°ËÔÂ´æÔÚµÄ SQL/MM ²¿·Ö¡Ã

\begin{itemize}
\item    Part 1: Framework A non-technical description of how the document is
structured.
\item    Part 2: Full Text Methods and ADTs for text data processing. About 45
pages.
\item    Part 3: Spatial Methods and ADTs for spatial data management. About 200
pages with active contributions from Spatial Data experts from 3
national bodies.
\item    Part 4: General Purpose Methods and ADTs for complex numbers,
Facilities include trig and exponential functions, vectors, sets, etc.
Currently about 90 pages.
\end{itemize}


ÓÐ¶à¸öÓÐ¹Ø¿Õ¼äºÍµØÀí×ÊÁÏµÄ±ê×¼»¯µÄ¹¤×÷ÔÚ½øÐÐÖÐ¡Ã

\begin{itemize}
\item    ANSI X3L1 - Geographic Information Systems.
Unisys µÄ Mark Ashworth of Unisys ÊÇ X3L1 ºÍ ANSI X3H2 ¼äµÄÁªÂçÈË¡£
ËûÒ²ÊÇ SQL/MM ²Ý¸åµÚÒ»¡¢ÈýºÍËÄ²¿·ÖµÄ±à¼­¡£
\item    ISO TC 211 - Geographic information/Geomatics
\end{itemize}



\section{PostgreSQL µÄ¼¼ÊõÖ§Ô®}

Èç¹ûÄãÓÐÈÎºÎ¼¼ÊõÉÏµÄÎÊÌâÊ½Óöµ½À§ÄÑ£¬Äã¿ÉµçÓÊÖÁ¡Ã
\begin{itemize}
\item   \onlynameurl{pgsql-questions@postgresql.org}
\item  ÐÂÎÅ×é \nameurl{comp.databases.postgresql.general}{}
\item  ÐÂÎÅ×é \nameurl{comp.databases.postgresql.hackers}{}
\item  ÐÂÎÅ×é \nameurl{comp.databases.postgresql.doc}{}
\item  ÐÂÎÅ×é \nameurl{comp.databases.postgresql.bugs}{}
\item  ÐÂÎÅ×é \nameurl{linux.postgres}{}
\item  ÆäËûÍ¨ÐÅÂÛÌ³ \nameurl{http://www.postgresql.org}{}
\end{itemize}

¼°Ô¤ÆÚÔÚÒ»ÈÕÄÚÊÕµ½»Ø¸²¡£ÒòÎª»¥ÁªÍø²úÆ·µÄÓÃ»§¡õÎ§ºÜ¹ã£¬ÓÃ»§ÓÖ»¥Ïà°ïÖú£¬
»¥ÁªÍø¿ÉÇáÒ×ÎªÊýÒÔ°ÙÍò¼ÆÓÃ»§Ìá¹©¼¼ÊõÖ§Ô®¡£µçÓÊÖ§Ô®±Èµç»°Ö§Ô®·½±ãµÃ¶à£¬
ÒòÎªÄã¿É¼ôÏÂºÍÌùÉÏ´íÎóÑ¶Ï¢¡¢³ÌÊ½Êä³öµÈµÈ£¬ÓÖ¿ÉÇáÒ×´«ËÍµ½Í¨ÐÅÂÛÌ³ / ÐÂÎÅ×é¡£




\subsection{ÉÌÒµÖ§Ô®}



PostgreSQL ×éÖ¯Ò²»áÏò¹«Ë¾³öÊÛ¼¼ÊõÖ§Ô®£¬ËùµÃÊÕÒæ»áÓÃì¶Î¬»¤ÊÀ½ç¸÷µØµÄ¶à¸öÓ³ÉäÕ¾Ì¨
£¨ÍòÎ¬ÍøºÍ ftp£©¡£Ò²»áÓÃÀ´Ó¡ÖÆÎÄ¼þ¡¢Ö¸ÒýºÍÊé¼®ÒÔ°ïÖú¹Ë¿Í¡£ËûÃÇµÄÍøÖ·Îª \nameurl{http://www.postresql.org}{}¡£

ÁíÒ»¼äÃûÎª¡®Great Bridge Corporation¡¯Õý½øÐÐ PostgreSQL
µÄ¿ª·¢¡¢ÏúÊÛºÍÖ§Ô®¡£ËûÃÇµÄÍøÒ³Îª \nameurl{http://www.greatbridge.com}{}¡£ËüÊÇÒ»¼äÓÉ¡®Landmark Communications 
corp¡¯ºÍÆäËûÍ¶×Ê¹«Ë¾ÉèÁ¢µÄ¹«¹²¹«Ë¾£¬×¨ÃÅÏòÊÀ½ç´óÆóÒµ´ó¹«Ë¾ºÍÊÛÂôºÍÖ§Ô® 
PostgreSQL¡£ 

ÄãÒ²¿ÉÔÚ Redhat¡¢Anderson¡¢WGS£¨Work Group Solutions£©µÈ×¨Òµ¹ËÎÊÐÐµÃµ½°ïÖú¡£
Äã¿ÉÕÒËûÃÇ°ïÖú£¬ÒòÎªËûÃÇÓÐºÜºÃµÄ C¡¢C++ ×¨¼Ò£¨ PostgreSQL ÒÔ C Ð´³É£©¡£
\begin{itemize}
\item  Redhat ¹«Ë¾¡õ×ÊÁÏ¿â¹ËÎÊ²¿ \nameurl{http://www.redhat.com}{}
\item  Work Group Solutions \nameurl{http://www.wgs.com}{}
\item  Anderson Consulting \nameurl{http://www.ac.com}{}
\end{itemize}



\section{¾­¼ÃºÍÉÌÒµ·½Ãæ}

ÉÌÒµ×ÊÁÏ¿â½É½»ºÜ¶àË°ÏîÈçÁª°î¡¢ÖÝ¡¢ÏúÊÛ¡¢¹ÍÓÃ¡¢Éç»á±£ÕÏ¡¢Ò½ÁÆ±£ÏÕË°¡¢
Ô±¹¤½¡¿µ±£ÕÏ¡¢ÆäËû¸÷³ÌÔ±¹¤¸£Àû¡¢ÊÐ³¡ÍÆ¹ãºÍ¹ã¸æ·Ñ¡£
ËùÓÐÕâÐ©·ÑÓÃ¶¼²»Ö±½ÓÓÃì¶×ÊÁÏ¿âµÄ¿ª·¢£¬²»ÓÃì¶¸ÄÉÆ×ÊÁÏ¿âµÄÆ·ÖÊºÍ¼¼Êõ¡£
µ±Äã¹ºÂòÒ»¸öÉÌÒµ×ÊÁÏ¿â£¬Ò»²¿·ÖµÄ½ð¶îÀË·Ñì¶Ë°¿î¡¢ÑÐ¾¿¿ª·¢³É±¾µÈµØ·½¡£

¶øÇÒ£¬ÉÌÒµ×ÊÁÏ¿âÐèÖ§¸¶×â½ðºÍ¹ºÂò Unix »úÆ÷£¬·½×°ºÍÎ¬»¤¡£
ËùÓÐÕâÐ©³É±¾¶¼×ª¼Þ¸øÓÃ»§¡£

ºÍÉÌÒµ×ÊÁÏ¿âÏà±È£¬PostgreSQL ÓµÓÐÎÞÐèÖ±½ÓË°ÏîµÄÓÅµã£¬ÒòÎªËüÊÇ»¥ÁªÍøÖÆÔì¡£
Ò»´óÈºÈËÎª PostgreSQL µÄ¿ª·¢×÷³öÒ³Ï×¡£ÀýÈç£¬ÒÔÒ»¸ö¼ÙÉèµÄÀý×Ó£¬
Èç¹ûÔÚÃÀ¹úÓÐÒ»°ÙÍò¼ä¹«Ë¾£¬¶øÃ¿¼ä¶¼¾èÊ®ÃÀÔª£¨¶Ô PostgreSQL 
À´ËµÎï³¬ËùÖµ£©£¬Ã¿¼ä±ãµÃµ½Ò»Ç§ÍòÔª£¡£¡Õâ¾ÍÊÇ»¥ÁªÍøÉÏÈí¼þ¿ª·¢µÄ{\bfseries Ä§Êõ}¡£

Ä¿Ç°£¬PostgreSQL Ô´³ÌÊ½ÓÐ´óÔ¼ 250,000 ÐÐ C¡¢C++ ³ÌÊ½¡£Èç¹ûÃ¿ÐÐ C 
³ÌÊ½ÂëÖµ¶þÃÀÔª£¬½ñÌìÕû¸ö PostgreSQL ±ãÖµÎåÊ®ÍòÃÀÔª£¡

ºÜ¶à¹«Ë¾ÒÑ¿ª·¢´óÁ¿ C¡¢C++ ³ÌÊ½ÒÔ×÷×ÔÓÃ¡£Òò´Ë£¬ÒýÈë PostgreSQL 
Ô´³ÌÊ½ÂëºÍÓë»¥ÁªÍøÉÏÆäËû¹«Ë¾ºÏ×÷»á¶Ô¹«Ë¾´øÀ´´óÁ¿ÀûÒæ£¬½ÚÊ¡Ê±¼äºÍÈËÁ¦¡£


\section{ÆäËû×ÊÁÏ¿âµÄÃûµ¥}

ÒÔÏÂÁÐ³öÆäËû Unix¡¢Linux µÄ SQL ×ÊÁÏ¿â¡£
\begin{itemize}
\item  µãÑ¡¼°µ½´ï Applications-{$>$}databases.
\nameurl{http://www.caldera.com/tech-ref/linuxapps/linapps.html}{}
\item  µãÑ¡¼°µ½´ï Applications-{$>$}databases.
\nameurl{http://www.xnet.com/~blatura/linapps.shtml}{}
\item  ×ÊÁÏ¿â×ÊÔ´ \nameurl{http://linas.org/linux/db.html}{}
ÕâÊÇÓÉ Linas Vepstas Ð´³ÉµÄ¡£
\onlynameurl{linas@fc.net}
\item  ×ÔÓÉ×ÊÁÏ¿âÃûµ¥
\nameurl{http://cuiwww.unige.ch:80/~scg/FreeDB/FreeDB.list.html}{}
\item  Browne µÄ RDBMS Ãûµ¥
\nameurl{http://www.hex.net/~cbbrowne/rdbms.html}{}
ÓÉ Christopher B. Browne Ð´³É¡£
\onlynameurl{cbbrowne@hex.net}
\item  SAL ¹ØÁªÊ½ RDBMS Ãûµ¥
\nameurl{http://SAL.KachinaTech.COM/H/1/}{}
\item  SAL µÄÎï¼þµ¼Ïò DBMS Ãûµ¥
\nameurl{http://SAL.KachinaTech.COM/H/2/}{}
\item  SAL's µÄ¹¤¾ßºÍÆäËû×ÊÁÏ¿âÃûµ¥
\nameurl{http://SAL.KachinaTech.COM/H/3/}{}
\item  ACM SIGMOD ¹«ÖÚ¿ÉÈ¡µÃµÄ×ÊÁÏ¿âÈí¼þË÷Òý
\nameurl{http://bunny.cs.uiuc.edu/sigmod/databaseSoftware/}{}
\end{itemize}



\section{ÍòÎ¬ÍøËÑÑ°ÌáÊ¾}

»¥ÁªÍø·Ç³£¹ãÀ«£¬ÓµÓÐ´óÁ¿Èí¼þºÍÏÂ·½ÓÐÒ»¸ö×ÊÑ¶º£Ñó¡£
ËüÔÚÈ«ÊÀ½çÒÔÃ¿Äê°Ù·ÖÖ®Èý°ÙµÄËÙ¶ÈÔö³¤¡£¾Ý¹À¼Æ£¬È«ÇòÓÐ´óÔ¼Ò»Ç§Íò¸öÍøÕ¾£¡

ÒªËÑÑ°×ÊÁÏ£¬ÄãÐèÒªÑÅ»¢¡¢Íø¾°¡¢Lycos µÈËÑÑ°ÒýÇæ¡£È¥µ½ÑÅ»¢£¬µãÑ¡ 
search¡£Ê¹ÓÃ¹ýÂËÑ¡Ïî (filtering options) À´ÊÕÕ­ÄãµÄËÑÑ°ÒªÇó¡£Ô¤ÉèµÄËÑÑ°¶¯¼þÊÇ
¡°Intelligent search¡±£¬Õâ±È½ÏÒ»°ã»¯¼°ÁÐ³öËùÓÐ¿ÉÄÜÐÔ¡£µãÑ¡¡°Options¡±Ñ¡Ôñ
¡°EXACT phrase¡±ËÑÑ°¡¢¡°AND¡±ËÑÑ°¡¢¡°OR¡±ËÑÑ°µÈµÈ¡£
ÕâÑùÄã¿É¸ü¿ìÕÒµ½ÄãÏëÒªµÄÑ¶Ï¢¡£´ËÍâ£¬ÔÚ search Ä¿Â¼ÏÂ£¬ÓÐ radio buttons 
ÓÃÒÔÑ¡ÔñËÑÑ°ÐÂÎÅ×é¡¢»¥ÁªÍøÕ¾»òÑÅ»¢ÍøÕ¾¡£


\section{½áÂÛ}

ÔÚÑÐ¾¿¹ýËùÓÐ{\bfseries ×ÔÓÉ}ºÍ¿ÉÈ¡µÃÔ´³ÌÊ½ÂëµÄ×ÊÁÏ¿âáá£¬·¢ÏÖµ½Ö»ÓÐ PostgreSQL 
ÊÇÊÀÉÏ×î³ÉÊì¡¢×î¶àÈËÊ¹ÓÃºÍÈ«ÃæµÄ×ÔÓÉ SQL RDMS£¨Îï¼þ¹ØÁªÊ½£©¡£

PostgreSQL ·Ç³£ÎüÒý£¬ÒòÎªÓÐºÜ¶à¹¤×÷ÒÑÍê³É¡£ËüÓÐ ODBC ºÍ JDBC 
Çý¶¯³ÌÊ½£¬¼®ÖøÕâÐ©£¬¿ÉÒÔ±àÐ´¶ÀÁ¢ì¶×ÊÁÏ¿âµÄÓ¦ÓÃ³ÌÊ½¡£ÓÃ ODBC »ò JDBC 
Çý¶¯³ÌÊ½Ð´µÄ PostgreSQL Ó¦ÓÃ³ÌÊ½ºÜÈÝÒ×ÒÆÖ²µ½ÆäËû×ÊÁÏ¿â£¬Èç Oracle¡¢Sybase ºÍ 
Informix£¬·´Ö®ÒàÈ»¡£

Äã¿ÉÄÜ»áÎÊ¡¸ÎªÊ²÷áÓÃ PostgreSQL£¿¡¹´ð°¸ÊÇÒòÎªÓÉÁã¿ªÊ¼£¬
¿ª·¢Ò»¸ö×ÊÁÏ¿âÏûºÄ´óÁ¿Ê±¼ä£¬Ñ¡ÔñÒ»¸öÂú×ãÒÔÏÂÌõ¼þµÄ×ÊÁÏ¿âÏµÍ³ºÏºõ³£Ê¶¡Ã

Ò»¸ö
\begin{itemize}
\item  ¿ÉÈ¡µÃÔ­³ÌÊ½Âë¡õ±ØÐëÊÇ¿ª·Å³ÌÊ½ÂëÏµÍ³
\item  Ã»ÓÐ¸½¼ÓÊÚÈ¨×Ö¾ä (license string)¡¢Ã»ÓÐÓµÓÐÈ¨×Ö¾ä£¨Òë°´¡ÃPostgreSQL ÊÇ 
GPL£¬²¢·ÇÎÞÊÚÈ¨Ð­Òé¡£Èç¹ûÃ»ÓÐÊÚÈ¨×Ö¾ä£¬Ê¹ÓÃËü±ãÎ¥·¨ÁË£¡£©
\item  ¿ÉÔÚ»¥ÁªÍøÉ¢²¼
\item  ÒÑ¿ª·¢¶àÄê
\item  Âú×ã ISO/ANSI SQL 92£¨ºÍ SQL 89£©µÈ±ê×¼
\item  ¿ÉÂú×ãÎ´À´µÄÐèÒª£¬Èç SQL 3£¨SQL 98£©
\item  ÓµÓÐÏÈ½ø¹¦ÄÜ
\end{itemize}

µÄ×ÊÁÏ¿âÏµÍ³£¬¶øÖ»ÓÐ PostgreSQL Âú×ãËùÓÐÕâÐ©Ìõ¼þ£¬ÔÚÕâÇé¿öÏÂÊÇÒ»Ì×ÊÊµ±µÄÈí¼þ¡£
Äã¿ÉÄÜ»áËµ¡®PostgreSQL¡¯ÊÇÒ»¸ö¹ÖÃû¡£µ«ÎÒµÄ¿´·¨ÊÇ¡õÎªºÎ¸ÄÃû£¿ÕâÊÀ½ç»áÓÀÔ¶Ê¹ÓÃ
¡°PostgreSQL¡±£¡£¡


\section{FAQ¡õÓÐ¹Ø PostgreSQL µÄÎÊÌâ}

Çë²ÎÔÄÒ»°ãÐÔ¡¢Linux ºÍ Irix µÄ×îÐÂ°æ FAQ¡Ã
\begin{itemize}
\item  \nameurl{http://www.postgresql.org/docs/faq-english.shtml}{}
\end{itemize}



\section{±¾ÎÄ¼þµÄÆäËû¸ñÊ½}

±¾ÎÄ¼þÒÔÊ®Ò»ÖÖ²»Í¬µÄ¸ñÊ½³ö°æ¡õ¡õDVI¡¢Postscript¡¢LaTeX¡¢LyX¡¢GNU-info¡¢HTML¡¢RTF
£¨Rich Text Format£©¡¢´¿ÎÄ×Ö¡¢Unix man pages ºÍ SGML¡£
\begin{itemize}
\item Äã¿ÉÔÚ \nameurl{ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-formats/}{} 
È¡µÃÒÔ HTML¡¢DVI¡¢Postscript »ò SGML ¸ñÊ½Ð´³ÉµÄµ¥Ò» tar.gz µµ¡£
£¨Òë°´¡Ãsunsite.unc.edu ÔçÒÑ¸ÄÃûÎª metalab.unc.edu¡££©
\item ´¿ÎÄ×ÖµµÔÚ¡Ã\nameurl{ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO}{}
\item ÆäËûÓïÑÔµÄ·­Òë£¬Èç·¨ÎÄ¡¢µÂÎÄ¡¢Î÷°àÑÀÎÄ¡¢ÖÐÎÄ¡¢ÈÕÎÄÎ»ì¶ 
\nameurl{ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO}{}
ÎÒ¶Ô·­Òëµ½ÈÎºÎÆäËûÓïÑÔµÄ°ïÖúÎÞÈÎ»¶Ó­¡£
\end{itemize}


±¾ÎÄ¼þÒÔÒ»¸öÃûÎª¡°SGML-Tools¡±µÄ¹¤¾ßÐ´³É£¬Ëü¿ÉÔÚÒÔÏÂµØ·½ÕÒµ½¡Ã
\nameurl{http://www.sgmltools.org}{}
±àÒë³ÌÊ½ááÄã»áµÃµ½ÀàËÆÒÔÏÂµÄÖ¸Áî¡Ã
\begin{itemize}
\item sgml2html databasehowto.sgml     £¨²úÉú HTML µµ£©
\item sgml2rtf  databasehowto.sgml     £¨²úÉú RTF µµ£©
\item sgml2latex databasehowto.sgml    £¨²úÉú LaTeX µµ£©
\end{itemize}


LaTeX ÎÄ¼þ¿É×ª»»Îª PHP µµ£¬Ö»ÐèÊ¹ÓÃ {\bfseries sgml2latex}£¨ºÍ dvips£©²úÉú
Postscript Êä³ö£¬¼°ÓÃ Acrobat {\bfseries distill}£¨\nameurl{http://www.adobe.com}{}£©´¦Àí¸ÃÊä³ö¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash$ man sgml2latex
bash$ sgml2latex filename.sgml
bash$ man dvips
bash$ dvips -o filename.ps filename.dvi
bash$ distill filename.ps
bash$ man ghostscript
bash$ man ps2pdf
bash$ ps2pdf input.ps output.pdf
bash$ acroread output.pdf &
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}

ÄãÒ²¿ÉÓÃ Ghostscript Ö¸Áî {\bfseries ps2pdf}¡£ps2pdf Ìá¹©ÁË Adobe ºÍ Acrobat
Distiller ²úÆ·µÄ¼¸ºõËùÓÐ¹¦ÄÜ¡ÃËü°Ñ PostScript µµ×ªÎª Portable Document Format
(PDF) µµ¡£{\bfseries ps2pdf} Ê¹ÓÃÁËÒ»¸öÏ¸Ð¡µÄÃüÁî¸å£¨Åú´Îµµ£©£¬ËüÆô¶¯
Ghostscript£¬ÌôÑ¡Ò»¸öÃûÎª {\bfseries pdfwrite} µÄÌØÊâ¡°Êä³öÉè±¸¡±¡£ÒªÊ¹ÓÃ
ps2pdf£¬pdfwrite Éè±¸ÐèÔÚ±àÒë Ghostscript Ê±ÔÚ makefile ÖÐÖ¸¶¨£»ÏêÇéÇë²ÎÔÄ
Ghostscript ±àÒëµÄÎÄ¼þ¡£

±¾ÎÄ¼þÎ»ì¶¡Ã
\begin{itemize}
\item  \nameurl{http://sunsite.unc.edu/LDP/HOWTO/PostgreSQL-HOWTO.html}{}
\end{itemize}


ÄãÒ²¿ÉÔÚÒÔÏÂÓ³ÉäÕ¾Ì¨ÕÒµ½±¾ÎÄ¼þ¡Ã
\begin{itemize}
\item  \nameurl{http://www.caldera.com/LDP/HOWTO/PostgreSQL-HOWTO.html}{}
\item  \nameurl{http://www.WGS.com/LDP/HOWTO/PostgreSQL-HOWTO.html}{}
\item  \nameurl{http://www.cc.gatech.edu/linux/LDP/HOWTO/PostgreSQL-HOWTO.html}{}
\item  \nameurl{http://www.redhat.com/linux-info/ldp/HOWTO/PostgreSQL-HOWTO.html}{}
\item  ÆäËûÔÚÄã¸½½ü£¨ÒÔÍøÂçÎ»Ö·À´Ëµ£©µÄÕ¾Ì¨¿ÉÔÚ \nameurl{http://sunsite.unc.edu/LDP/hmirrors.html}{} ÕÒµ½£¬Ñ¡ÔñÒ»¸öÍøÕ¾ºÍµ½
/LDP/HOWTO/PostgreSQL-HOWTO.html Ä¿Â¼¡£
\end{itemize}

£¨Òë°´¡Ã±¾ÎÄ¼þµÄÖÐÎÄ¡²´óÎåÂë¡³°æ¿ÉÔÚ\nameurl{http://www.linux.org.tw/CLDP/HOWTO/}{} ÕÒµ½¡£¶øÒª²úÉúÖÐÎÄÎÄ¼þ£¬ÄãÐèÒª 
bg5sgmltools£¬¿ÉÔÚ \nameurl{http://www.linux.org.tw/CLDP/}{} ÕÒµ½¡££©

Òª¹Û¿´ dvi ¸ñÊ½µÄÎÄ¼þ£¬Ê¹ÓÃ xdvi ³ÌÊ½¡£ÔÚ Redhat Linux ÖÐ£¬Äã¿ÉÍ¸¹ý 
ControlPanel $|$ Applications $|$ Publishing $|$ TeX °´Å¥ÕÒµ½ tetex-xdvi*.rpm 
Ì×¼þ£¬µ±ÖÐ¼´Îª xdvi ³ÌÊ½¡£

ÒªÔÄ¶Á dvi ÎÄ¼þ£¬Ö´ÐÐÖ¸Áî¡Ã
\begin{tscreen}
\begin{verbatim}
        xdvi -geometry 80x90 howto.dvi
        man xdvi
\end{verbatim}
\end{tscreen}

ºÍÊ¹ÓÃ»¬Êóµ÷ÕûÊÓ´°´óÐ¡¡£ä¯ÀÀÊ±Ê¹ÓÃ¼ýÍ·¼ü¡¢Page Up¡¢Page Down ¼ü£¬ÄãÒ²¿ÉÓÃ
'f', 'd', 'u',  'c', 'l', 'r', 'p', 'n' ×ÖÄ¸À´ÒÆÉÏ¡¢ÒÆÏÂ¡¢ÖÃÖÐ¡¢µ½Ç°ááÒ³µÈµÈ¡£
Òª¹Øµô expert menu£¬°´ 'x'¡£

Äã¿ÉÓÃ³ÌÊ½ 'gv' (ghostview) »ò 'ghostscript' À´ÔÄ¶Á postscript µµ¡£ÔÚ RedHat 
Linux ÖÐ£¬ghostscript ³ÌÊ½ÊÇÔÚ ghostscript*.rpm Ì×¼þ£¬gv ÔòÔÚ gv*.rpm¡£Äã¿ÉÍ¸¹ý
ControlPanel $|$ Applications $|$ Graphics °´Å¥ÕÒµ½ËüÃÇ¡£gv ³ÌÊ½±È ghostscript 
Ò×ÓÃµÃ¶à¡£ghostscript ºÍ gv Ò²¿ÉÔÚÆäËûÆ½Ì¨£¬Èç OS/2¡¢ÊÓ´° 95 ¼° NT 
µÃµ½£¬ÄãÒ²¿ÉÔÚÕâÐ©Æ½Ì¨ÔÄ¶Á±¾ÎÄ¼þ¡£

\begin{itemize}
\item ÔÚ \nameurl{http://www.cs.wisc.edu/~ghost}{} È¡µÃ ghostscript µÄÊÓ´°
95¡¢OS/2 ºÍÆäËû×÷ÒµÏµÍ³µÄ°æ±¾¡£
\end{itemize}


ÒªÔÄ¶Á postscript ÎÄ¼þ£¬Ö´ÐÐÖ¸Áî¡õ
\begin{tscreen}
\begin{verbatim}
                gv howto.ps
                ghostscript howto.ps
\end{verbatim}
\end{tscreen}

{\bfseries ×¢Òâ¡Ã}±¾ÎÄ¼þºÜ³¤£¬Èç¹ûÄãÏëÓ¡³öÕâ postscript µµ£¬´óÔ¼ÐèÒª 113 Ò³¡£
£¨Òë°´¡Ãgv ÊÇ ghostscript µÄÒ»¸öÇ°¶Ë½çÃæ£¬ËùÒÔ¼´Ê¹ÄãÖ»´òËãÓÃ 
gv£¬ÄãÒ²Òª°²×°ááÕß¡£´ËÍâ£¬ÔÚ OS/2 ºÍÊÓ´°ÖÐ²¢Ã»ÓÐ gv£¬Ö»ÓÐ GSView£¬Ò»¸öºÍ gv 
¹¦ÄÜ²î²»¶àµÄ³ÌÊ½¡£ÏêÇéÇë²Î¹Ø \nameurl{http://www.cs.wisc.edu/~ghost}{}¡££©



Äã¿ÉÊ¹ÓÃ Netscape Navigator£¬Microsoft Internet Explorer£¬Redhat Baron Web 
Browser »òÈÎºÎÆäËûµÄÍòÎ¬Íøä¯ÀÀÆ÷À´ÔÄ¶Á HTML ¸ñÊ½µÄÎÄ¼þ¡£

Äã¿ÉÓÃ LyX£¬LaTeX µÄÒ»¸ö X-Window Ç°¶Ë½éÃæÀ´ÔÄ¶Á LaTeX ºÍ LyX µµ¡£




\section{°æÈ¨ºÍÊÚÈ¨}

Copyright Al Dev (Alavoor Vasudevan) 1997-2000.

Copyright policy is GNU/GPL as per LDP (Linux Documentation project).
LDP is a GNU/GPL project.
Additional restrictions are - you must retain the author's name, email address
and this copyright notice on all the copies. If you make any changes 
or additions to this document then you should 
intimate all the authors of this document.

NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event 
shall the author/authors of this document be liable for any 
damages whatsoever (including without limitation,
special, incidental, consequential, or direct/indirect damages for personal
injury, loss of business profits, business
interruption, loss of business information, or any other pecuniary loss)
arising out of the use of this document. 

Author/authors offers no warranties or guarantees on fitness, usability, 
merchantability of this document. Brands, companies and product names 
mentioned in this document are 
trademarks or registered trademarks of their respective holders.
Please refer to individual copyright notices of brands, companies and
products mentioned in this document. It is your responsibility to read and 
understand the copyright notices of the organisations/companies/products/authors
mentioned in this document before using their respective information.


 \appendix 

\section{¸½Â¼¼×¡õANSI/ISO SQL 1992 Óï·¨ \label{Appendix A}}

Õâµµ°¸ÖÐ°üÀ¨ÕâÓïÑÔµÄ BNF ÒÔÉî¶ÈÎªÏÈµÄÊ÷×´Ä£É¨ (depth-first tree 
traversal)£¬´óÔ¼ÔÚ 27-AUG-1992 11:03:41.64 Íê³É¡£Õâ¸öÌØ¶¨°æ±¾ËùÓÃµÄ BNF 
ÊÇÖ»ÓÃ ANSI ºÍ SQL2 µÄ¡£
\begin{tscreen}
\begin{verbatim}


<SQL terminal character> ::=
      <SQL language character>
    | <SQL embedded language character>

<SQL language character> ::=
      <simple Latin letter>
    | <digit>
    | <SQL special character>

<simple Latin letter> ::=
      <simple Latin upper case letter>
    | <simple Latin lower case letter>

<simple Latin upper case letter> ::=
          A | B | C | D | E | F | G | H | I | J | K | L | M | N | O
    | P | Q | R | S | T | U | V | W | X | Y | Z

<simple Latin lower case letter> ::=
          a | b | c | d | e | f | g | h | i | j | k | l | m | n | o
    | p | q | r | s | t | u | v | w | x | y | z

<digit> ::=
    0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

<SQL special character> ::=
      <space>
    | <double quote>
    | <percent>
    | <ampersand>
    | <quote>
    | <left paren>
    | <right paren>
    | <asterisk>
    | <plus sign>
    | <comma>
    | <minus sign>
    | <period>
    | <solidus>
    | <colon>
    | <semicolon>
    | <less than operator>
    | <equals operator>
    | <greater than operator>
    | <question mark>
    | <underscore>
    | <vertical bar>

<space> ::= !! <EMPHASIS>£¨Ê¹ÓÃÖÐµÄ×Ö¼¯ËùÓÃµÄ¿Õ°××ÖÔª£©

<double quote> ::= "

<percent> ::= %

<ampersand> ::= &

<quote> ::= '

<left paren> ::= (

<right paren> ::= )

<asterisk> ::= *

<plus sign> ::= +

<comma> ::= ,

<minus sign> ::= -

<period> ::= .

<solidus> ::= /

<colon> ::= :

<semicolon> ::= ;

<less than operator> ::= <

<equals operator> ::= =

<greater than operator> ::= >

<question mark> ::= ?

<underscore> ::= _

<vertical bar> ::= |

<SQL embedded language character> ::=
      <left bracket>
    | <right bracket>

<left bracket> ::= [

<right bracket> ::= ]

<token> ::=
      <nondelimiter token>
    | <delimiter token>

<nondelimiter token> ::=
      <regular identifier>
    | <key word>
    | <unsigned numeric literal>
    | <national character string literal>
    | <bit string literal>
    | <hex string literal>

<regular identifier> ::= <identifier body>

<identifier body> ::=
    <identifier start> [ ( <underscore> | <identifier part> )... ]

<identifier start> ::= <EMPHASIS>£¨!! ²Î¿´ÎÄ·¨¹æÔò£©

<identifier part> ::=
      <identifier start>
    | <digit>

<key word> ::=
      <reserved word>
    | <non-reserved word>

<reserved word> ::=
      ABSOLUTE | ACTION | ADD | ALL
    | ALLOCATE | ALTER | AND
    | ANY | ARE
    | AS | ASC
    | ASSERTION | AT
    | AUTHORIZATION | AVG
    | BEGIN | BETWEEN | BIT | BIT_LENGTH
    | BOTH | BY
    | CASCADE | CASCADED | CASE | CAST
    | CATALOG
    | CHAR | CHARACTER | CHAR_LENGTH
    | CHARACTER_LENGTH | CHECK | CLOSE | COALESCE
    | COLLATE | COLLATION
    | COLUMN | COMMIT
    | CONNECT
    | CONNECTION | CONSTRAINT
    | CONSTRAINTS | CONTINUE
    | CONVERT | CORRESPONDING | COUNT | CREATE | CROSS
    | CURRENT
    | CURRENT_DATE | CURRENT_TIME
    | CURRENT_TIMESTAMP | CURRENT_USER | CURSOR
    | DATE | DAY | DEALLOCATE | DEC
    | DECIMAL | DECLARE | DEFAULT | DEFERRABLE
    | DEFERRED | DELETE | DESC | DESCRIBE | DESCRIPTOR
    | DIAGNOSTICS
    | DISCONNECT | DISTINCT | DOMAIN | DOUBLE | DROP
    | ELSE | END | END-EXEC | ESCAPE
    | EXCEPT | EXCEPTION
    | EXEC | EXECUTE | EXISTS
    | EXTERNAL | EXTRACT
    | FALSE | FETCH | FIRST | FLOAT | FOR
    | FOREIGN | FOUND | FROM | FULL
    | GET | GLOBAL | GO | GOTO
    | GRANT | GROUP
    | HAVING | HOUR
    | IDENTITY | IMMEDIATE | IN | INDICATOR
    | INITIALLY | INNER | INPUT
    | INSENSITIVE | INSERT | INT | INTEGER | INTERSECT
    | INTERVAL | INTO | IS
    | ISOLATION
    | JOIN
    | KEY
    | LANGUAGE | LAST | LEADING | LEFT
    | LEVEL | LIKE | LOCAL | LOWER
    | MATCH | MAX | MIN | MINUTE | MODULE
    | MONTH
    | NAMES | NATIONAL | NATURAL | NCHAR | NEXT | NO
    | NOT | NULL
    | NULLIF | NUMERIC
    | OCTET_LENGTH | OF
    | ON | ONLY | OPEN | OPTION | OR
    | ORDER | OUTER
    | OUTPUT | OVERLAPS
    | PAD | PARTIAL | POSITION | PRECISION | PREPARE
    | PRESERVE | PRIMARY
    | PRIOR | PRIVILEGES | PROCEDURE | PUBLIC
    | READ | REAL | REFERENCES | RELATIVE | RESTRICT
    | REVOKE | RIGHT
    | ROLLBACK | ROWS
    | SCHEMA | SCROLL | SECOND | SECTION
    | SELECT
    | SESSION | SESSION_USER | SET
    | SIZE | SMALLINT | SOME | SPACE | SQL | SQLCODE
    | SQLERROR | SQLSTATE
    | SUBSTRING | SUM | SYSTEM_USER
    | TABLE | TEMPORARY
    | THEN | TIME | TIMESTAMP
    | TIMEZONE_HOUR | TIMEZONE_MINUTE
    | TO | TRAILING | TRANSACTION
    | TRANSLATE | TRANSLATION | TRIM | TRUE
    | UNION | UNIQUE | UNKNOWN | UPDATE | UPPER | USAGE
    | USER | USING
    | VALUE | VALUES | VARCHAR | VARYING | VIEW
    | WHEN | WHENEVER | WHERE | WITH | WORK | WRITE
    | YEAR
    | ZONE

<non-reserved word> ::=

      ADA
    | C | CATALOG_NAME
    | CHARACTER_SET_CATALOG | CHARACTER_SET_NAME
    | CHARACTER_SET_SCHEMA | CLASS_ORIGIN | COBOL | COLLATION_CATALOG
    | COLLATION_NAME | COLLATION_SCHEMA | COLUMN_NAME | COMMAND_FUNCTION
    | COMMITTED
    | CONDITION_NUMBER | CONNECTION_NAME | CONSTRAINT_CATALOG | CONSTRAINT_NAME
    | CONSTRAINT_SCHEMA | CURSOR_NAME
    | DATA | DATETIME_INTERVAL_CODE
    | DATETIME_INTERVAL_PRECISION | DYNAMIC_FUNCTION
    | FORTRAN
    | LENGTH
    | MESSAGE_LENGTH | MESSAGE_OCTET_LENGTH | MESSAGE_TEXT | MORE | MUMPS
    | NAME | NULLABLE | NUMBER
    | PASCAL | PLI
    | REPEATABLE | RETURNED_LENGTH | RETURNED_OCTET_LENGTH | RETURNED_SQLSTATE
    | ROW_COUNT
    | SCALE | SCHEMA_NAME | SERIALIZABLE | SERVER_NAME | SUBCLASS_ORIGIN
    | TABLE_NAME | TYPE
    | UNCOMMITTED | UNNAMED

<unsigned numeric literal> ::=
      <exact numeric literal>
    | <approximate numeric literal>

<exact numeric literal> ::=
      <unsigned integer> [ <period> [ <unsigned integer> ] ]
    | <period> <unsigned integer>

<unsigned integer> ::= <digit>...

<approximate numeric literal> ::= <mantissa> E <exponent>

<mantissa> ::= <exact numeric literal>

<exponent> ::= <signed integer>

<signed integer> ::= [ <sign> ] <unsigned integer>

<sign> ::= <plus sign> | <minus sign>

<national character string literal> ::=
    N <quote> [ <character representation>... ] <quote>
      [ ( <separator>... <quote> [ <character representation>... ] <quote> )... ]

<character representation> ::=
      <nonquote character>
    | <quote symbol>

<nonquote character> ::= !! <EMPHASIS>£¨!! ²Î¿´ÎÄ·¨¹æÔò£©
   
<quote symbol> ::= <quote><quote>

<separator> ::= ( <comment> | <space> | <newline> )...

<comment> ::=
    <comment introducer> [ <comment character>... ] <newline>

<comment introducer> ::= <minus sign><minus sign>[<minus sign>...]

<comment character> ::=
      <nonquote character>
    | <quote>

<newline> ::= !! <EMPHASIS>£¨Êµ¼ù·½·¨¶¨ÒåµÄÐÐÄ©Ö¸Ê¾£©


<bit string literal> ::=
    B <quote> [ <bit>... ] <quote>
      [ ( <separator>... <quote> [ <bit>... ] <quote> )... ]

<bit> ::= 0 | 1

<hex string literal> ::=
    X <quote> [ <hexit>... ] <quote>
      [ ( <separator>... <quote> [ <hexit>... ] <quote> )... ]

<hexit> ::= <digit> | A | B | C | D | E | F | a | b | c | d | e | f

<delimiter token> ::=
      <character string literal>
    | <date string>
    | <time string>
    | <timestamp string>
    | <interval string>
    | <delimited identifier>
    | <SQL special character>
    | <not equals operator>
    | <greater than or equals operator>
    | <less than or equals operator>
    | <concatenation operator>
    | <double period>
    | <left bracket>
    | <right bracket>

<character string literal> ::=
    [ <introducer><character set specification> ]
    <quote> [ <character representation>... ] <quote>
      [ ( <separator>... <quote> [ <character representation>... ] <quote> )... ]

<introducer> ::= <underscore>

<character set specification> ::=
      <standard character repertoire name>
    | <implementation-defined character repertoire name>
    | <user-defined character repertoire name>
    | <standard universal character form-of-use name>
    | <implementation-defined universal character form-of-use name>

<standard character repertoire name> ::= <character set name>

<character set name> ::= [ <schema name> <period> ]
      <SQL language identifier>

<schema name> ::=
    [ <catalog name> <period> ] <unqualified schema name>

<catalog name> ::= <identifier>

<identifier> ::=
    [ <introducer><character set specification> ] <actual identifier>

<actual identifier> ::=
      <regular identifier>
    | <delimited identifier>

<delimited identifier> ::=
    <double quote> <delimited identifier body> <double quote>

<delimited identifier body> ::= <delimited identifier part>...

<delimited identifier part> ::=
      <nondoublequote character>
    | <doublequote symbol>

<nondoublequote character> ::= <EMPHASIS>£¨!! ²Î¿´ÎÄ·¨¹æÔò£©

<doublequote symbol> ::= <double quote><double quote>

<unqualified schema name> ::= <identifier>

<SQL language identifier> ::=
    <SQL language identifier start>
       [ ( <underscore> | <SQL language identifier part> )... ]

<SQL language identifier start> ::= <simple Latin letter>

<SQL language identifier part> ::=
      <simple Latin letter>
    | <digit>

<implementation-defined character repertoire name> ::=
    <character set name>

<user-defined character repertoire name> ::= <character set name>

<standard universal character form-of-use name> ::=
    <character set name>

<implementation-defined universal character form-of-use name> ::=
    <character set name>

<date string> ::=
    <quote> <date value> <quote>

<date value> ::=
    <years value> <minus sign> <months value>
        <minus sign> <days value>

<years value> ::= <datetime value>

<datetime value> ::= <unsigned integer>

<months value> ::= <datetime value>

<days value> ::= <datetime value>

<time string> ::=
    <quote> <time value> [ <time zone interval> ] <quote>

<time value> ::=
    <hours value> <colon> <minutes value> <colon> <seconds value>

<hours value> ::= <datetime value>

<minutes value> ::= <datetime value>

<seconds value> ::=
      <seconds integer value> [ <period> [ <seconds fraction> ] ]

<seconds integer value> ::= <unsigned integer>

<seconds fraction> ::= <unsigned integer>

<time zone interval> ::=
    <sign> <hours value> <colon> <minutes value>

<timestamp string> ::=
    <quote> <date value> <space> <time value>
        [ <time zone interval> ] <quote>

<interval string> ::=
    <quote> ( <year-month literal> | <day-time literal> ) <quote>

<year-month literal> ::=
      <years value>
    | [ <years value> <minus sign> ] <months value>

<day-time literal> ::=
      <day-time interval>
    | <time interval>

<day-time interval> ::=
    <days value>
      [ <space> <hours value> [ <colon> <minutes value>
        [ <colon> <seconds value> ] ] ]

<time interval> ::=
      <hours value> [ <colon> <minutes value> [ <colon> <seconds value> ] ]
    | <minutes value> [ <colon> <seconds value> ]
    | <seconds value>

<not equals operator> ::= <>

<greater than or equals operator> ::= >=

<less than or equals operator> ::= <=

<concatenation operator> ::= ||

<double period> ::= ..

<module> ::=
    <module name clause>
    <language clause>
    <module authorization clause>
    [ <temporary table declaration>... ]
    <module contents>...

<module name clause> ::=
    MODULE [ <module name> ]
      [ <module character set specification> ]

<module name> ::= <identifier>

<module character set specification> ::=
    NAMES ARE <character set specification>

<language clause> ::=
    LANGUAGE <language name>

<language name> ::=
    ADA | C | COBOL | FORTRAN | MUMPS | PASCAL | PLI

<module authorization clause> ::=
      SCHEMA <schema name>
    | AUTHORIZATION <module authorization identifier>
    | SCHEMA <schema name>
          AUTHORIZATION <module authorization identifier>

<module authorization identifier> ::=
    <authorization identifier>

<authorization identifier> ::= <identifier>

<temporary table declaration> ::=
    DECLARE LOCAL TEMPORARY TABLE
        <qualified local table name>
      <table element list>
      [ ON COMMIT ( PRESERVE | DELETE ) ROWS ]

<qualified local table name> ::=
    MODULE <period> <local table name>

<local table name> ::= <qualified identifier>

<qualified identifier> ::= <identifier>

<table element list> ::=
      <left paren> <table element> [ ( <comma> <table element> )... ] <right paren>

<table element> ::=
      <column definition>
    | <table constraint definition>

<column definition> ::=
    <column name> ( <data type> | <domain name> )
    [ <default clause> ]
    [ <column constraint definition>... ]
    [ <collate clause> ]

<column name> ::= <identifier>

<data type> ::=
      <character string type>
           [ CHARACTER SET <character set specification> ]
    | <national character string type>
    | <bit string type>
    | <numeric type>
    | <datetime type>
    | <interval type>

<character string type> ::=
      CHARACTER [ <left paren> <length> <right paren> ]
    | CHAR [ <left paren> <length> <right paren> ]
    | CHARACTER VARYING <left paren> <length> <right paren>
    | CHAR VARYING <left paren> <length> <right paren>
    | VARCHAR <left paren> <length> <right paren>

<length> ::= <unsigned integer>

<national character string type> ::=
      NATIONAL CHARACTER [ <left paren> <length> <right paren> ]
    | NATIONAL CHAR [ <left paren> <length> <right paren> ]
    | NCHAR [ <left paren> <length> <right paren> ]
    | NATIONAL CHARACTER VARYING <left paren> <length> <right paren>
    | NATIONAL CHAR VARYING <left paren> <length> <right paren>
    | NCHAR VARYING <left paren> <length> <right paren>

<bit string type> ::=
      BIT [ <left paren> <length> <right paren> ]
    | BIT VARYING <left paren> <length> <right paren>

<numeric type> ::=
      <exact numeric type>
    | <approximate numeric type>

<exact numeric type> ::=
      NUMERIC [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
    | DECIMAL [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
    | DEC [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
    | INTEGER
    | INT
    | SMALLINT

<precision> ::= <unsigned integer>

<scale> ::= <unsigned integer>

<approximate numeric type> ::=
      FLOAT [ <left paren> <precision> <right paren> ]
    | REAL
    | DOUBLE PRECISION

<datetime type> ::=
      DATE
    | TIME [ <left paren> <time precision> <right paren> ]
          [ WITH TIME ZONE ]
    | TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
          [ WITH TIME ZONE ]

<time precision> ::= <time fractional seconds precision>

<time fractional seconds precision> ::= <unsigned integer>

<timestamp precision> ::= <time fractional seconds precision>

<interval type> ::= INTERVAL <interval qualifier>

<interval qualifier> ::=
      <start field> TO <end field>
    | <single datetime field>

<start field> ::=
    <non-second datetime field>
        [ <left paren> <interval leading field precision> <right paren> ]

<non-second datetime field> ::= YEAR | MONTH | DAY | HOUR
    | MINUTE

<interval leading field precision> ::= <unsigned integer>

<end field> ::=
      <non-second datetime field>
    | SECOND [ <left paren> <interval fractional seconds precision> <right paren> ]

<interval fractional seconds precision> ::= <unsigned integer>

<single datetime field> ::=
      <non-second datetime field>
          [ <left paren> <interval leading field precision> <right paren> ]
    | SECOND [ <left paren> <interval leading field precision>
          [ <comma> <interval fractional seconds precision> ] <right paren> ]

<domain name> ::= <qualified name>

<qualified name> ::=
    [ <schema name> <period> ] <qualified identifier>

<default clause> ::=
      DEFAULT <default option>

<default option> ::=
      <literal>
    | <datetime value function>
    | USER
    | CURRENT_USER
    | SESSION_USER
    | SYSTEM_USER
    | NULL

<literal> ::=
      <signed numeric literal>
    | <general literal>

<signed numeric literal> ::=
    [ <sign> ] <unsigned numeric literal>

<general literal> ::=
      <character string literal>
    | <national character string literal>
    | <bit string literal>
    | <hex string literal>
    | <datetime literal>
    | <interval literal>

<datetime literal> ::=
      <date literal>
    | <time literal>
    | <timestamp literal>

<date literal> ::=
    DATE <date string>

<time literal> ::=
    TIME <time string>

<timestamp literal> ::=
    TIMESTAMP <timestamp string>

<interval literal> ::=
    INTERVAL [ <sign> ] <interval string> <interval qualifier>

<datetime value function> ::=
      <current date value function>
    | <current time value function>
    | <current timestamp value function>

<current date value function> ::= CURRENT_DATE

<current time value function> ::=
      CURRENT_TIME [ <left paren> <time precision> <right paren> ]

<current timestamp value function> ::=
      CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]

<column constraint definition> ::=
    [ <constraint name definition> ]
    <column constraint>
      [ <constraint attributes> ]

<constraint name definition> ::= CONSTRAINT <constraint name>

<constraint name> ::= <qualified name>

<column constraint> ::=
      NOT NULL
    | <unique specification>
    | <references specification>
    | <check constraint definition>

<unique specification> ::=
    UNIQUE | PRIMARY KEY

<references specification> ::=
    REFERENCES <referenced table and columns>
      [ MATCH <match type> ]
      [ <referential triggered action> ]

<referenced table and columns> ::=
     <table name> [ <left paren> <reference column list> <right paren> ]

<table name> ::=
      <qualified name>
    | <qualified local table name>

<reference column list> ::= <column name list>

<column name list> ::=
    <column name> [ ( <comma> <column name> )... ]

<match type> ::=
      FULL
    | PARTIAL

<referential triggered action> ::=
      <update rule> [ <delete rule> ]
    | <delete rule> [ <update rule> ]

<update rule> ::= ON UPDATE <referential action>

<referential action> ::=
      CASCADE
    | SET NULL
    | SET DEFAULT
    | NO ACTION

<delete rule> ::= ON DELETE <referential action>

<check constraint definition> ::=
    CHECK
        <left paren> <search condition> <right paren>

<search condition> ::=
      <boolean term>
    | <search condition> OR <boolean term>

<boolean term> ::=
      <boolean factor>
    | <boolean term> AND <boolean factor>

<boolean factor> ::=
    [ NOT ] <boolean test>

<boolean test> ::=
    <boolean primary> [ IS [ NOT ]
          <truth value> ]

<boolean primary> ::=
      <predicate>
    | <left paren> <search condition> <right paren>

<predicate> ::=
      <comparison predicate>
    | <between predicate>
    | <in predicate>
    | <like predicate>
    | <null predicate>
    | <quantified comparison predicate>
    | <exists predicate>
    | <unique predicate>
    | <match predicate>
    | <overlaps predicate>

<comparison predicate> ::=
    <row value constructor> <comp op>
        <row value constructor>

<row value constructor> ::=
       <row value constructor element>
    | <left paren> <row value constructor list> <right paren>
    | <row subquery>

<row value constructor element> ::=
      <value expression>
    | <null specification>
    | <default specification>

<value expression> ::=
      <numeric value expression>
    | <string value expression>
    | <datetime value expression>
    | <interval value expression>

<numeric value expression> ::=
      <term>
    | <numeric value expression> <plus sign> <term>
    | <numeric value expression> <minus sign> <term>

<term> ::=
      <factor>
    | <term> <asterisk> <factor>
    | <term> <solidus> <factor>

<factor> ::=
    [ <sign> ] <numeric primary>

<numeric primary> ::=
      <value expression primary>
    | <numeric value function>

<value expression primary> ::=
      <unsigned value specification>
    | <column reference>
    | <set function specification>
    | <scalar subquery>
    | <case expression>
    | <left paren> <value expression> <right paren>
    | <cast specification>

<unsigned value specification> ::=
      <unsigned literal>
    | <general value specification>

<unsigned literal> ::=
      <unsigned numeric literal>
    | <general literal>

<general value specification> ::=
      <parameter specification>
    | <dynamic parameter specification>
    | <variable specification>
    | USER
    | CURRENT_USER
    | SESSION_USER
    | SYSTEM_USER
    | VALUE

<parameter specification> ::=
    <parameter name> [ <indicator parameter> ]

<parameter name> ::= <colon> <identifier>

<indicator parameter> ::=
    [ INDICATOR ] <parameter name>

<dynamic parameter specification> ::= <question mark>

<variable specification> ::=
    <embedded variable name> [ <indicator variable> ]

<embedded variable name> ::=
    <colon><host identifier>

<host identifier> ::=
      <Ada host identifier>
    | <C host identifier>
    | <COBOL host identifier>
    | <Fortran host identifier>
    | <MUMPS host identifier>
    | <Pascal host identifier>
    | <PL/I host identifier>

<Ada host identifier> ::= !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<C host identifier> ::=
    !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<COBOL host identifier> ::= !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<Fortran host identifier> ::= !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<MUMPS host identifier> ::= !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<Pascal host identifier> ::= !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<PL/I host identifier> ::= !! <EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<indicator variable> ::=
    [ INDICATOR ] <embedded variable name>

<column reference> ::= [ <qualifier> <period> ] <column name>

<qualifier> ::=
      <table name>
    | <correlation name>

<correlation name> ::= <identifier>

<set function specification> ::=
      COUNT <left paren> <asterisk> <right paren>
    | <general set function>

<general set function> ::=
      <set function type>
          <left paren> [ <set quantifier> ] <value expression> <right paren>

<set function type> ::=
    AVG | MAX | MIN | SUM | COUNT

<set quantifier> ::= DISTINCT | ALL

<scalar subquery> ::= <subquery>

<subquery> ::= <left paren> <query expression> <right paren>

<query expression> ::=
      <non-join query expression>
    | <joined table>

<non-join query expression> ::=
      <non-join query term>
    | <query expression> UNION  [ ALL ]
          [ <corresponding spec> ] <query term>
    | <query expression> EXCEPT [ ALL ]
          [ <corresponding spec> ] <query term>

<non-join query term> ::=
      <non-join query primary>
    | <query term> INTERSECT [ ALL ]
          [ <corresponding spec> ] <query primary>

<non-join query primary> ::=
      <simple table>
    | <left paren> <non-join query expression> <right paren>

<simple table> ::=
      <query specification>
    | <table value constructor>
    | <explicit table>

<query specification> ::=
    SELECT [ <set quantifier> ] <select list> <table expression>

<select list> ::=
      <asterisk>
    | <select sublist> [ ( <comma> <select sublist> )... ]

<select sublist> ::=
      <derived column>
    | <qualifier> <period> <asterisk>

<derived column> ::= <value expression> [ <as clause> ]

<as clause> ::= [ AS ] <column name>

<table expression> ::=
    <from clause>
    [ <where clause> ]
    [ <group by clause> ]
    [ <having clause> ]

<from clause> ::= FROM <table reference>
    [ ( <comma> <table reference> )... ]

<table reference> ::=
      <table name> [ [ AS ] <correlation name>
          [ <left paren> <derived column list> <right paren> ] ]
    | <derived table> [ AS ] <correlation name>
          [ <left paren> <derived column list> <right paren> ]
    | <joined table>

<derived column list> ::= <column name list>

<derived table> ::= <table subquery>

<table subquery> ::= <subquery>

<joined table> ::=
      <cross join>
    | <qualified join>
    | <left paren> <joined table> <right paren>

<cross join> ::=
    <table reference> CROSS JOIN <table reference>

<qualified join> ::=
    <table reference> [ NATURAL ] [ <join type> ] JOIN
      <table reference> [ <join specification> ]

<join type> ::=
      INNER
    | <outer join type> [ OUTER ]
    | UNION

<outer join type> ::=
      LEFT
    | RIGHT
    | FULL

<join specification> ::=
      <join condition>
    | <named columns join>

<join condition> ::= ON <search condition>

<named columns join> ::=
    USING <left paren> <join column list> <right paren>

<join column list> ::= <column name list>

<where clause> ::= WHERE <search condition>

<group by clause> ::=
    GROUP BY <grouping column reference list>

<grouping column reference list> ::=
    <grouping column reference>
        [ ( <comma> <grouping column reference> )... ]

<grouping column reference> ::=
    <column reference> [ <collate clause> ]

<collate clause> ::= COLLATE <collation name>

<collation name> ::= <qualified name>

<having clause> ::= HAVING <search condition>

<table value constructor> ::=
    VALUES <table value constructor list>

<table value constructor list> ::=
    <row value constructor> [ ( <comma> <row value constructor> )... ]

<explicit table> ::= TABLE <table name>

<query term> ::=
      <non-join query term>
    | <joined table>

<corresponding spec> ::=
    CORRESPONDING [ BY <left paren> <corresponding column list> <right paren> ]

<corresponding column list> ::= <column name list>

<query primary> ::=
      <non-join query primary>
    | <joined table>

<case expression> ::=
      <case abbreviation>
    | <case specification>

<case abbreviation> ::=
      NULLIF <left paren> <value expression> <comma>
            <value expression> <right paren>
    | COALESCE <left paren> <value expression>
            ( <comma> <value expression> )... <right paren>

<case specification> ::=
      <simple case>
    | <searched case>

<simple case> ::=
    CASE <case operand>
      <simple when clause>...
      [ <else clause> ]
    END

<case operand> ::= <value expression>

<simple when clause> ::= WHEN <when operand> THEN <result>

<when operand> ::= <value expression>

<result> ::= <result expression> | NULL

<result expression> ::= <value expression>

<else clause> ::= ELSE <result>

<searched case> ::=
    CASE
      <searched when clause>...
      [ <else clause> ]
    END

<searched when clause> ::= WHEN <search condition> THEN <result>

<cast specification> ::=
    CAST <left paren> <cast operand> AS
        <cast target> <right paren>

<cast operand> ::=
      <value expression>
    | NULL

<cast target> ::=
      <domain name>
    | <data type>

<numeric value function> ::=
      <position expression>
    | <extract expression>
    | <length expression>

<position expression> ::=
    POSITION <left paren> <character value expression>
        IN <character value expression> <right paren>

<character value expression> ::=
      <concatenation>
    | <character factor>

<concatenation> ::=
    <character value expression> <concatenation operator>
        <character factor>

<character factor> ::=
    <character primary> [ <collate clause> ]

<character primary> ::=
      <value expression primary>
    | <string value function>

<string value function> ::=
      <character value function>
    | <bit value function>

<character value function> ::=
      <character substring function>
    | <fold>
    | <form-of-use conversion>
    | <character translation>
    | <trim function>

<character substring function> ::=
    SUBSTRING <left paren> <character value expression> FROM <start position>
                [ FOR <string length> ] <right paren>

<start position> ::= <numeric value expression>

<string length> ::= <numeric value expression>

<fold> ::= ( UPPER | LOWER )
     <left paren> <character value expression> <right paren>

<form-of-use conversion> ::=
    CONVERT <left paren> <character value expression>
        USING <form-of-use conversion name> <right paren>

<form-of-use conversion name> ::= <qualified name>

<character translation> ::=
    TRANSLATE <left paren> <character value expression>
        USING <translation name> <right paren>

<translation name> ::= <qualified name>

<trim function> ::=
    TRIM <left paren> <trim operands> <right paren>

<trim operands> ::=
    [ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>

<trim specification> ::=
      LEADING
    | TRAILING
    | BOTH

<trim character> ::= <character value expression>

<trim source> ::= <character value expression>

<bit value function> ::=
    <bit substring function>

<bit substring function> ::=
    SUBSTRING <left paren> <bit value expression> FROM <start position>
        [ FOR <string length> ] <right paren>

<bit value expression> ::=
      <bit concatenation>
    | <bit factor>

<bit concatenation> ::=
    <bit value expression> <concatenation operator> <bit factor>

<bit factor> ::= <bit primary>

<bit primary> ::=
      <value expression primary>
    | <string value function>

<extract expression> ::=
    EXTRACT <left paren> <extract field>
        FROM <extract source> <right paren>

<extract field> ::=
      <datetime field>
    | <time zone field>

<datetime field> ::=
      <non-second datetime field>
    | SECOND

<time zone field> ::=
      TIMEZONE_HOUR
    | TIMEZONE_MINUTE

<extract source> ::=
      <datetime value expression>
    | <interval value expression>

<datetime value expression> ::=
      <datetime term>
    | <interval value expression> <plus sign> <datetime term>
    | <datetime value expression> <plus sign> <interval term>
    | <datetime value expression> <minus sign> <interval term>

<interval term> ::=
      <interval factor>
    | <interval term 2> <asterisk> <factor>
    | <interval term 2> <solidus> <factor>
    | <term> <asterisk> <interval factor>

<interval factor> ::=
    [ <sign> ] <interval primary>

<interval primary> ::=
      <value expression primary> [ <interval qualifier> ]

<interval term 2> ::= <interval term>

<interval value expression> ::=
      <interval term>
    | <interval value expression 1> <plus sign> <interval term 1>
    | <interval value expression 1> <minus sign> <interval term 1>
    | <left paren> <datetime value expression> <minus sign>
          <datetime term> <right paren> <interval qualifier>

<interval value expression 1> ::= <interval value expression>

<interval term 1> ::= <interval term>

<datetime term> ::=
      <datetime factor>

<datetime factor> ::=
      <datetime primary> [ <time zone> ]

<datetime primary> ::=
      <value expression primary>
    | <datetime value function>

<time zone> ::=
    AT <time zone specifier>

<time zone specifier> ::=
      LOCAL
    | TIME ZONE <interval value expression>

<length expression> ::=
      <char length expression>
    | <octet length expression>
    | <bit length expression>

<char length expression> ::=
    ( CHAR_LENGTH | CHARACTER_LENGTH )
        <left paren> <string value expression> <right paren>

<string value expression> ::=
      <character value expression>
    | <bit value expression>

<octet length expression> ::=
    OCTET_LENGTH <left paren> <string value expression> <right paren>

<bit length expression> ::=
    BIT_LENGTH <left paren> <string value expression> <right paren>

<null specification> ::=
    NULL

<default specification> ::=
    DEFAULT

<row value constructor list> ::=
    <row value constructor element>
        [ ( <comma> <row value constructor element> )... ]

<row subquery> ::= <subquery>

<comp op> ::=
      <equals operator>
    | <not equals operator>
    | <less than operator>
    | <greater than operator>
    | <less than or equals operator>
    | <greater than or equals operator>

<between predicate> ::=
    <row value constructor> [ NOT ] BETWEEN
      <row value constructor> AND <row value constructor>

<in predicate> ::=
    <row value constructor>
      [ NOT ] IN <in predicate value>

<in predicate value> ::=
      <table subquery>
    | <left paren> <in value list> <right paren>

<in value list> ::=
    <value expression> ( <comma> <value expression> )...

<like predicate> ::=
    <match value> [ NOT ] LIKE <pattern>
      [ ESCAPE <escape character> ]

<match value> ::= <character value expression>

<pattern> ::= <character value expression>

<escape character> ::= <character value expression>

<null predicate> ::= <row value constructor>
    IS [ NOT ] NULL

<quantified comparison predicate> ::=
    <row value constructor> <comp op> <quantifier> <table subquery>

<quantifier> ::= <all> | <some>

<all> ::= ALL

<some> ::= SOME | ANY

<exists predicate> ::= EXISTS <table subquery>

<unique predicate> ::= UNIQUE <table subquery>

<match predicate> ::=
    <row value constructor> MATCH [ UNIQUE ]
        [ PARTIAL | FULL ] <table subquery>

<overlaps predicate> ::=
    <row value constructor 1> OVERLAPS <row value constructor 2>

<row value constructor 1> ::= <row value constructor>

<row value constructor 2> ::= <row value constructor>

<truth value> ::=
      TRUE
    | FALSE
    | UNKNOWN

<constraint attributes> ::=
      <constraint check time> [ [ NOT ] DEFERRABLE ]
    | [ NOT ] DEFERRABLE [ <constraint check time> ]

<constraint check time> ::=
      INITIALLY DEFERRED
    | INITIALLY IMMEDIATE

<table constraint definition> ::=
    [ <constraint name definition> ]
    <table constraint> [ <constraint attributes> ]

<table constraint> ::=
      <unique constraint definition>
    | <referential constraint definition>
    | <check constraint definition>

<unique constraint definition> ::=
            <unique specification> even in SQL3)
    <unique specification>
      <left paren> <unique column list> <right paren>

<unique column list> ::= <column name list>

<referential constraint definition> ::=
    FOREIGN KEY
        <left paren> <referencing columns> <right paren>
      <references specification>

<referencing columns> ::=
    <reference column list>

<module contents> ::=
      <declare cursor>
    | <dynamic declare cursor>
    | <procedure>

<declare cursor> ::=
    DECLARE <cursor name> [ INSENSITIVE ] [ SCROLL ] CURSOR
      FOR <cursor specification>

<cursor name> ::= <identifier>

<cursor specification> ::=
    <query expression> [ <order by clause> ]
      [ <updatability clause> ]

<order by clause> ::=
    ORDER BY <sort specification list>

<sort specification list> ::=
    <sort specification> [ ( <comma> <sort specification> )... ]

<sort specification> ::=
    <sort key> [ <collate clause> ] [ <ordering specification> ]

<sort key> ::=
      <column name>
    | <unsigned integer>

<ordering specification> ::= ASC | DESC

<updatability clause> ::=
    FOR
        ( READ ONLY |
          UPDATE [ OF <column name list> ] )

<dynamic declare cursor> ::=
    DECLARE <cursor name> [ INSENSITIVE ] [ SCROLL ] CURSOR
        FOR <statement name>

<statement name> ::= <identifier>

<procedure> ::=
    PROCEDURE <procedure name>
        <parameter declaration list> <semicolon>
      <SQL procedure statement> <semicolon>

<procedure name> ::= <identifier>

<parameter declaration list> ::=
      <left paren> <parameter declaration>
          [ ( <comma> <parameter declaration> )... ] <right paren>
    | <parameter declaration>...

<parameter declaration> ::=
      <parameter name> <data type>
    | <status parameter>

<status parameter> ::=
    SQLCODE | SQLSTATE

<SQL procedure statement> ::=
      <SQL schema statement>
    | <SQL data statement>
    | <SQL transaction statement>
    | <SQL connection statement>
    | <SQL session statement>
    | <SQL dynamic statement>
    | <SQL diagnostics statement>

<SQL schema statement> ::=
      <SQL schema definition statement>
    | <SQL schema manipulation statement>

<SQL schema definition statement> ::=
      <schema definition>
    | <table definition>
    | <view definition>
    | <grant statement>
    | <domain definition>
    | <character set definition>
    | <collation definition>
    | <translation definition>
    | <assertion definition>

<schema definition> ::=
    CREATE SCHEMA <schema name clause>
      [ <schema character set specification> ]
      [ <schema element>... ]

<schema name clause> ::=
      <schema name>
    | AUTHORIZATION <schema authorization identifier>
    | <schema name> AUTHORIZATION
          <schema authorization identifier>

<schema authorization identifier> ::=
    <authorization identifier>

<schema character set specification> ::=
    DEFAULT CHARACTER
        SET <character set specification>

<schema element> ::=
      <domain definition>
    | <table definition>
    | <view definition>
    | <grant statement>
    | <assertion definition>
    | <character set definition>
    | <collation definition>
    | <translation definition>

<domain definition> ::=
    CREATE DOMAIN <domain name>
        [ AS ] <data type>
      [ <default clause> ]
      [ <domain constraint>... ]
      [ <collate clause> ]

<domain constraint> ::=
    [ <constraint name definition> ]
    <check constraint definition> [ <constraint attributes> ]

<table definition> ::=
    CREATE [ ( GLOBAL | LOCAL ) TEMPORARY ] TABLE
        <table name>
      <table element list>
      [ ON COMMIT ( DELETE | PRESERVE ) ROWS ]

<view definition> ::=
    CREATE VIEW <table name> [ <left paren> <view column list>
                                  <right paren> ]
      AS <query expression>
      [ WITH [ <levels clause> ] CHECK OPTION ]

<view column list> ::= <column name list>

<levels clause> ::=
    CASCADED | LOCAL

<grant statement> ::=
   GRANT <privileges> ON <object name>
     TO <grantee> [ ( <comma> <grantee> )... ]
       [ WITH GRANT OPTION ]

<privileges> ::=
      ALL PRIVILEGES
    | <action list>

<action list> ::= <action> [ ( <comma> <action> )... ]

<action> ::=
      SELECT
    | DELETE
    | INSERT [ <left paren> <privilege column list> <right paren> ]
    | UPDATE [ <left paren> <privilege column list> <right paren> ]
    | REFERENCES [ <left paren> <privilege column list> <right paren> ]
    | USAGE

<privilege column list> ::= <column name list>

<object name> ::=
      [ TABLE ] <table name>
    | DOMAIN <domain name>
    | COLLATION <collation name>
    | CHARACTER SET <character set name>
    | TRANSLATION <translation name>

<grantee> ::=
      PUBLIC
    | <authorization identifier>

<assertion definition> ::=
    CREATE ASSERTION <constraint name> <assertion check>
      [ <constraint attributes> ]

<assertion check> ::=
    CHECK
        <left paren> <search condition> <right paren>

<character set definition> ::=
    CREATE CHARACTER SET <character set name>
        [ AS ]
      <character set source>
      [ <collate clause> | <limited collation definition> ]

<character set source> ::=
      GET <existing character set name>

<existing character set name> ::=
      <standard character repertoire name>
    | <implementation-defined character repertoire name>
    | <schema character set name>

<schema character set name> ::= <character set name>

<limited collation definition> ::=
    COLLATION FROM <collation source>

<collation source> ::=
      <collating sequence definition>
    | <translation collation>

<collating sequence definition> ::=
      <external collation>
    | <schema collation name>
    | DESC <left paren> <collation name> <right paren>
    | DEFAULT

<external collation> ::=
    EXTERNAL <left paren> <quote> <external collation name> <quote> <right paren>

<external collation name> ::=
      <standard collation name>
    | <implementation-defined collation name>

<standard collation name> ::= <collation name>

<implementation-defined collation name> ::= <collation name>

<schema collation name> ::= <collation name>

<translation collation> ::=
    TRANSLATION <translation name>
        [ THEN COLLATION <collation name> ]

<collation definition> ::=
    CREATE COLLATION <collation name> FOR
        <character set specification>
      FROM <collation source>
        [ <pad attribute> ]

<pad attribute> ::=
      NO PAD
    | PAD SPACE

<translation definition> ::=
    CREATE TRANSLATION <translation name>
      FOR <source character set specification>
        TO <target character set specification>
      FROM <translation source>

<source character set specification> ::= <character set specification>

<target character set specification> ::= <character set specification>

<translation source> ::=
      <translation specification>

<translation specification> ::=
      <external translation>
    | IDENTITY
    | <schema translation name>

<external translation> ::=
    EXTERNAL <left paren> <quote> <external translation name> <quote> <right paren>

<external translation name> ::=
      <standard translation name>
    | <implementation-defined translation name>

<standard translation name> ::= <translation name>

<implementation-defined translation name> ::= <translation name>

<schema translation name> ::= <translation name>

<SQL schema manipulation statement> ::=
      <drop schema statement>
    | <alter table statement>
    | <drop table statement>
    | <drop view statement>
    | <revoke statement>
    | <alter domain statement>
    | <drop domain statement>
    | <drop character set statement>
    | <drop collation statement>
    | <drop translation statement>
    | <drop assertion statement>

<drop schema statement> ::=
    DROP SCHEMA <schema name> <drop behavior>

<drop behavior> ::= CASCADE | RESTRICT

<alter table statement> ::=
    ALTER TABLE <table name> <alter table action>

<alter table action> ::=
      <add column definition>
    | <alter column definition>
    | <drop column definition>
    | <add table constraint definition>
    | <drop table constraint definition>

<add column definition> ::=
    ADD [ COLUMN ] <column definition>

<alter column definition> ::=
    ALTER [ COLUMN ] <column name> <alter column action>

<alter column action> ::=
      <set column default clause>
    | <drop column default clause>

<set column default clause> ::=
    SET <default clause>

<drop column default clause> ::=
    DROP DEFAULT

<drop column definition> ::=
    DROP [ COLUMN ] <column name> <drop behavior>

<add table constraint definition> ::=
    ADD <table constraint definition>

<drop table constraint definition> ::=
    DROP CONSTRAINT <constraint name> <drop behavior>

<drop table statement> ::=
    DROP TABLE <table name> <drop behavior>

<drop view statement> ::=
    DROP VIEW <table name> <drop behavior>

<revoke statement> ::=
    REVOKE [ GRANT OPTION FOR ]
        <privileges>
        ON <object name>
      FROM <grantee> [ ( <comma> <grantee> )... ] <drop behavior>

<alter domain statement> ::=
    ALTER DOMAIN <domain name> <alter domain action>

<alter domain action> ::=
      <set domain default clause>
    | <drop domain default clause>
    | <add domain constraint definition>
    | <drop domain constraint definition>

<set domain default clause> ::= SET <default clause>

<drop domain default clause> ::= DROP DEFAULT

<add domain constraint definition> ::=
    ADD <domain constraint>

<drop domain constraint definition> ::=
    DROP CONSTRAINT <constraint name>

<drop domain statement> ::=
    DROP DOMAIN <domain name> <drop behavior>

<drop character set statement> ::=
    DROP CHARACTER SET <character set name>

<drop collation statement> ::=
    DROP COLLATION <collation name>

<drop translation statement> ::=
    DROP TRANSLATION <translation name>

<drop assertion statement> ::=
    DROP ASSERTION <constraint name>

<SQL data statement> ::=
      <open statement>
    | <fetch statement>
    | <close statement>
    | <select statement: single row>
    | <SQL data change statement>

<open statement> ::=
    OPEN <cursor name>

<fetch statement> ::=
    FETCH [ [ <fetch orientation> ] FROM ]
      <cursor name> INTO <fetch target list>

<fetch orientation> ::=
      NEXT
    | PRIOR
    | FIRST
    | LAST
    | ( ABSOLUTE | RELATIVE ) <simple value specification>

<simple value specification> ::=
      <parameter name>
    | <embedded variable name>
    | <literal>

<fetch target list> ::=
    <target specification> [ ( <comma> <target specification> )... ]

<target specification> ::=
      <parameter specification>
    | <variable specification>

<close statement> ::=
    CLOSE <cursor name>

<select statement: single row> ::=
    SELECT [ <set quantifier> ] <select list>
      INTO <select target list>
        <table expression>

<select target list> ::=
    <target specification> [ ( <comma> <target specification> )... ]

<SQL data change statement> ::=
      <delete statement: positioned>
    | <delete statement: searched>
    | <insert statement>
    | <update statement: positioned>
    | <update statement: searched>

<delete statement: positioned> ::=
    DELETE FROM <table name>
      WHERE CURRENT OF <cursor name>

<delete statement: searched> ::=
    DELETE FROM <table name>
      [ WHERE <search condition> ]

<insert statement> ::=
    INSERT INTO <table name>
      <insert columns and source>

<insert columns and source> ::=
      [ <left paren> <insert column list> <right paren> ]
            <query expression>
    | DEFAULT VALUES

<insert column list> ::= <column name list>

<update statement: positioned> ::=
    UPDATE <table name>
      SET <set clause list>
        WHERE CURRENT OF <cursor name>

<set clause list> ::=
    <set clause> [ ( <comma> <set clause> )... ]

<set clause> ::=
    <object column> <equals operator> <update source>

<object column> ::= <column name>

<update source> ::=
      <value expression>
    | <null specification>
    | DEFAULT

<update statement: searched> ::=
    UPDATE <table name>
      SET <set clause list>
      [ WHERE <search condition> ]

<SQL transaction statement> ::=
      <set transaction statement>
    | <set constraints mode statement>
    | <commit statement>
    | <rollback statement>

<set transaction statement> ::=
    SET TRANSACTION <transaction mode>
        [ ( <comma> <transaction mode> )... ]

<transaction mode> ::=
      <isolation level>
    | <transaction access mode>
    | <diagnostics size>

<isolation level> ::=
    ISOLATION LEVEL <level of isolation>

<level of isolation> ::=
      READ UNCOMMITTED
    | READ COMMITTED
    | REPEATABLE READ
    | SERIALIZABLE

<transaction access mode> ::=
      READ ONLY
    | READ WRITE

<diagnostics size> ::=
    DIAGNOSTICS SIZE <number of conditions>

<number of conditions> ::= <simple value specification>

<set constraints mode statement> ::=
    SET CONSTRAINTS <constraint name list>
        ( DEFERRED | IMMEDIATE )

<constraint name list> ::=
      ALL
    | <constraint name> [ ( <comma> <constraint name> )... ]

<commit statement> ::=
    COMMIT [ WORK ]

<rollback statement> ::=
    ROLLBACK [ WORK ]

<SQL connection statement> ::=
      <connect statement>
    | <set connection statement>
    | <disconnect statement>

<connect statement> ::=
    CONNECT TO <connection target>

<connection target> ::=
      <SQL-server name>
        [ AS <connection name> ]
          correspondence with Tony Gordon)
        [ USER <user name> ]
    | DEFAULT

<SQL-server name> ::= <simple value specification>

<connection name> ::= <simple value specification>

<user name> ::= <simple value specification>

<set connection statement> ::=
    SET CONNECTION <connection object>

<connection object> ::=
      DEFAULT
    | <connection name>

<disconnect statement> ::=
    DISCONNECT <disconnect object>

<disconnect object> ::=
      <connection object>
    | ALL
    | CURRENT

<SQL session statement> ::=
      <set catalog statement>
    | <set schema statement>
    | <set names statement>
    | <set session authorization identifier statement>
    | <set local time zone statement>

<set catalog statement> ::=
    SET CATALOG <value specification>

<value specification> ::=
      <literal>
    | <general value specification>

<set schema statement> ::=
    SET SCHEMA <value specification>

<set names statement> ::=
    SET NAMES <value specification>

<set session authorization identifier statement> ::=
    SET SESSION AUTHORIZATION
        <value specification>

<set local time zone statement> ::=
    SET TIME ZONE
        <set time zone value>

<set time zone value> ::=
      <interval value expression>
    | LOCAL

<SQL dynamic statement> ::=
      <system descriptor statement>
    | <prepare statement>
    | <deallocate prepared statement>
    | <describe statement>
    | <execute statement>
    | <execute immediate statement>
    | <SQL dynamic data statement>

<system descriptor statement> ::=
      <allocate descriptor statement>
    | <deallocate descriptor statement>
    | <set descriptor statement>
    | <get descriptor statement>

<allocate descriptor statement> ::=
    ALLOCATE DESCRIPTOR <descriptor name>
       [ WITH MAX <occurrences> ]

<descriptor name> ::=
    [ <scope option> ] <simple value specification>

<scope option> ::=
      GLOBAL
    | LOCAL

<occurrences> ::= <simple value specification>

<deallocate descriptor statement> ::=
    DEALLOCATE DESCRIPTOR <descriptor name>

<set descriptor statement> ::=
    SET DESCRIPTOR <descriptor name>
        <set descriptor information>

<set descriptor information> ::=
      <set count>
    | VALUE <item number>
        <set item information> [ ( <comma> <set item information> )... ]

<set count> ::=
    COUNT <equals operator> <simple value specification 1>

<simple value specification 1> ::= <simple value specification>

<item number> ::= <simple value specification>

<set item information> ::=
    <descriptor item name> <equals operator> <simple value specification 2>

<descriptor item name> ::=
      TYPE
    | LENGTH
    | OCTET_LENGTH
    | RETURNED_LENGTH
    | RETURNED_OCTET_LENGTH
    | PRECISION
    | SCALE
    | DATETIME_INTERVAL_CODE
    | DATETIME_INTERVAL_PRECISION
    | NULLABLE
    | INDICATOR
    | DATA
    | NAME
    | UNNAMED
    | COLLATION_CATALOG
    | COLLATION_SCHEMA
    | COLLATION_NAME
    | CHARACTER_SET_CATALOG
    | CHARACTER_SET_SCHEMA
    | CHARACTER_SET_NAME

<simple value specification 2> ::= <simple value specification>

<item number> ::= <simple value specification>

<get descriptor statement> ::=
    GET DESCRIPTOR <descriptor name> <get descriptor information>

<get descriptor information> ::=
      <get count>
    | VALUE <item number>
        <get item information> [ ( <comma> <get item information> )... ]

<get count> ::=
    <simple target specification 1> <equals operator>
         COUNT

<simple target specification 1> ::= <simple target specification>

<simple target specification> ::=
      <parameter name>
    | <embedded variable name>

<get item information> ::=
    <simple target specification 2> <equals operator> <descriptor item name>>

<simple target specification 2> ::= <simple target specification>

<prepare statement> ::=
    PREPARE <SQL statement name> FROM <SQL statement variable>

<SQL statement name> ::=
      <statement name>
    | <extended statement name>

<extended statement name> ::=
    [ <scope option> ] <simple value specification>

<SQL statement variable> ::= <simple value specification>

<deallocate prepared statement> ::=
    DEALLOCATE PREPARE <SQL statement name>

<describe statement> ::=
      <describe input statement>
    | <describe output statement>

<describe input statement> ::=
    DESCRIBE INPUT <SQL statement name> <using descriptor>

<using descriptor> ::=
    ( USING | INTO ) SQL DESCRIPTOR <descriptor name>

<describe output statement> ::=
    DESCRIBE [ OUTPUT ] <SQL statement name> <using descriptor>

<execute statement> ::=
    EXECUTE <SQL statement name>
      [ <result using clause> ]
      [ <parameter using clause> ]

<result using clause> ::= <using clause>

<using clause> ::=
      <using arguments>
    | <using descriptor>

<using arguments> ::=
    ( USING | INTO ) <argument> [ ( <comma> <argument> )... ]

<argument> ::= <target specification>

<parameter using clause> ::= <using clause>

<execute immediate statement> ::=
    EXECUTE IMMEDIATE <SQL statement variable>

<SQL dynamic data statement> ::=
      <allocate cursor statement>
    | <dynamic open statement>
    | <dynamic fetch statement>
    | <dynamic close statement>
    | <dynamic delete statement: positioned>
    | <dynamic update statement: positioned>

<allocate cursor statement> ::=
    ALLOCATE <extended cursor name> [ INSENSITIVE ]
        [ SCROLL ] CURSOR
      FOR <extended statement name>

<extended cursor name> ::=
    [ <scope option> ] <simple value specification>

<dynamic open statement> ::=
    OPEN <dynamic cursor name> [ <using clause> ]

<dynamic cursor name> ::=
      <cursor name>
    | <extended cursor name>

<dynamic fetch statement> ::=
    FETCH [ [ <fetch orientation> ] FROM ] <dynamic cursor name>
        <using clause>

<dynamic close statement> ::=
    CLOSE <dynamic cursor name>

<dynamic delete statement: positioned> ::=
    DELETE FROM <table name>
      WHERE CURRENT OF
          <dynamic cursor name>

<dynamic update statement: positioned> ::=
    UPDATE <table name>
      SET <set clause>
          [ ( <comma> <set clause> )... ]
        WHERE CURRENT OF
            <dynamic cursor name>

<SQL diagnostics statement> ::=
    <get diagnostics statement>

<get diagnostics statement> ::=
    GET DIAGNOSTICS <sql diagnostics information>

<sql diagnostics information> ::=
      <statement information>
    | <condition information>

<statement information> ::=
    <statement information item> [ ( <comma> <statement information item> )... ]

<statement information item> ::=
    <simple target specification> <equals operator> <statement information item name>

<statement information item name> ::=
      NUMBER
    | MORE
    | COMMAND_FUNCTION
    | DYNAMIC_FUNCTION
    | ROW_COUNT

<condition information> ::=
    EXCEPTION <condition number>
      <condition information item> [ ( <comma> <condition information item> )... ]

<condition number> ::= <simple value specification>

<condition information item> ::=
    <simple target specification> <equals operator> <condition information item name>

<condition information item name> ::=
      CONDITION_NUMBER
    | RETURNED_SQLSTATE
    | CLASS_ORIGIN
    | SUBCLASS_ORIGIN
    | SERVER_NAME
    | CONNECTION_NAME
    | CONSTRAINT_CATALOG
    | CONSTRAINT_SCHEMA
    | CONSTRAINT_NAME
    | CATALOG_NAME
    | SCHEMA_NAME
    | TABLE_NAME
    | COLUMN_NAME
    | CURSOR_NAME
    | MESSAGE_TEXT
    | MESSAGE_LENGTH
    | MESSAGE_OCTET_LENGTH

<embedded SQL host program> ::=
      <embedded SQL Ada program>
    | <embedded SQL C program>
    | <embedded SQL COBOL program>
    | <embedded SQL Fortran program>
    | <embedded SQL MUMPS program>
    | <embedded SQL Pascal program>
    | <embedded SQL PL/I program>

<embedded SQL Ada program> ::= !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL C program> ::=
      !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL COBOL program> ::= !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL Fortran program> ::=
    !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL MUMPS program> ::= !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL Pascal program> ::=
    !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL PL/I program> ::= !! <EMPHASIS>(See the Syntax Rules.)

<embedded SQL declare section> ::=
      <embedded SQL begin declare>
        [ <embedded character set declaration> ]
        [ <host variable definition>... ]
      <embedded SQL end declare>
    | <embedded SQL MUMPS declare>

<embedded SQL begin declare> ::=
    <SQL prefix> BEGIN DECLARE SECTION
        [ <SQL terminator> ]

<SQL prefix> ::=
      EXEC SQL
    | <ampersand>SQL<left paren>

<SQL terminator> ::=
      END-EXEC
    | <semicolon>
    | <right paren>

<embedded character set declaration> ::=
    SQL NAMES ARE <character set specification>

<host variable definition> ::=
      <Ada variable definition>
    | <C variable definition>
    | <COBOL variable definition>
    | <Fortran variable definition>
    | <MUMPS variable definition>
    | <Pascal variable definition>
    | <PL/I variable definition>

<Ada variable definition> ::=
    <Ada host identifier> [ ( <comma> <Ada host identifier> )... ] :
    <Ada type specification> [ <Ada initial value> ]

<Ada type specification> ::=
      <Ada qualified type specification>
    | <Ada unqualified type specification>

<Ada qualified type specification> ::=
      SQL_STANDARD.CHAR [ CHARACTER SET
         [ IS ] <character set specification> ]
          <left paren> 1 <double period> <length> <right paren>
    | SQL_STANDARD.BIT
          <left paren> 1 <double period> <length> <right paren>
    | SQL_STANDARD.SMALLINT
    | SQL_STANDARD.INT
    | SQL_STANDARD.REAL
    | SQL_STANDARD.DOUBLE_PRECISION
    | SQL_STANDARD.SQLCODE_TYPE
    | SQL_STANDARD.SQLSTATE_TYPE
    | SQL_STANDARD.INDICATOR_TYPE

<Ada unqualified type specification> ::=
      CHAR
          <left paren> 1 <double period> <length> <right paren>
    | BIT
          <left paren> 1 <double period> <length> <right paren>
    | SMALLINT
    | INT
    | REAL
    | DOUBLE_PRECISION
    | SQLCODE_TYPE
    | SQLSTATE_TYPE
    | INDICATOR_TYPE

<Ada initial value> ::=
    <Ada assignment operator> <character representation>...

<Ada assignment operator> ::= <colon><equals operator>

<C variable definition> ::=
      [ <C storage class> ]
      [ <C class modifier> ]
      <C variable specification>
    <semicolon>

<C storage class> ::=
      auto
    | extern
    | static

<C class modifier> ::= const | volatile

<C variable specification> ::=
      <C numeric variable>
    | <C character variable>
    | <C derived variable>

<C numeric variable> ::=
    ( long | short | float | double )
      <C host identifier> [ <C initial value> ]
            [ ( <comma> <C host identifier> [ <C initial value> ] )... ]

<C initial value> ::=
    <equals operator> <character representation>...

<C character variable> ::=
    char [ CHARACTER SET
             [ IS ] <character set specification> ]
      <C host identifier>
        <C array specification> [ <C initial value> ]
        [ ( <comma> <C host identifier>
          <C array specification>
                 [ <C initial value> ] )... ]

<C array specification> ::=
    <left bracket> <length> <right bracket>

<C derived variable> ::=
      <C VARCHAR variable>
    | <C bit variable>

<C VARCHAR variable> ::=
    VARCHAR [ CHARACTER SET [ IS ]
        <character set specification> ]
        <C host identifier>
            <C array specification> [ <C initial value> ]
          [ ( <comma> <C host identifier>
              <C array specification>
                      [ <C initial value> ] )... ]

<C bit variable> ::=
    BIT <C host identifier>
        <C array specification> [ <C initial value> ]
      [ ( <comma> <C host identifier>
        <C array specification>
                   [ <C initial value> ] )... ]

<COBOL variable definition> ::=
    (01|77) <COBOL host identifier> <COBOL type specification>
      [ <character representation>... ] <period>

<COBOL type specification> ::=
      <COBOL character type>
    | <COBOL bit type>
    | <COBOL numeric type>
    | <COBOL integer type>

<COBOL character type> ::=
    [ CHARACTER SET [ IS ]
          <character set specification> ]
    ( PIC | PICTURE ) [ IS ] ( X [ <left paren> <length> <right paren> ] )...

<COBOL bit type> ::=
    ( PIC | PICTURE ) [ IS ]
        ( B [ <left paren> <length> <right paren> ] )...

<COBOL numeric type> ::=
    ( PIC | PICTURE ) [ IS ]
      S <COBOL nines specification>
    [ USAGE [ IS ] ] DISPLAY SIGN LEADING SEPARATE

<COBOL nines specification> ::=
      <COBOL nines> [ V [ <COBOL nines> ] ]
    | V <COBOL nines>

<COBOL nines> ::= ( 9 [ <left paren> <length> <right paren> ] )...

<COBOL integer type> ::=
      <COBOL computational integer>
    | <COBOL binary integer>

<COBOL computational integer> ::=
    ( PIC | PICTURE ) [ IS ] S<COBOL nines>
      [ USAGE [ IS ] ] ( COMP | COMPUTATIONAL )

<COBOL binary integer> ::=
    ( PIC | PICTURE ) [ IS ] S<COBOL nines>
      [ USAGE [ IS ] ] BINARY

<Fortran variable definition> ::=
    <Fortran type specification>
    <Fortran host identifier>
        [ ( <comma> <Fortran host identifier> )... ]

<Fortran type specification> ::=
      CHARACTER [ <asterisk> <length> ]
          [ CHARACTER SET [ IS ]
                <character set specification> ]
    | BIT [ <asterisk> <length> ]
    | INTEGER
    | REAL
    | DOUBLE PRECISION

<MUMPS variable definition> ::=
    ( <MUMPS numeric variable> | <MUMPS character variable> )
        <semicolon>

<MUMPS numeric variable> ::=
    <MUMPS type specification>
      <MUMPS host identifier> [ ( <comma> <MUMPS host identifier> )... ]

<MUMPS type specification> ::=
      INT
    | DEC
          [ <left paren> <precision> [ <comma> <scale> ] <right paren> ]
    | REAL

<MUMPS character variable> ::=
    VARCHAR <MUMPS host identifier> <MUMPS length specification>
      [ ( <comma> <MUMPS host identifier> <MUMPS length specification> )... ]

<MUMPS length specification> ::=
    <left paren> <length> <right paren>

<Pascal variable definition> ::=
    <Pascal host identifier> [ ( <comma> <Pascal host identifier> )... ] <colon>
      <Pascal type specification> <semicolon>

<Pascal type specification> ::=
      PACKED ARRAY
          <left bracket> 1 <double period> <length> <right bracket>
        OF CHAR
          [ CHARACTER SET [ IS ]
                <character set specification> ]
    | PACKED ARRAY
          <left bracket> 1 <double period> <length> <right bracket>
        OF BIT
    | INTEGER
    | REAL
    | CHAR [ CHARACTER SET
                                [ IS ] <character set specification> ]
    | BIT

<PL/I variable definition> ::=
    (DCL | DECLARE)
        (   <PL/I host identifier>
          | <left paren> <PL/I host identifier>
                [ ( <comma> <PL/I host identifier> )... ] <right paren> )
    <PL/I type specification>
    [ <character representation>... ] <semicolon>

<PL/I type specification> ::=
      ( CHAR | CHARACTER ) [ VARYING ]
          <left paren><length><right paren>
          [ CHARACTER SET
                [ IS ] <character set specification> ]
    | BIT [ VARYING ] <left paren><length><right paren>
    | <PL/I type fixed decimal> <left paren> <precision>
          [ <comma> <scale> ] <right paren>
    | <PL/I type fixed binary> [ <left paren> <precision> <right paren> ]
    | <PL/I type float binary> <left paren> <precision> <right paren>

<PL/I type fixed decimal> ::=
      ( DEC | DECIMAL ) FIXED
    | FIXED ( DEC | DECIMAL )

<PL/I type fixed binary> ::=
      ( BIN | BINARY ) FIXED
    | FIXED ( BIN | BINARY )

<PL/I type float binary> ::=
      ( BIN | BINARY ) FLOAT
    | FLOAT ( BIN | BINARY )

<embedded SQL end declare> ::=
    <SQL prefix> END DECLARE SECTION
        [ <SQL terminator> ]

<embedded SQL MUMPS declare> ::=
    <SQL prefix>
      BEGIN DECLARE SECTION
        [ <embedded character set declaration> ]
        [ <host variable definition>... ]
      END DECLARE SECTION
    <SQL terminator>

<embedded SQL statement> ::=
    <SQL prefix>
      <statement or declaration>
    [ <SQL terminator> ]

<statement or declaration> ::=
      <declare cursor>
    | <dynamic declare cursor>
    | <temporary table declaration>
    | <embedded exception declaration>
    | <SQL procedure statement>

<embedded exception declaration> ::=
    WHENEVER <condition> <condition action>

<condition> ::=
    SQLERROR | NOT FOUND

<condition action> ::=
    CONTINUE | <go to>

<go to> ::=
    ( GOTO | GO TO ) <goto target>

<goto target> ::=
      <host label identifier>
    | <unsigned integer>
    | <host PL/I label variable>

<host label identifier> ::= !!<EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<host PL/I label variable> ::= !!<EMPHASIS>£¨²Î¿´ÎÄ·¨¹æÔò£©

<preparable statement> ::=
      <preparable SQL data statement>
    | <preparable SQL schema statement>
    | <preparable SQL transaction statement>
    | <preparable SQL session statement>
    | <preparable implementation-defined statement>

<preparable SQL data statement> ::=
      <delete statement: searched>
    | <dynamic single row select statement>
    | <insert statement>
    | <dynamic select statement>
    | <update statement: searched>
    | <preparable dynamic delete statement: positioned>
    | <preparable dynamic update statement: positioned>

<dynamic single row select statement> ::= <query specification>

<dynamic select statement> ::= <cursor specification>

<preparable dynamic delete statement: positioned> ::=
   DELETE [ FROM <table name> ]
      WHERE CURRENT OF <cursor name>

<preparable dynamic update statement: positioned> ::=
   UPDATE [ <table name> ]
      SET <set clause list>
      WHERE CURRENT OF <cursor name>

<preparable SQL schema statement> ::=
      <SQL schema statement>

<preparable SQL transaction statement> ::=
      <SQL transaction statement>

<preparable SQL session statement> ::=
      <SQL session statement>

<preparable implementation-defined statement> ::=
    !! <EMPHASIS>(See the Syntax Rules.)

<direct SQL statement> ::=
    <directly executable statement> <semicolon>

<directly executable statement> ::=
      <direct SQL data statement>
    | <SQL schema statement>
    | <SQL transaction statement>
    | <SQL connection statement>
    | <SQL session statement>
    | <direct implementation-defined statement>

<direct SQL data statement> ::=
      <delete statement: searched>
    | <direct select statement: multiple rows>
    | <insert statement>
    | <update statement: searched>
    | <temporary table declaration>

<direct select statement: multiple rows> ::=
    <query expression> [ <order by clause> ]

<direct implementation-defined statement> ::=
    !!<EMPHASIS>(See the Syntax Rules)

<SQL object identifier> ::=
    <SQL provenance> <SQL variant>

<SQL provenance> ::= <arc1> <arc2> <arc3>

<arc1> ::= iso | 1 | iso <left paren> 1 <right paren>

<arc2> ::= standard | 0 | standard <left paren> 0 <right paren>

<arc3> ::= 9075

<SQL variant> ::= <SQL edition> <SQL conformance>

<SQL edition> ::= <1987> | <1989> | <1992>

<1987> ::= 0 | edition1987 <left paren> 0 <right paren>

<1989> ::= <1989 base> <1989 package>

<1989 base> ::= 1 | edition1989 <left paren> 1 <right paren>

<1989 package> ::= <integrity no> | <integrity yes>

<integrity no> ::= 0 | IntegrityNo <left paren> 0 <right paren>

<integrity yes> ::= 1 | IntegrityYes <left paren> 1 <right paren>

<1992> ::= 2 | edition1992 <left paren> 2 <right paren>

<SQL conformance> ::= <low> | <intermediate> | <high>

<low> ::= 0 | Low <left paren> 0 <right paren>

<intermediate> ::= 1 | Intermediate <left paren> 1 <right paren>

<high> ::= 2 | High <left paren> 2 <right paren>
\end{verbatim}
\end{tscreen}



\section{¸½Â¼ÒÒ¡õ³õÑ§Õß SQL µ¼Òý \label{Appendix B}}




\subsection{PostgreSQL µ¼Òý}

SQL µ¼ÒýÒ²°üº¬ÔÚ PostgreSQL ÖÐÉ¢²¼¡£SQL µ¼ÒýÊÖ¸åÔÚ src/tutorial Ä¿Â¼ÖÐ¡£


\subsection{»¥ÁªÍø URL Ö¸±ê}

³õÑ§ÕßµÄ SQL µ¼Òý¿ÉÔÚÒÔÏÂµØ·½ÕÒµ½
\begin{itemize}
\item  Jim Hoffman µÄÖ¸µ¼ \nameurl{http://w3.one.net/~jhoffman/sqltut.htm}{}
\item  Carnegie Mellon Univ \nameurl{http://www.heinz.cmu.edu/project/dbms}{}
ÔÚ´Ë»÷Ñ¡¡®technical¡¯-{$>$}¡®SQL\_examples.html¡¯ºÍÆäËû¡£
\item  Concord Univ \nameurl{http://www.cs.concordia.ca/Course_Notes/oracle/browser/node1.html}{}
\end{itemize}

ÓÐÒâ¼û»òÒÉÄÑ£¿µçÓÊÖÁ
\begin{itemize}
\item  Jim Hoffman \onlynameurl{jhoffman@one.net}
\end{itemize}

John Hoffman Ò²ÍÆ¼öÒÔÏÂÍøÖ·¡Ã
\begin{itemize}
\item  SQL Reference \nameurl{http://www.contrib.andrew.cmu.edu/~shadow/sql.html}{}
\item  Ask the SQL Pro \nameurl{http://www.inquiry.com/techtips/thesqlpro/}{}
\item  SQL Pro's Relational DB Useful Sites \nameurl{http://www.inquiry.com/techtips/thesqlpro/usefulsites.html}{}
\item  Programmer's Source \nameurl{http://infoweb.magi.com/~steve/develop.html}{}
\item  DBMS Sites \nameurl{http://info.itu.ch/special/wwwfiles}{} µ½´ËÈ¡µÃ 
compdb.html µµ
\item  DB Ingredients \nameurl{http://www.compapp.dcu.ie/databases/f017.html}{}
\item  Web Authoring \nameurl{http://www.stars.com/Tutorial/CGI/}{}
\item  Computing Dictionary \nameurl{http://wfn-shop.princeton.edu/cgi-bin/foldoc}{}
\item  DBMS Lab/Links \nameurl{http://www-ccs.cs.umass.edu/db.html}{}
\item  SQL FAQ \nameurl{http://epoch.CS.Berkeley.EDU:8000/sequoia/dba/montage/FAQ}{} Go here and 
see file SQL\_TOC.html
\item  SQL Databases \nameurl{http://chaos.mur.csu.edu.au/itc125/cgi/sqldb.html}{}
\item  RIT Database Design Page \nameurl{http://www.it.rit.edu/~wjs/IT/199602/icsa720/icsa720postings.html}{}
\item  Database Jump Site \nameurl{http://www.pcslink.com/~ej/dbweb.html}{}
\item  Programming Tutorials on the Web \nameurl{http://www.eng.uc.edu/~jtilley/tutorial.html}{}
\item  Development Resources \nameurl{http://www.ndev.com/ndc2/support/resources.htp}{}
\item  Query List \nameurl{http://ashok.pair.com/sql.htm}{}
\item  IMAGE SQL Miscellaneous \nameurl{http://jazz.external.hp.com/training/sqltables/main.html}{}
\item  Internet Resource List \nameurl{http://www.eit.com/web/netservices.html}{}
\end{itemize}



\subsection{ÏßÉÏ SQL Ö¸µ¼}

µ½ÒÔÏÂÍøÒ³È¡µÃÏßÉÏ SQL Ö¸µ¼
\begin{itemize}
\item  SQL ³õÑ§¿Î³Ì \nameurl{http://sqlcourse.com}{}
\item  SQL ½ø½×¿Î³Ì \nameurl{http://sqlcourse2.com}{}
\end{itemize}





\section{¸½Â¼±û¡õLinux ¿ìËÙ°²×°Ö¸Òý \label{Appendix C}}

Èç¹ûÄã¼Æ»®ÔÚ Linux Ê¹ÓÃ PostgreSQL£¬¶øÔÚ°²×° Linux 
Ê±ÐèÒª°ïÖú£¬Çë²Î¿¼ÔÚÕâ¸½Â¼ÖÐÖ¸Ê¾µÄµØ·½¡£ËüÃÇ°üº¬ÒÔÏÂÖ÷Ìâ¡Ã
\begin{itemize}
\item  Salient Features of Linux - Why Linux is better as a database server 
when compared with Windows 95/NT
\item  10 minutes Linux Quick Install Instructions
\item  Microsoft-Linux Analogy List
\item  Quick Steps to Recompile the Linux Kernel
\end{itemize}


\begin{itemize}
\item  Ö÷ÍøÒ³ \nameurl{http://www.aldev.8m.com}{}
\item  Ó³ÉäÕ¾Ì¨ \nameurl{http://aldev.webjump.com}{}
\item  Ó³ÉäÕ¾Ì¨ \nameurl{http://www.homepages.infoseek.com/~aldev1/index.html}{}
\item  Ó³ÉäÕ¾Ì¨ \nameurl{http://www3.bcity.com/aldev/}{}
\item  Ó³ÉäÕ¾Ì¨ \nameurl{http://www.members.spree.com/technology/aldev/}{} 
\end{itemize}



\section{¸½Â¼¶¡¡õ°²×° Midgard \label{midgardinstall}}

À´×Ô \nameurl{http://www.midgard-project.org/download/binaries}{} µÄ RPMS
Ä¿Ç°²»°üÀ¨ PostgreSQL Ö§Ô®£¬ËùÒÔÄãÒª´ÓÔ­Ê¼Âë tar.gz µµ°²×°¡£

ÏÂÔØ Midgard Ô­Ê¼Âë tar.gz µµ£¬ÔÄ¶Á INSTALL.REDHAT µµ¡õ
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
bash# cd midgard-lib-1.4beta6
bash# ./configure --prefix=/usr/local --with-mysql=/usr/local --includedir=/usr/include/mysql --with-midgard=/usr/local --with-pgsql=/var/lib/pgsql --includedir=/usr/include/pgsql
bash# make
bash# make install
bash# ldconfig -v | grep -i midga
¿½±´¡õÍ·µµ£¬ÒÔ·À make install ²»ÕâÑù×ö¡­
bash# cp *.h /usr/local/include
 
 
bash# cd ../mod_midgard-1.4beta5c
bash# ./configure --prefix=/usr/local --with-mysql=/usr/local --includedir=/usr/include/mysql --with-midgard=/usr --with-pgsql=/var/lib/pgsql --includedir=/usr/include/pgsql
bash# make
bash# make install
# ÐÞ¸Ä apache Éè¶¨Îª /usr/¡­¡­
#modify apache line to correct /usr/.....
bash# vi /etc/httpd/conf/httpd.conf   £¨»òÔÚ  /etc/apache/httpd.conf£©
bash# /etc/init.d/apache restart
# Ë£ÖØÐÂÆô¶¯ apache£¡£¡£¡

bash# cd ../midgard-php-1.4beta6
bash# ./configure '--with-apxs' '--with-mysql' '--with-pgsql' '--with-midgard' --prefix=/usr/local --with-midgard=/usr/local
 
bash# gvim Makefile
ÔÚ INCLUDE ±äÊýÖÐ¼ÓÉÏ -I/usr/include/pgsql¡£

Ò²ÒªÈçÏÂÔÚ $(APXS) Ö¸ÁîÖÐ¼ÓÉÏ $(INCLUDE)¡õ
 
libphp3.so: mod_php3.c libmodphp3-so.a  pcrelib/libpcre.a midgard/libphpmidgard.a
    -@test -f ./mod_php3.c || test -L ./mod_php3.c || $(LN_S) $(srcdir)/mod_php3.c ./mod_php3.c
    -@test -f ./mod_php3.c || test -h ./mod_php3.c || $(LN_S) $(srcdir)/mod_php3.c ./mod_php3.c
    $(APXS) -c -o libphp3.so  -I$(srcdir) $(INCLUDE) -I. -I/usr/local/include -I/usr/lib/glib/include  -Wl,'-rpath /usr/local/lib' ./mod_php3.c libmodphp3-so.a
$(APXS_LDFLAGS)
 
bash# make
bash# make install
# ÐÞ¸Ä apache Éè¶¨Îª /usr/¡­¡­
# ¼ÓÉÏÈçÏÂÊýÐÐ¡õ
    LoadModule php4_module        modules/libphp4.so
            AddModule mod_php4.c
    LoadModule php4_module        lib/apache/libphp4.so
 
    <IfModule mod_php4.c>
        AddType application/x-httpd-php4 .php4
        AddType application/x-httpd-php4 .php
        AddType application/x-httpd-php4-source .phps
        AddType application/x-httpd-php .php
    </IfModule>
 
bash# vi /etc/httpd/conf/httpd.conf   £¨»òÔÚ /etc/apache/httpd.conf£©
 
bash# /etc/init.d/apache restart
# ÒªÖØÐÂÆô¶¯ apache£¡£¡£¡
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}



\subsection{²âÊÔ Midgard PHP ËÅ·þÆ÷\label{testmidgard}}

Òª²âÊÔ°²×°ÊÇ·ñ³É¹¦ÇëÕâÑù×ö¡õ
ÔÚÄãµÄÎÄ¼þ¸ùÄ¿Â¼ÖÐ½¨Á¢Ò»¸öµµ°¸¡£ÎÒÍ¨³£³ÆËüÎª info.php£¬²¢ÔÚÆä¼ä¼ÓÉÏÒ»ÐÐ¡Ã
\par
\addvspace{\medskipamount}
\nopagebreak\hrule
\begin{verbatim}
<?phpinfo()?>
\end{verbatim} 
\nopagebreak\hrule 
\addvspace{\medskipamount}


ÔÚÄãµÄä¯ÀÀÆ÷ÖÐÔØÈë¡Ãhttp://localhost/info.php

Äã»á¼ûµ½Ò»Ò³Æ¯ÁÁµÄ¡õÒª£¬ÁÐ³öÄãµÄÉè¶¨ÖÐËùÓÐ×ÊÁÏ¡£
Äã´ó¸Å²»»á°ÑÕâµµ°¸·ÅÔÚÔÚÉú²úÓÃµÄËÅ·þÆ÷ÖÐ£¬µ«ÎªÁË¿ª·¢Ê±³ý´íºÍÒ»°ã×ÊÁÏ£¬
Ëü»áºÜ·½±ã¡£


\subsection{±£°² OpenSSL \label{openssl}}

Äã¿ÉÄÜÒªÔÚ
\nameurl{ftp://ftp.deva.net/pub/sources/crypto/rsaref20.1996.tar.Z}{}
È¡ÐÐ RSA Ì××°Èí¼þÒÔÆôÓÃ SSL ¼ÓÃÜ¡£Ò²Çë¿´¿´ Linux ¹âµúµÄ OpenSSL
\nameurl{http://www.openssl.org}{}¡£

Èç¹ûÄã²»ÏëÆô¶¯ SSL£¨»òÄãÓöµ½À§ÄÑ£©£¬ÏÂÔØÔ­Ê¼Âë Apache-Midgard RPM ºÍÐÞ¸Ä *.spec
µµºÍÉ¾È¥ SSL£¬ÔÙÖØ¼û RPM¡£

\end{document}
