-
+
+
-
+
+
+
+
+
+
+
+
]>
-
+
-&intro;
+&intro-ag ;
&ports;
&install;
+&runtime;
&start-ag;
&recovery;
®ress;
Reference texts for SQL features.
- ID="BOWMAN93">
+
-
The Practical SQL Handbook
-Using Structured Query Language
+
+The Practical
SQL Handbook
+
+
+Bowman et al, 1993
+
+
+Using Structured Query Language
+
3
-->
- ID="DATE97">
+
-
A Guide to The SQL Standard
-
A user's guide to the standard database language SQL
+
+A Guide to the
SQL Standard
+
+
+Date and Darwen, 1997
+
+
+A user's guide to the standard database language
SQL
+
4
-->
- ID="MELT93">
+
-
Understanding the New SQL
+
+Understanding the New
SQL
+
+
+Melton and Simon, 1993
+
A complete guide
PostgreSQL-Specific Documentation
This section is for related documentation.
- ID="ADMIN-GUIDE">
+
-
The PostgreSQL Administrator's Guide
+
+The
PostgreSQL Administrator's Guide
+
+
+The Administrator's Guide
+
Thomas
Lockhart
The PostgreSQL Global Development Group
-->
- ID="DEVELOPERS-GUIDE">
+
-
The PostgreSQL Developer's Guide
+
+The
PostgreSQL Developer's Guide
+
+
+The Developer's Guide
+
Thomas
Lockhart
The PostgreSQL Global Development Group
-->
- ID="PROGRAMMERS-GUIDE">
+
-
The PostgreSQL Programmer's Guide
+
+The
PostgreSQL Programmer's Guide
+
+
+The Programmer's Guide
+
Thomas
Lockhart
The PostgreSQL Global Development Group
-->
- ID="TUTORIAL-GUIDE">
+
-
The PostgreSQL Tutorial Introduction
+
+The
PostgreSQL Tutorial Introduction
+
+
+The Tutorial
+
Thomas
Lockhart
The PostgreSQL Global Development Group
-->
- ID="POSTGRES-USERS">
+
-
The PostgreSQL User's Guide
+
+The
PostgreSQL User's Guide
+
+
+The User's Guide
+
Thomas
Lockhart
The PostgreSQL Global Development Group
-->
- ID="YU95">
+
-
The Postgres95 User Manual
-YU95
+
+The
Postgres95 User Manual
+
+
+Yu and Chen, 1995
+
A.
Proceedings and Articles
This section is for articles and newsletters.
- ID="ONG90">
+
-
A Unified Framework for Version Modeling Using Production Rules in a Database System
-ONG90
+
+A Unified Framework for Version Modeling Using Production Rules in a Database System
+
+
+Ong and Goh, 1990
+
L.
-->
- ID="ROWE87">
+
-ROWE87
+
+
+
+Rowe and Stonebraker, 1987
+
L.
-->
- ID="STON86">
+
-STON86
+
+
+
+Stonebraker and Rowe, 1986
+STON86
+
M.
-->
- ID="STON87a">
+
-
The Design of the Postgres Rules System
-STON87a
+
+The Design of the
Postgres Rules System
+
+Stonebraker, Hanson, Hong, 1987
+
M.
-->
- ID="STON87b">
+
-
The Postgres Storage System
-STON87b
+
+The
Postgres Storage System
+
+
+Stonebraker, 1987
+
M.
-->
- ID="STON89">
+
-
A Commentary on the Postgres Rules System
-STON89
+
+A Commentary on the
Postgres Rules System
+
+
+Stonebraker et al, 1989
M.
Sept. 1989
Record 18(3)
SIGMOD
-1987
+1989
- ID="STON90a">
+
-
The Implementation of Postgres
-STON90a
+
+The Implementation of
Postgres
+
+
+Stonebraker, Rowe, Hirohama, 1990
+
M.
-->
- ID="STON90b">
+
-
On Rules, Procedures, Caching and Views in Database Systems
-STON90b
+
+On Rules, Procedures, Caching and Views in Database Systems
+
+
+Stonebraker et al, ACM, 1990
+
M.
Stonebraker
-et. al.
+et al
--- /dev/null
+
+
Configuration Options
+
+
+
Locale Support
+
+
+Written by Oleg Bartunov.
+ for additional information on locale and Russian language support.
+
+
+
+While doing a project for a company in Moscow, Russia,
+I encountered the problem that postgresql had no
+support of national alphabets. After looking for possible workarounds
+I decided to develop support of locale myself.
+I'm not a C-programer but already had some experience with locale programming
+when I work with perl
+(debugging) and glimpse. After several days of digging through
+ the
Postgres source tree I made very minor corections to
+src/backend/utils/adt/varlena.c and src/backend/main/main.c and got what I needed!
+I did support only for
+LC_CTYPE and LC_COLLATE, but later LC_MONETARY was added by others. I got many
+messages from people about this patch so I decided to send it to developers
+and (to my surprise) it was
+incorporated into postgresql distribution.
+
+ People often complain that locale doesn't work for them.
+There are several common mistakes:
+
+
+
+ Didn't properly configure postgresql before compilation.
+ You must run configure with --enable-locale option to enable locale support.
+ Didn't setup environment correctly when starting postmaster.
+ You must define environment variables $LC_CTYPE and $LC_COLLATE
+before running postmaster
+ because backend gets information about locale from environment.
+I use following shell script
+ (runpostgres):
+
+ #!/bin/sh
+
+ export LC_CTYPE=koi8-r
+ export LC_COLLATE=koi8-r
+ postmaster -B 1024 -S -D/usr/local/pgsql/data/ -o '-Fe'
+
+
+ and run it from rc.local as
+
+ /bin/su - postgres -c "/home/postgres/runpostgres"
+
+
+
+
+
+ Broken locale support in OS (for example, locale support in libc
+under Linux several times has changed
+ and this caused a lot of problems). Latest perl has also support of
+locale and if locale is broken perl -v will
+ complain something like:
+
+ 8:17[mira]:~/WWW/postgres>setenv LC_CTYPE not_exist
+ 8:18[mira]:~/WWW/postgres>perl -v
+ perl: warning: Setting locale failed.
+ perl: warning: Please check that your locale settings:
+ LC_ALL = (unset),
+ LC_CTYPE = "not_exist",
+ LANG = (unset)
+ are supported and installed on your system.
+ perl: warning: Falling back to the standard locale ("C").
+
+
+
+
+
+ Wrong location of locale files!
+
+ Possible locations include:
+/usr/lib/locale
+(Linux, Solaris), /usr/share/locale (Linux),
+/usr/lib/nls/loc (DUX 4.0).
+
+ Check man locale to find the correct location.
+Under Linux I did a symbolic link between /usr/lib/locale and
+ /usr/share/locale to be sure that
+the next libc will not break my locale.
+
+
+
+
+
+
What are the Benefits?
+
+You can use ~* and order by operators for strings contain characters
+from national alphabets. Non-english users
+definitely need that. If you won't use locale stuff just undefine
+the USE_LOCALE variable.
+
+
+
What are the Drawbacks?
+
+There is one evident drawback of using locale - it's speed!
+So, use locale only if you really need it.
+
+
+
Kerberos Authentication
+
+
Kerberos is an industry-standard secure authentication
+system suitable for distributed computing over a public network.
+
+
+
Availability
+
+The
+authentication system is not distributed with
Postgres . Versions of
+are typically available as optional software from operating system
+vendors. In addition, a source code distribution may be obtained through
+
+
+You may wish to obtain the MIT version even if your
+vendor provides a version, since some vendor ports have been
+deliberately crippled or rendered non-interoperable with the MIT
+version.
+
+Users located outside the United States of America and
+Canada are warned that distribution of the actual encryption code in
+is restricted by U. S. Government export regulations.
+
+Inquiries regarding your
Kerberos
+should be directed to your vendor or
+(Frequently-Asked Questions Lists) are periodically posted to the
+(send
+and
+
+
+
Installation
+
+Installation of
+itself is covered in detail in the
+Kerberos Installation Notes .
+Make sure that the server key file (the srvtab
+or keytab )
+is somehow readable by the
Postgres account.
+
+
Postgres and its clients can be compiled to use
+either Version 4 or Version 5 of the MIT
+protocols by setting the
+KRBVERS
+variable in the file src/Makefile.global to the
+appropriate value. You can also change the location where
+expects to find the associated libraries, header files and its own
+server key file.
+
+After compilation is complete,
Postgres
+ must be registered as a
Kerberos
+service. See the
+Kerberos Operations Notes
+and related manual pages for more details on registering services.
+
+
+
Operation
+
+After initial installation,
Postgres
+should operate in all ways as a normal
+service. For details on the use of authentication, see the
+PostgreSQL User's Guide reference sections
+
+In the
+Version 5 hooks, the following assumptions are made about user
+and service naming:
+
+
+
+User principal names (anames) are assumed to
+contain the actual Unix/
Postgres user name
+ in the first component.
+
+
+The
Postgres service is assumed to be have two components,
+ the service name and a hostname, canonicalized as in Version 4 (i.e., with all domain
+suffixes removed).
+
+
+
+
+
Kerberos Parameter Examples
+Kerberos
+
+
+
+|
+
+Parameter
+
+
+Example
+
+
+
+|
+
+user
+
+
+
+
+|
+
+user
+
+
+
+
+|
+
+host
+
+
+
+
+
+
+
+Support for Version 4 will disappear sometime after the production
+release of Version 5 by MIT.
exec sql type
+
exec sql prepare
+
exec sql allocate
+
exec sql free
+
exec sql whenever sqlwarning
+
SQLSTATE
+
--- /dev/null
+
+
A Short History of Postgres
+
+
+
The Berkeley Postgres Project
+
+ Implementation of the
Postgres
+ initial concepts for the system were presented in
+
+ and the definition of the initial data model
+ appeared in
+.
+The design of the rule system at
+ that time was described in
+.
+The rationale
+ and architecture of the storage manager were detailed in
+.
+
+
+
Postgres has undergone several major releases since
+ then. The first "demoware" system became operational
+ in 1987 and was shown at the 1988
ACM-SIGMOD
+ Conference. We released Version 1, described in
+,
+ to a few external users in June 1989. In response to a
+ critique of the first rule system
+(),
+the rule
+ system was redesigned
+()
+and Version 2 was
+ released in June 1990 with the new rule system.
+ Version 3 appeared in 1991 and added support for multiple
+ storage managers, an improved query executor, and a
+ rewritten rewrite rule system. For the most part,
+ releases since then have focused on portability and
+ reliability.
+
+
+
Postgres has been used to implement many different
+ research and production applications. These include: a
+ financial data analysis system, a jet engine
+ performance monitoring package, an asteroid tracking
+ database, a medical information database, and several
+ geographic information systems.
+ used as an educational tool at several universities.
+ Finally,
+
Illustra Information Technologies
+(since merged into
+
+ picked up
+ the code and commercialized it.
+
Postgres became the primary data manager
+ for the
+ scientific computing project in late 1992.
+ Furthermore, the size of the external user community
+ nearly doubled during 1993. It became increasingly
+ obvious that maintenance of the prototype code and
+ support was taking up large amounts of time that should
+ have been devoted to database research. In an effort
+ to reduce this support burden, the project officially
+ ended with Version 4.2.
+
+
+
+
+
+In 1994,
+and
+added a SQL language interpreter to
Postgres ,
+and the code was subsequently released to
+the Web to find its own way in the world.
+
Postgres95 was a public-domain, open source descendant
+of this original Berkeley code.
+
+
+
Postgres95 is a derivative of the last official release
+of
Postgres (version 4.2). The code is now completely
+ ANSI C and the code size has been trimmed by 25%. There
+ are a lot of internal changes that improve performance
+and code maintainability.
+
Postgres95 v1.0.x runs about 30-50%
+ faster on the Wisconsin Benchmark compared to v4.2.
+ Apart from bug fixes, these are the major enhancements:
+
+
+
+ The query language
Postquel has been replaced with
+
SQL (implemented in the server). We do not yet support
+ subqueries (which can be imitated with user defined
+
SQL functions). Aggregates have been
+ re-implemented. We also added support for ``GROUP BY''.
+ The
libpq interface is still available for
C
+ programs.
+
+
+
+ In addition to the monitor program, we provide a new
+ program (
psql ) which supports
GNU readline .
+
+
+
+ We added a new front-end library, libpgtcl , that
+ supports
Tcl -based clients. A sample shell,
+ pgtclsh, provides new Tcl commands to interface
tcl
+ programs with the
Postgres95 backend.
+
+
+
+ The large object interface has been overhauled. We
+ kept Inversion large objects as the only mechanism
+ for storing large objects. (This is not to be
+ confused with the Inversion file system which has been
+ removed.)
+
+
+
+ The instance-level rule system has been removed.
+ Rules are still available as rewrite rules.
+
+
+
+ A short tutorial introducing regular
SQL features as
+ well as those of ours is distributed with the source
+ code.
+
+
+
+
GNU make (instead of
BSD make) is used for the
+ build. Also,
Postgres95 can be compiled with an
+ unpatched
gcc (data alignment of doubles has been
+ fixed).
+
+
+
+
+
+
+
+
+By 1996, it became clear that the name Postgres95
would not stand
+the test of time. A new name,
PostgreSQL ,
+was chosen to reflect the
+relationship between original
Postgres
+and the more recent
+versions with
SQL capability.
+At the same time, the version numbering
+was reset to start at 6.0,
+putting the numbers back into the sequence originally begun by
+
+The emphasis on development for the v1.0.x releases of
+was on stabilizing the backend code.
+With the v6.x series of
PostgreSQL ,
+the emphasis has shifted from
+identifying and understanding existing problems in the backend
+to augmenting features and capabilities, although
+work continues in all areas.
+
+Major enhancements include:
+
+
+
+Important backend features, including subselects, defaults,
+constraints, and triggers, have been implemented.
+
+
+
+Additional
SQL92 -compliant language features have been added,
+ including primary keys, quoted identifiers, literal string type coersion,
+type casting, and binary and hexadecimal integer input.
+
+
+
+Built-in types have been improved, including new wide-range date/time types
+and additional geometric type support.
+
+
+
+Overall backend code speed has been increased by approximately 20-40%,
+and backend startup time has decreased 80% since v6.0 was released.
+
+
+
+
+
+
+
\ No newline at end of file
--- /dev/null
+
+
Resources
+
+This manual set is organized into several parts:
+
+
+
+Tutorial
+
+An introduction for new users. Does not cover advanced features.
+
+
+
+
+
+User's Guide
+
+General information for users, including available commands and data types.
+
+
+
+
+
+Programmer's Guide
+
+Advanced information for application programmers. Topics include
+type and function extensibility, library interfaces, and application design issues.
+
+
+
+
+
+Administrator's Guide
+
+Installation and management information. List of supported machines.
+
+
+
+
+
+Developer's Guide
+
+Information for
Postgres developers. This is intended
+for those who are contributing to the
Postgres
+project; application development information should appear in the Programmer's Guide.
+
+
+
+
+
+Reference Manual
+
+Detailed reference information on command syntax.
+At the moment, this manual is very sparse, but eventually should contain
+information similar to that in the man pages.
+
+
+
+
+
+In addition to this manual set, there are other resources to help you with
+
Postgres installation and use:
+
+
+
+man pages
+
+The man pages have general information on command syntax.
+
+
+
+
+
+FAQs
+
+The Frequently Asked Questions (FAQ) documents address both general issues
+and some platform-specific issues.
+
+
+
+
+
+READMEs
+
+README files are available for some contributed packages.
+
+
+
+
+
+Web Site
+
+The
Postgres web site has some information
+not appearing in the distribution. There is a
mhonarc catalog of mailing list traffic
+which is a rich resource for many topics.
+
+
+
+
+
+Mailing Lists
+
+mailing list is a good place to have user questions answered. Other mailing lists are available; consult
+the web page for details.
+
+
+
+
+
+Yourself!
+
+
Postgres is an open source product.
+As such, it depends on the user community for
+ongoing support. As you begin to use
Postgres ,
+you will rely on others
+for help, either through the documentation or through the mailing lists.
+Consider contributing your
+knowledge back. If you learn something which is not in the documentation,
+write it up and contribute it.
+If you add features to the code, contribute it.
+Even those without a lot of experience can provide
+corrections and minor changes in the documentation, and that is a good way to start.
+The
+mailing list is the place to get going.
+
+
+
+
+
+
--- /dev/null
+
+
Introduction
+
+ This document is the Administrator's Manual for the
+ database management system, originally developed at the University
+ of California at Berkeley.
+
+ led by Professor Michael Stonebraker, was sponsored by the
+ Defense Advanced Research Projects Agency (
DARPA ), the
+ Army Research Office (
ARO ), the National Science
+ Foundation (
NSF ), and ESL, Inc.
+
+
+¬ation;
+
+&legal;
+
+
This document is the programmer's manual for the
database management system, originally developed at the University
- of California at Berkeley.
PostgreSQL is based on
+ of California at Berkeley.
+
The first part of this manual
- explains the
-
Postgres approach to extensibility and describe how
- users can extend
Postgres by adding user-defined types,
- operators, aggregates, and both query language and programming language functions.
+approach to extensibility and describe how
+ users can extend
Postgres
+by adding user-defined types,
+ operators, aggregates, and both query language and programming
+language functions.
After an extremely brief
overview of the
Postgres rule system, we discuss
the trigger and SPI interfaces.
- The manual concludes with a detailed description of the programming interfaces and
+ The manual concludes with a detailed description of
+the programming interfaces and
support libraries for various languages.
We assume proficiency with UNIX and C programming.
-
-
Copyrights and Trademarks
-
-
PostgreSQL is copyright (C) 1996-8 by the PostgreSQL Global Development Group,
-and is distributed under the terms of the Berkeley license.
-
-
Postgres95 is copyright (C) 1994-5 by the Regents of the University of California.
-Permission to use, copy, modify, and distribute this software and its documentation
-for any purpose, without fee, and without a written agreement is hereby granted,
-provided that the above copyright notice and this paragraph and the following two
-paragraphs appear in all copies.
-
-In no event shall the University of California be liable to
-any party for direct, indirect, special, incidental, or consequential
-damages, including lost profits, arising out of the use of this
-software and its documentation, even if the University of California
-has been advised of the possibility of such damage.
-
-The University of California specifically disclaims any
-warranties, including, but not limited to, the implied warranties
-of merchantability and fitness for a particular purpose.
-The software provided hereunder is on an "as-is" basis, and
-the University of California has no obligations to provide
-maintainance, support, updates, enhancements, or modifications.
-
+¬ation;
-
UNIX is a trademark of X/Open, Ltd. Sun4, SPARC, SunOS
-and Solaris are trademarks of Sun Microsystems, Inc. DEC,
-DECstation, Alpha AXP and ULTRIX are trademarks of Digital
-Equipment Corp. PA-RISC and HP-UX are trademarks of
-Hewlett-Packard Co. OSF/1 is a trademark of the Open
-Software Foundation.
-
+&legal;
This document is the user manual for the
database management system, originally developed at the University
- of California at Berkeley.
PostgreSQL is based on
+ of California at Berkeley.
+
- led by Professor Michael Stonebraker, has been sponsored by the
+ led by Professor Michael Stonebraker, was sponsored by the
Defense Advanced Research Projects Agency (
DARPA ), the
Army Research Office (
ARO ), the National Science
Foundation (
NSF ), and ESL, Inc.
it is firmly in the relational database world. In fact, some commercial databases
have recently incorporated features pioneered by
Postgres .
-
-
-
-
A Short History of Postgres
-
-
-
The Berkeley Postgres Project
-
- Implementation of the
Postgres DBMS began in 1986. The
- initial concepts for the system were presented in
-
-[STON86]
- and the definition of the initial data model
- appeared in
-
-[ROWE87] .
-The design of the rule system at
- that time was described in
-
-[STON87a] .
-The rationale
- and architecture of the storage manager were detailed in
-
-[STON87b] .
-
-
-
Postgres has undergone several major releases since
- then. The first "demoware" system became operational
- in 1987 and was shown at the 1988
ACM-SIGMOD
- Conference. We released Version 1, described in
-
-[STON90a] ,
- to a few external users in June 1989. In response to a
- critique of the first rule system
-
-([STON89] ),
-the rule
- system was redesigned
-
-([STON90b] )
-and Version 2 was
- released in June 1990 with the new rule system.
- Version 3 appeared in 1991 and added support for multiple
- storage managers, an improved query executor, and a
- rewritten rewrite rule system. For the most part,
- releases since then have focused on portability and
- reliability.
-
-
-
Postgres has been used to implement many different
- research and production applications. These include: a
- financial data analysis system, a jet engine
- performance monitoring package, an asteroid tracking
- database, a medical information database, and several
- geographic information systems.
Postgres has also been
- used as an educational tool at several universities.
- Finally,
Illustra Information Technologies picked up
- the code and commercialized it.
-
Postgres became the primary data manager for the
- scientific computing project in late 1992.
- Furthermore, the size of the external user community
- nearly doubled during 1993. It became increasingly
- obvious that maintenance of the prototype code and
- support was taking up large amounts of time that should
- have been devoted to database research. In an effort
- to reduce this support burden, the project officially
- ended with Version 4.2.
-
-
-
-
-
-In 1994,
-and
-added a SQL language interpreter to
Postgres , and the code was subsequently released to
-the Web to find its own way in the world.
Postgres95 was a public-domain, open source descendant
-of this original Berkeley code.
-
-
-
Postgres95 is a derivative of the last official release
- of
Postgres (version 4.2). The code is now completely
- ANSI C and the code size has been trimmed by 25%. There
- are a lot of internal changes that improve performance
- and code maintainability.
Postgres95 v1.0.x runs about 30-50%
- faster on the Wisconsin Benchmark compared to v4.2.
- Apart from bug fixes, these are the major enhancements:
-
-
-
- The query language
Postquel has been replaced with
-
SQL (implemented in the server). We do not yet support
- subqueries (which can be imitated with user defined
-
SQL functions). Aggregates have been
- re-implemented. We also added support for ``GROUP BY''.
- The
libpq interface is still available for
C
- programs.
-
-
-
- In addition to the monitor program, we provide a new
- program (
psql ) which supports
GNU readline .
-
-
-
- We added a new front-end library, libpgtcl , that
- supports
Tcl -based clients. A sample shell,
- pgtclsh, provides new Tcl commands to interface
tcl
- programs with the
Postgres95 backend.
-
-
-
- The large object interface has been overhauled. We
- kept Inversion large objects as the only mechanism
- for storing large objects. (This is not to be
- confused with the Inversion file system which has been
- removed.)
-
-
-
- The instance-level rule system has been removed.
- Rules are still available as rewrite rules.
-
-
-
- A short tutorial introducing regular
SQL features as
- well as those of ours is distributed with the source
- code.
-
-
-
-
GNU make (instead of
BSD make) is used for the
- build. Also,
Postgres95 can be compiled with an
- unpatched
gcc (data alignment of doubles has been
- fixed).
-
-
-
-
-
-
-
-
-By 1996, it became clear that the name Postgres95
would not stand
-the test of time. A new name,
PostgreSQL , was chosen to reflect the
-relationship between original
Postgres and the more recent
-versions with
SQL capability. At the same time, the version numbering
-was reset to start at 6.0, putting the numbers back into the sequence originally begun by
-
-The emphasis on development for the v1.0.x releases of
Postgres95
-was on stabilizing the backend code.
-With the v6.x series of
PostgreSQL , the emphasis has shifted from
-identifying and understanding existing problems in the backend to augmenting features and capabilities, although
-work continues in all areas.
-
-Major enhancements include:
-
-
-
-Important backend features, including subselects, defaults, constraints, and triggers, have been implemented.
-
-
-
-Additional
SQL92 -compliant language features have been added,
- including primary keys, quoted identifiers, literal string type coersion, type casting,
- and binary and hexadecimal integer input.
-
-
-
-Built-in types have been improved, including new wide-range date/time types and additional geometric type support.
-
-
-
-Overall backend code speed has been increased by approximately 20%, and backend startup time has decreased 80%.
-
-
-
-
-
-
-
-
About This Release
-
- From now on, We will use
Postgres to mean
PostgreSQL .
-
-
PostgreSQL is available without cost. This manual
- describes version 6.3 of
PostgreSQL .
-
-Check the Administrator's Guide for a list of currently supported machines. In general,
-
PostgreSQL is portable to any Unix/Posix-compatible system
-with full libc library support.
-
-
-
Resources
+&history;
-This manual set is organized into several parts:
+&about;
-
-
-Tutorial
-
-An introduction for new users. Does not cover advanced features.
-
-
-
+&info;
-
-User's Guide
-
-General information for users, including available commands and data types.
-
-
-
-
-
-Programmer's Guide
-
-Advanced information for application programmers. Topics include
-type and function extensibility, library interfaces, and application design issues.
-
-
-
-
-
-Administrator's Guide
-
-Installation and management information. List of supported machines.
-
-
-
-
-
-Developer's Guide
-
-Information for
Postgres developers. This is intended
-for those who are contributing to the
Postgres
-project; application development information should appear in the Programmer's Guide.
-
-
-
-
-
-Reference Manual
-
-Detailed reference information on command syntax.
-At the moment, this manual is very sparse, but eventually should contain
-information similar to that in the man pages.
-
-
-
-
-
-In addition to this manual set, there are other resources to help you with
-
Postgres installation and use:
-
-
-
-man pages
-
-The man pages have general information on command syntax.
-
-
-
-
-
-FAQs
-
-The Frequently Asked Questions (FAQ) documents address both general issues
-and some platform-specific issues.
-
-
-
-
-
-READMEs
-
-README files are available for some contributed packages.
-
-
-
-
-
-Web Site
-
-The
Postgres web site has some information
-not appearing in the distribution. There is a
mhonarc catalog of mailing list traffic
-which is a rich resource for many topics.
-
-
-
-
-
-Mailing Lists
-
-mailing list is a good place to have user questions answered. Other mailing lists are available; consult
-the web page for details.
-
-
-
-
-
-Yourself!
-
-
Postgres is an open source product. As such, it depends on the user community for
-ongoing support. As you begin to use
Postgres , you will rely on others
-for help, either through the documentation or through the mailing lists. Consider contributing your
-knowledge back. If you learn something which is not in the documentation, write it up and contribute it.
-If you add features to the code, contribute it. Even those without a lot of experience can provide
-corrections and minor changes in the documentation, and that is a good way to start.
-The
Postgres Documentation
-mailing list is the place to get going.
-
-
-
-
-
-
-
-
-
Copyrights and Trademarks
-
-
PostgreSQL is copyright (C) 1996-8 by the PostgreSQL Global Development Group,
-and is distributed under the terms of the Berkeley license.
-
-
Postgres95 is copyright (C) 1994-5 by the Regents of the University of California.
-Permission to use, copy, modify, and distribute this software and its documentation
-for any purpose, without fee, and without a written agreement is hereby granted,
-provided that the above copyright notice and this paragraph and the following two
-paragraphs appear in all copies.
-
-In no event shall the University of California be liable to
-any party for direct, indirect, special, incidental, or consequential
-damages, including lost profits, arising out of the use of this
-software and its documentation, even if the University of California
-has been advised of the possibility of such damage.
-
-The University of California specifically disclaims any
-warranties, including, but not limited to, the implied warranties
-of merchantability and fitness for a particular purpose.
-The software provided hereunder is on an "as-is" basis, and
-the University of California has no obligations to provide
-maintainance, support, updates, enhancements, or modifications.
-
-
-
UNIX is a trademark of X/Open, Ltd. Sun4, SPARC, SunOS
-and Solaris are trademarks of Sun Microsystems, Inc. DEC,
-DECstation, Alpha AXP and ULTRIX are trademarks of Digital
-Equipment Corp. PA-RISC and HP-UX are trademarks of
-Hewlett-Packard Co. OSF/1 is a trademark of the Open
-Software Foundation.
-
+&legal;
--- /dev/null
+
+
Copyrights and Trademarks
+
+
PostgreSQL is copyright (C) 1996-8
+by the PostgreSQL Global Development Group,
+and is distributed under the terms of the Berkeley license.
+
+
Postgres95 is copyright (C) 1994-5
+by the Regents of the University of California.
+Permission to use, copy, modify, and distribute this software and its documentation
+for any purpose, without fee, and without a written agreement is hereby granted,
+provided that the above copyright notice and this paragraph and the following two
+paragraphs appear in all copies.
+
+In no event shall the University of California be liable to
+any party for direct, indirect, special, incidental, or consequential
+damages, including lost profits, arising out of the use of this
+software and its documentation, even if the University of California
+has been advised of the possibility of such damage.
+
+The University of California specifically disclaims any
+warranties, including, but not limited to, the implied warranties
+of merchantability and fitness for a particular purpose.
+The software provided hereunder is on an "as-is" basis, and
+the University of California has no obligations to provide
+maintainance, support, updates, enhancements, or modifications.
+
+
+
UNIX is a trademark of X/Open, Ltd. Sun4, SPARC, SunOS
+and Solaris are trademarks of Sun Microsystems, Inc. DEC,
+DECstation, Alpha AXP and ULTRIX are trademarks of Digital
+Equipment Corp. PA-RISC and HP-UX are trademarks of
+Hewlett-Packard Co. OSF/1 is a trademark of the Open
+Software Foundation.
+
--- /dev/null
+
+
Terminology
+
+In the following documentation,
+site
+may be interpreted as the host machine on which
+Since it is possible to install more than one set of
+databases on a single host, this term more precisely denotes any
+particular set of installed
+
Postgres binaries and databases.
+
+The
+is the user named postgres
+binaries and database files. As the database super-user, all
+protection mechanisms may be bypassed and any data accessed
+arbitrarily.
+In addition, the
Postgres super-user is allowed to execute
+some support programs which are generally not available to all users.
+Note that the
Postgres super-user is
+not
+the same as the Unix super-user (root ),
+and should have a non-zero userid for security reasons.
+
+The
+database base administrator
+or
DBA , is the person who is responsible for installing
+
Postgres with mechanisms to
+enforce a security policy for a site. The DBA can add new users by
+the method described below
+and maintain a set of template databases for use by
+
+is the process that acts as a clearing-house for requests
+Frontend applications connect to the
postmaster ,
+which keeps tracks of any system errors and communication between the
+backend processes. The
postmaster
+can take several command-line arguments to tune its behavior.
+However, supplying arguments is necessary only if you intend to run multiple
+sites or a non-default site.
+
+(the actual executable program
postgres ) may be executed
+directly from the user shell by the
+(with the database name as an argument). However,
+doing this bypasses the shared buffer pool and lock table associated
+with a postmaster/site, therefore this is not recommended in a multiuser
+site.
+
+
+
Notation
+
+...
at the front of a file name is used to represent the
+path to the
Postgres super-user's home directory.
+Anything in brackets
+[
and ]
) is optional. Anything in braces
+({
and }
) can be repeated 0 or more times.
+Parentheses ((
and )
) are used to group boolean
+expressions. |
is the boolean operator OR.
+
+
\ No newline at end of file
1998-08-25
+
ODBC Interface
+
+
Lexical Precedence
+
+Operators have a precedence which is currently hardcoded into the parser.
+Most operators have the same precedence and are non-associative. This may lead
+to non-intuitive behavior; for example the boolean operators "<" and ">"
+have a different precedence that the boolean operators "<=" and ">=".
+
+
+
+Operator Ordering (decreasing precedence)
+
+
+
+
+|
+
+Element
+
+Precedence
+
+Description
+
+
+
+|
+
+UNION
+
+left
+
+SQL select construct
+|
+
+::
+
+
+
+|
+
+[ ]
+
+left
+
+array delimiters
+
+|
+
+.
+
+left
+
+table/column delimiter
+
+|
+
+-
+
+right
+
+unary minus
+
+|
+
+;
+
+left
+
+statement termination, logarithm
+
+|
+
+:
+
+right
+
+exponentiation
+
+|
+
+|
+
+left
+
+start of interval
+
+|
+
+* /
+
+left
+
+multiplication, division
+
+|
+
++ -
+
+left
+
+addition, subtraction
+
+|
+
+IS
+
+
+test for TRUE, FALSE, NULL
+|
+
+ISNULL
+
+
+test for NULL
+
+|
+
+NOTNULL
+
+
+test for NOT NULL
+
+|
+
+(all other operators)
+
+
+native and user-defined
+
+|
+
+IN
+
+
+set membership
+
+|
+
+BETWEEN
+
+
+containment
+
+|
+
+LIKE
+
+
+string pattern matching
+
+|
+
+< >
+
+
+boolean inequality
+
+|
+
+=
+
+right
+
+equality
+
+|
+
+NOT
+
+right
+
+negation
+
+|
+
+AND
+
+left
+
+logical intersection
+
+|
+
+OR
+
+left
+
+logical union
+
+
+
+
General Operators
%allfiles;
+
+
Installation and maintenance information.
+&intro-ag;
&ports;
&install;
&start-ag;
-
+
+
-
+
+
+
+
+
+
+
]>
-
+
-
PostgreSQL is copyright (C) 1998 by the Postgres Global Development Group.
+
PostgreSQL is copyright (C) 1998
+by the Postgres Global Development Group.
-This chapter must go into depth on each area of the query language. Currently a copy of the tutorial.
+This chapter must go into depth on each area of the query language.
+Currently a copy of the tutorial.
- thomas 1998-01-12
has many extensions such as an extensible type system,
inheritance, functions and production rules. Those are
- features carried over from the original
Postgres query
- language,
PostQuel . This section provides an overview
- of how to use
Postgres SQL to perform simple operations.
+ features carried over from the original
Postgres
+query
+This section provides an overview
+ of how to use
Postgres SQL
+ to perform simple operations.
This manual is only intended to give you an idea of our
flavor of
SQL and is in no way a complete tutorial on
SQL . Numerous books have been written on
SQL . For
- instance, consult <Ulink url="refs.html#MELT93">[MELT93]> or
- <Ulink url="refs.html#DATE93">[DATE93]>. You should also
- be aware that some features
are not part of the ANSI >
- standard.
+ instance, consult <xref linkend="MELT93" endterm="MELT93-full" > or
+ <xref linkend="DATE97" endterm="DATE97-full" >. You should also
+ be aware that some features
of Postgres >
+
are not part of the ANSI standard.
Concepts
- The fundamental notion in
Postgres is that of a class,
+ The fundamental notion in
Postgres
+is that of a class,
which is a named collection of object instances. Each
instance has the same collection of named attributes,
and each attribute is of a specific type. Furthermore,
- each instance has a permanent
object identifier (
OID )
+ each instance has a permanent object
that is unique throughout the installation. Because
SQL syntax refers to tables, we will use the terms
table and class interchangeably.
Likewise, an
SQL row is an
-
instance and
SQL columns
+columns
are attributes .
As previously discussed, classes are grouped into
databases, and a collection of databases managed by a
--- /dev/null
+
+
Runtime Environment
+
+This chapter outlines the interaction between
Postgres and
+the operating system.
+
+
+
Using Postgres from Unix
+
+All
Postgres commands that are executed
+directly from a Unix shell are
+found in the directory .../bin
. Including this directory in
+your search path will make executing the commands easier.
+
+A collection of system catalogs exist at each site. These include a
+class (pg_user ) that contains an instance for each valid
+
Postgres user. The instance specifies a set of
+
Postgres privileges, such as
+the ability to act as
Postgres super-user,
+ the ability to create/destroy
+databases, and the ability to update the system catalogs. A Unix
+user cannot do anything with
Postgres
+until an appropriate instance is
+installed in this class. Further information on the system catalogs
+is available by running queries on the appropriate classes.
+
+
+
System Layout
+
+
+![]()
+
+
+
+shows how the
Postgres distribution is laid
+ out when installed in the default way. For simplicity,
+ we will assume that
Postgres
+ has been installed in the
+ directory /usr/local/pgsql . Therefore, wherever
+ you see the directory /usr/local/pgsql you should
+ substitute the name of the directory where
+ actually installed.
+ All
Postgres commands are installed
+ in the directory
+ /usr/local/pgsql/bin . Therefore, you should add
+ this directory to your shell command path. If you use
+ a variant of the Berkeley C shell, such as csh or tcsh,
+ you would add
+set path = ( /usr/local/pgsql/bin path )
+
+ in the .login file in your home directory. If you use
+ a variant of the Bourne shell, such as sh, ksh, or
+ bash, then you would add
+PATH=/usr/local/pgsql/bin PATH
+export PATH
+
+ to the .profile file in your home directory.
+ From now on, we will assume that you have added the
+
Postgres bin directory to your path.
+ In addition, we
+ will make frequent reference to "setting a shell
+ variable" or "setting an environment variable" throughout
+ this document. If you did not fully understand the
+ last paragraph on modifying your search path, you
+ should consult the UNIX manual pages that describe your
+ shell before going any further.
+
+
+If you have not set things up in the
+default way, you may have some more work to do.
+For example, if the database server machine is a remote machine, you
+will need to set the PGHOST environment variable to the name
+of the database server machine. The environment variable
+PGPORT may also have to be set. The bottom line is this: if
+you try to start an application program and it complains
+that it cannot connect to the
postmaster ,
+you must go back and make sure that your
+environment is properly set up.
+
+
+
--- /dev/null
+
+
Security
+
+
+
+
User Authentication
+
+Authentication
+is the process by which the backend server and
+ensure that the user requesting access to data is in fact who he/she
+claims to be.
+All users who invoke
Postgres are checked against the
+contents of the pg_user class to ensure that they are
+authorized to do so. However, verification of the user's actual
+identity is performed in a variety of ways:
+
+
+
+
+From the user shell
+
+
+A backend server started from a user shell notes the user's (effective)
+user-id before performing a
+setuid
+to the user-id of user postgres .
+The effective user-id is used
+as the basis for access control checks. No other authentication is
+conducted.
+
+
+
+From the network
+
+
+If the
Postgres system is built as distributed,
+ access to the Internet TCP port of the
+process is available to anyone. The DBA configures the pg_hba.conf file
+in the PGDATA directory to specify what authentication system is to be used
+according to the host making the connection and which database it is
+connecting to. See pg_hba.conf(5)
+ for a description of the authentication
+systems available. Of course, host-based authentication is not fool-proof in
+Unix, either. It is possible for determined intruders to also
+masquerade the origination host. Those security issues are beyond the
+
+
+
+
+
+
Access Control
+
+
Postgres provides mechanisms to allow users
+to limit the access to their data that is provided to other users.
+
+
+
+
+Database superusers
+
+
+Database super-users (i.e., users who have pg_user.usesuper
+set) silently bypass all of the access controls described below with
+two exceptions: manual system catalog updates are not permitted if the
+user does not have pg_user.usecatupd set, and destruction of
+system catalogs (or modification of their schemas) is never allowed.
+
+
+
+Access Privilege
+
+
+The use of access privilege to limit reading, writing and setting
+of rules on classes is covered in
+grant/revoke(l) .
+
+
+
+Class removal and schema modification
+
+
+Commands that destroy or modify the structure of an existing class,
+such as alter ,
+drop table ,
+and
+drop index ,
+only operate for the owner of the class. As mentioned above, these
+operations are never
+permitted on system catalogs.
+
+
+
+
+
Functions and Rules
+
+Functions and rules allow users to insert code into the backend server
+that other users may execute without knowing it. Hence, both
+mechanisms permit users to trojan horse
+others with relative impunity. The only real protection is tight
+control over who can define functions (e.g., write to relations with
+SQL fields) and rules. Audit trails and alerters on
+pg_class , pg_user
+ and pg_group are also recommended.
+
+
+
Functions
+
+Functions written in any language except SQL
+run inside the backend server
+process with the permissions of the user postgres (the
+backend server runs with its real and effective user-id set to
+postgres . It is possible for users to change the server's
+internal data structures from inside of trusted functions. Hence,
+among many other things, such functions can circumvent any system
+access controls. This is an inherent problem with user-defined C functions.
+
+
+
Rules
+
+Like SQL functions, rules always run with the identity and
+permissions of the user who invoked the backend server.
+
+
+
+Caveats
+
+
+There are no plans to explicitly support encrypted data inside of
+(though there is nothing to prevent users from encrypting
+data within user-defined functions). There are no plans to explicitly
+support encrypted network connections, either, pending a total rewrite
+of the frontend/backend protocol.
+User names, group names and associated system identifiers (e.g., the
+contents of pg_user.usesysid ) are assumed to be unique
+throughout a database. Unpredictable results may occur if they are
+not.
+
+
\ No newline at end of file
- - thomas 1998-02-24
-->
-
-
Runtime Environment
-
-
-![]()
-
-
-
-shows how the
Postgres distribution is laid
- out when installed in the default way. For simplicity,
- we will assume that
Postgres has been installed in the
- directory /usr/local/pgsql . Therefore, wherever
- you see the directory /usr/local/pgsql you should
- substitute the name of the directory where
Postgres is
- actually installed.
- All
Postgres commands are installed in the directory
- /usr/local/pgsql/bin . Therefore, you should add
- this directory to your shell command path. If you use
- a variant of the Berkeley C shell, such as csh or tcsh,
- you would add
-set path = ( /usr/local/pgsql/bin path )
-
- in the .login file in your home directory. If you use
- a variant of the Bourne shell, such as sh, ksh, or
- bash, then you would add
-PATH=/usr/local/pgsql/bin PATH
-export PATH
-
- to the .profile file in your home directory.
- From now on, we will assume that you have added the
-
Postgres bin directory to your path. In addition, we
- will make frequent reference to "setting a shell
- variable" or "setting an environment variable" throughout
- this document. If you did not fully understand the
- last paragraph on modifying your search path, you
- should consult the UNIX manual pages that describe your
- shell before going any further.
-
-
-If your site administrator has not set things up in the
-default way, you may have some more work to do. For example, if the database server machine is a remote machine, you
-will need to set the
PGHOST environment variable to the name
-of the database server machine. The environment variable
-
PGPORT may also have to be set. The bottom line is this: if
-you try to start an application program and it complains
-that it cannot connect to the
postmaster , you should immediately consult your site administrator to make sure that your
-environment is properly set up.
-
-
-
-
Locale Support
-
-
-Written by Oleg Bartunov.
- for additional information on locale and Russian language support.
-
-
-
-While doing a project for a company in Moscow, Russia, I encountered the problem that postgresql had no
-support of national alphabets. After looking for possible workarounds I decided to develop support of locale myself.
-I'm not a C-programer but already had some experience with locale programming when I work with perl
-(debugging) and glimpse. After several days of digging through
- the
Postgres source tree I made very minor corections to
-src/backend/utils/adt/varlena.c and src/backend/main/main.c and got what I needed! I did support only for
-LC_CTYPE and LC_COLLATE, but later LC_MONETARY was added by others. I got many
-messages from people about this patch so I decided to send it to developers and (to my surprise) it was
-incorporated into postgresql distribution.
-
- People often complain that locale doesn't work for them. There are several common mistakes:
-
-
-
- Didn't properly configure postgresql before compilation.
- You must run configure with --enable-locale option to enable locale support.
- Didn't setup environment correctly when starting postmaster.
- You must define environment variables $LC_CTYPE and $LC_COLLATE before running postmaster
- because backend gets information about locale from environment. I use following shell script
- (runpostgres):
-
- #!/bin/sh
-
- export LC_CTYPE=koi8-r
- export LC_COLLATE=koi8-r
- postmaster -B 1024 -S -D/usr/local/pgsql/data/ -o '-Fe'
-
-
- and run it from rc.local as
-
- /bin/su - postgres -c "/home/postgres/runpostgres"
-
-
-
-
-
- Broken locale support in OS (for example, locale support in libc under Linux several times has changed
- and this caused a lot of problems). Latest perl has also support of locale and if locale is broken perl -v will
- complain something like:
-
- 8:17[mira]:~/WWW/postgres>setenv LC_CTYPE not_exist
- 8:18[mira]:~/WWW/postgres>perl -v
- perl: warning: Setting locale failed.
- perl: warning: Please check that your locale settings:
- LC_ALL = (unset),
- LC_CTYPE = "not_exist",
- LANG = (unset)
- are supported and installed on your system.
- perl: warning: Falling back to the standard locale ("C").
-
-
-
-
-
- Wrong location of locale files!
-
- Possible locations include: /usr/lib/locale (Linux, Solaris), /usr/share/locale (Linux), /usr/lib/nls/loc (DUX 4.0)
- Check man locale to find the correct location.
-Under Linux I did a symbolic link between /usr/lib/locale and
- /usr/share/locale to be sure that the next libc will not break my locale.
-
-
-
-
-
-
What are the Benefits?
-
-You can use ~* and order by operators for strings contain characters from national alphabets. Non-english users
-definitely need that. If you won't use locale stuff just undefine the USE_LOCALE variable.
-
-
-
What are the Drawbacks?
-
-There is one evident drawback of using locale - it's speed! So, use locale only if you really need it.
-
-
-
- Nothing can happen to a database unless the
postmaster
+ Nothing can happen to a database unless the
process is running. As the site administrator, there
are a number of things you should remember before
- starting the
postmaster . These are discussed in the
- section of this manual titled, "Administering Postgres."
+ starting the
postmaster .
+These are discussed in the installation and configuration sections
+of this manual.
However, if
Postgres has been installed by following
the installation instructions exactly as written, the
following simple command is all you should
% postmaster
- The
postmaster occasionally prints out messages which
+ The
postmaster occasionally prints out
+messages which
are often helpful during troubleshooting. If you wish
- to view debugging messages from the
postmaster , you can
+ to view debugging messages from the
postmaster ,
+you can
start it with the -d option and redirect the output to
the log file:
% postmaster -S
- and the
postmaster will be "S"ilent. Notice that there
+ and the
postmaster will be "S"ilent.
+Notice that there
is no ampersand ("&") at the end of the last example.
createuser enables specific users to access
-
Postgres .
destroyuser removes users and
- prevents them from accessing
Postgres . Note that these
- commands only affect users with respect to
Postgres ;
+
destroyuser removes users and
+ prevents them from accessing
Postgres .
+Note that these
+ commands only affect users with respect to
they have no effect on users other privileges or status with regards
to the underlying
operating system.
-Usually, you will want to define this variable in the
Postgres superuser's
+Usually, you will want to define this variable in the
.profile
or
.cshrc
Assuming that your site administrator has properly
- started the
postmaster process and authorized you to
+ started the
postmaster process
+and authorized you to
use the database, you (as a user) may begin to start up
applications. As previously mentioned, you should add
/usr/local/pgsql/bin to your shell search path.
terms of preparation.
- If you get the following error message from a
Postgres
- command (such as
psql or
createdb ):
+ If you get the following error message from a
+ command (such as
psql or
-connectDB() failed: Is the postmaster running at 'localhost' on port '432 2'?
+connectDB() failed: Is the postmaster running at 'localhost' on port '543 2'?
it is usually because either the
postmaster is not running,
or you are attempting to connect to the wrong server host.
Managing a Database
- Now that
Postgres is up and running we can create
some
- databases to experiment with. Here, we describe the
+ Now that
Postgres is up and running we can create
+ some databases to experiment with. Here, we describe the
basic commands for managing a database.
% createdb mydb
-
Postgres allows you to create any number of databases
+
Postgres allows you to create
+any number of databases
at a given site and you automatically become the
- database administrator of the database you just created. Database names must have an alphabetic first
+ database administrator of the database you just created.
+Database names must have an alphabetic first
character and are limited to 16 characters in length.
Not every user has authorization to become a database
- administrator. If
Postgres refuses to create databases
+ administrator. If
Postgres
+refuses to create databases
for you, then the site administrator needs to grant you
permission to create databases. Consult your site
administrator if this occurs.
-running the
Postgres terminal monitor program
s (
-
monitor or psql ) which allows you to interactively
+running the
Postgres terminal monitor program
+
( psql ) which allows you to interactively
enter, edit, and execute
SQL commands.
- writing a C program using the LIBPQ subroutine
+ writing a C program using the libpq subroutine
library. This allows you to submit
SQL commands
from C and get answers and status messages back to
your program. This interface is discussed further
- in section ?? .
+ in the PostgreSQL Programmer's Guide .
- You might want to start up
psql , to try out the examples in this manual. It can be activated for the mydb
+ You might want to start up
psql ,
+to try out the examples in this manual. It can be activated for the mydb
database by typing the command:
% psql mydb
-This prompt indicates that the terminal monitor is listening to you and that you can type
SQL queries into a
+This prompt indicates that the terminal monitor is listening
+to you and that you can type
SQL queries into a
workspace maintained by the terminal monitor.
- The
psql program responds to escape codes that begin
+ The
psql program responds to escape
+ codes that begin
with the backslash character, "\". For example, you
- can get help on the syntax of various
Postgres SQL commands by typing:
+ can get help on the syntax of various
+
Postgres SQL commands by typing:
mydb=> \h
This tells the server to process the query. If you
terminate your query with a semicolon, the backslash-g is not
- necessary.
psql will automatically process semicolon terminated queries.
+ necessary.
psql will automatically
+process semicolon terminated queries.
To read queries from a file, say myFile, instead of
entering them interactively, type:
mydb=> \q
- and
psql will quit and return you to your command
+ and
psql will quit and return
+you to your command
shell. (For more escape codes, type backslash-h at the monitor
prompt.)
White space (i.e., spaces, tabs and newlines) may be
- used freely in
SQL queries. Single-line comments are denoted by
+ used freely in
SQL queries.
+Single-line comments are denoted by
--
. Everything after the dashes up to the end of the
line is ignored. Multiple-line comments, and comments within a line,
are denoted by /* ... */
--- /dev/null
+
+
SQL Syntax
+
+
+
Key Words
+
+
SQL92 defines
key words for the language
+which have specific meaning. Some key words are
+reserved , which indicates that they are
+restricted to appear in only certain contexts. Other key words are
+not restricted , which indicates that in certain contexts they
+have a specific meaning but are not otherwise constrained.
+
+
Postgres implements an extended subset of the
+
SQL92 and
SQL3 languages. Some language
+elements are not as restricted in this implementation as is
+called for in the language standards, in part due
+to the extensibility features of
Postgres .
+
+Information on
SQL92 and
SQL3 key words
+is derived from .
+
+
+
Reserved Key Words
+
+reserved key words which are not allowed
+as identifiers and not allowed in any usage other than as fundamental
+tokens in
SQL statements.
+
Postgres has additional key words
+which have similar restrictions. In particular, these key words
+are not allowed as column or table names, though in some cases
+they are allowed to be column labels (i.e. in AS clauses).
+
+
+Any string can be specified as an identifier if surrounded by
+double quotes (like this!
). Some care is required since
+such an identifier will be case sensitive
+and will retain embedded whitespace.
+
+
+The following are
Postgres
+reserved words which are neither
SQL92
+nor
SQL3 reserved words. These are allowed
+to be present as column labels, but not as identifiers:
+
+ABORT ANALYZE
+BINARY
+CLUSTER CONSTRAINT COPY
+DO
+EXPLAIN EXTEND
+LISTEN LOAD LOCK
+MOVE
+NEW NONE NOTIFY
+RESET
+SETOF SHOW
+UNLISTEN UNTIL
+VACUUM VERBOSE
+
+
+The following are
Postgres
+reserved words which are also
SQL92
+or
SQL3 reserved words, and which
+are allowed to be present as column labels, but not as identifiers:
+
+CROSS CURRENT
+FALSE FOREIGN
+GROUP
+ORDER
+POSITION PRECISION
+TABLE TRANSACTION TRUE
+
+
+The following are
Postgres
+reserved words which are also
SQL92
+
+ADD ALL ALTER AND ANY AS ASC
+BEGIN BETWEEN BOTH BY
+CASCADE CAST CHAR CHARACTER CHECK CLOSE COLLATE COLUMN COMMIT
+CONSTRAINT CREATE CURRENT_DATE CURRENT_TIME
+CURRENT_TIMESTAMP CURRENT_USER CURSOR
+DECIMAL DECLARE DEFAULT DELETE DESC DISTINCT DROP
+END EXECUTE EXISTS EXTRACT
+FETCH FLOAT FOR FROM FULL
+GRANT
+HAVING
+IN INNER INSERT INTERVAL INTO IS
+JOIN
+LEADING LEFT LIKE LOCAL
+NAMES NATIONAL NATURAL NCHAR NO NOT NULL NUMERIC
+ON OR OUTER
+PARTIAL PRIMARY PRIVILEGES PROCEDURE PUBLIC
+REFERENCES REVOKE RIGHT ROLLBACK
+SELECT SET SUBSTRING
+TIMESTAMP TO TRAILING TRIM
+UNION UNIQUE UPDATE USER USING
+VALUES VARCHAR VARYING VIEW
+WHERE WITH WORK
+
+
+The following are
SQL92 reserved key words which
+are not
Postgres reserved key words, but which
+if used as function names are always translated into the function
+length :
+
+CHAR_LENGTH CHARACTER_LENGTH
+
+
+The following are
SQL92 or
SQL3
+reserved key words which
+are not
Postgres reserved key words, but
+if used as type names which are always translated into an alternate, native type:
+
+BOOLEAN DOUBLE FLOAT INT INTEGER INTERVAL REAL SMALLINT
+
+
+The following are either
SQL92
+or
SQL3 reserved key words
+which are not key words in
Postgres .
+These have no proscribed usage in
Postgres
+at the time of writing (v6.4) but may become reserved key words in the
+future:
+
+
+Some of these key words represent functions in
SQL92 .
+These functions are defined in
Postgres ,
+but the parser does not consider the names to be key words and they are allowed
+in other contexts.
+
+
+ALLOCATE ARE ASSERTION AT AUTHORIZATION AVG
+BIT BIT_LENGTH
+CASCADED CASE CATALOG COALESCE COLLATION
+CONNECT CONNECTION CONSTRAINTS CONTINUE CONVERT CORRESPONDING COUNT
+DATE DEALLOCATE DEC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DOMAIN
+ELSE END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXTERNAL
+FIRST FOUND
+GET GLOBAL GO GOTO
+IDENTITY IMMEDIATE INDICATOR INITIALLY INPUT INTERSECT ISOLATION
+LAST LEVEL LOWER
+MAX MIN MODULE
+NULLIF
+OCTET_LENGTH OPEN OUTPUT OVERLAPS
+PREPARE PRESERVE
+RESTRICT ROWS
+SCHEMA SECTION SESSION SESSION_USER SIZE SOME
+SQL SQLCODE SQLERROR SQLSTATE SUM SYSTEM_USER
+TEMPORARY THEN TRANSLATE TRANSLATION
+UNKNOWN UPPER USAGE
+VALUE
+WHEN WHENEVER WRITE
+
+
+
+
Non-reserved Keywords
+
+non-reserved keywords which have
+a proscribed meaning in the language but which are also allowed
+as identifiers.
+
Postgres has additional keywords
+which allow similar unrestricted usage.
+In particular, these keywords
+are allowed as column or table names.
+
+The following are
Postgres
+non-reserved key words which are neither
SQL92
+nor
SQL3 non-reserved key words:
+
+AFTER AGGREGATE
+BACKWARD BEFORE
+CACHE CREATEDB CREATEUSER CYCLE
+DATABASE DELIMITERS
+EACH ENCODING
+FORWARD FUNCTION
+HANDLER
+INCREMENT INDEX INHERITS INSENSITIVE INSTEAD ISNULL
+LANCOMPILER LOCATION
+MAXVALUE MINVALUE
+NOCREATEDB NOCREATEUSER NOTHING NOTNULL
+OIDS OPERATOR
+PASSWORD PROCEDURAL
+RECIPE RENAME RETURNS ROW RULE
+SEQUENCE SERIAL START STATEMENT STDIN STDOUT
+TRUSTED
+VALID VERSION
+
+
+The following are
Postgres
+non-reserved key words which are
SQL92
+or
SQL3 reserved key words:
+
+ABSOLUTE ACTION
+DAY
+HOUR
+INSENSITIVE
+KEY
+LANGUAGE
+MATCH MINUTE MONTH
+NEXT
+OF ONLY OPTION
+PRIOR PRIVILEGES
+READ RELATIVE
+SCROLL SECOND
+TIME TIMEZONE_HOUR TIMEZONE_MINUTE TRIGGER
+YEAR
+ZONE
+
+
+The following are
Postgres
+non-reserved key words which are also either
SQL92
+or
SQL3 non-reserved key words:
+
+TYPE
+
+
+The following are either
SQL92
+or
SQL3 non-reserved key words which are not
+key words of any kind in
Postgres :
+
+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 DATE_TIME_INTERVAL_CODE DATE_TIME_INTERVAL_PRECISION
+DYNAMIC_FUNCTION
+FORTRAN
+LENGTH
+MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MORE MUMPS
+NAME NULLABLE NUMBER
+PAD PASCAL PLI
+REPEATABLE RETURNED_LENGTH RETURNED_OCTET_LENGTH
+RETURNED_SQLSTATE ROW_COUNT
+SCALE SCHEMA_NAME SERIALIZABLE SERVER_NAME SPACE
+SUBCLASS_ORIGIN
+TABLE_NAME
+UNCOMMITTED UNNAMED
+
+
+
+
+
+
+
+
+
%allfiles;
]>
-
+
&intro;
&environ;
&manage;
+&syntax;
&datatype;
&oper;
&func;