September 26, 2024: PostgreSQL 17 Released!
Supported Versions: Current (17) / 16 / 15 / 14 / 13 / 12
Development Versions: devel
Unsupported versions: 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

PostgreSQL 7.4.30 Documentation

The PostgreSQL Global Development Group


Table of Contents
Preface
What is PostgreSQL?
A Brief History of PostgreSQL
Conventions
Further Information
Bug Reporting Guidelines
I. Tutorial
1. Getting Started
2. The SQL Language
3. Advanced Features
II. The SQL Language
4. SQL Syntax
5. Data Definition
6. Data Manipulation
7. Queries
8. Data Types
9. Functions and Operators
10. Type Conversion
11. Indexes
12. Concurrency Control
13. Performance Tips
III. Server Administration
14. Installation Instructions
15. Installation on Windows
16. Server Run-time Environment
17. Database Users and Privileges
18. Managing Databases
19. Client Authentication
20. Localization
21. Routine Database Maintenance Tasks
22. Backup and Restore
23. Monitoring Database Activity
24. Monitoring Disk Usage
25. Write-Ahead Logging (WAL)
26. Regression Tests
IV. Client Interfaces
27. libpq - C Library
28. Large Objects
29. pgtcl - Tcl Binding Library
30. ECPG - Embedded SQL in C
31. JDBC Interface
32. The Information Schema
V. Server Programming
33. Extending SQL
34. The Rule System
35. Triggers
36. Procedural Languages
37. PL/pgSQL - SQL Procedural Language
38. PL/Tcl - Tcl Procedural Language
39. PL/Perl - Perl Procedural Language
40. PL/Python - Python Procedural Language
41. Server Programming Interface
VI. Reference
I. SQL Commands
II. PostgreSQL Client Applications
III. PostgreSQL Server Applications
VII. Internals
42. Overview of PostgreSQL Internals
43. System Catalogs
44. Frontend/Backend Protocol
45. PostgreSQL Coding Conventions
46. Native Language Support
47. Writing A Procedural Language Handler
48. Genetic Query Optimizer
49. Index Cost Estimation Functions
50. GiST Indexes
51. Page Files
52. BKI Backend Interface
VIII. Appendixes
A. PostgreSQL Error Codes
B. Date/Time Support
C. SQL Key Words
D. SQL Conformance
E. Release Notes
F. The Source Code Repository
G. Documentation
Bibliography
Index
List of Tables
4-1. Operator Precedence (decreasing)
8-1. Data Types
8-2. Numeric Types
8-3. Monetary Types
8-4. Character Types
8-5. Special Character Types
8-6. Binary Data Types
8-7. bytea Literal Escaped Octets
8-8. bytea Output Escaped Octets
8-9. Date/Time Types
8-10. Date Input
8-11. Time Input
8-12. Time Zone Input
8-13. Special Date/Time Inputs
8-14. Date/Time Output Styles
8-15. Date Order Conventions
8-16. Geometric Types
8-17. Network Address Types
8-18. cidr Type Input Examples
8-19. Object Identifier Types
8-20. Pseudo-Types
9-1. Comparison Operators
9-2. Mathematical Operators
9-3. Bit String Bitwise Operators
9-4. Mathematical Functions
9-5. Trigonometric Functions
9-6. SQL String Functions and Operators
9-7. Other String Functions
9-8. Built-in Conversions
9-9. SQL Binary String Functions and Operators
9-10. Other Binary String Functions
9-11. Regular Expression Match Operators
9-12. Regular Expression Atoms
9-13. Regular Expression Quantifiers
9-14. Regular Expression Constraints
9-15. Regular Expression Character-Entry Escapes
9-16. Regular Expression Class-Shorthand Escapes
9-17. Regular Expression Constraint Escapes
9-18. Regular Expression Back References
9-19. ARE Embedded-Option Letters
9-20. Formatting Functions
9-21. Template Patterns for Date/Time Formatting
9-22. Template Pattern Modifiers for Date/Time Formatting
9-23. Template Patterns for Numeric Formatting
9-24. to_char Examples
9-25. Date/Time Operators
9-26. Date/Time Functions
9-27. AT TIME ZONE Variants
9-28. Geometric Operators
9-29. Geometric Functions
9-30. Geometric Type Conversion Functions
9-31. cidr and inet Operators
9-32. cidr and inet Functions
9-33. macaddr Functions
9-34. Sequence Functions
9-35. Session Information Functions
9-36. Configuration Settings Functions
9-37. Access Privilege Inquiry Functions
9-38. Schema Visibility Inquiry Functions
9-39. System Catalog Information Functions
9-40. Comment Information Functions
9-41. array Operators
9-42. array Functions
9-43. Aggregate Functions
12-1. SQL Transaction Isolation Levels
16-1. Short option key
16-2. System V IPC parameters
20-1. Server Character Sets
20-2. Client/Server Character Set Conversions
23-1. Standard Statistics Views
23-2. Statistics Access Functions
29-1. pgtcl Commands
31-1. ConnectionPoolDataSource Implementations
31-2. ConnectionPoolDataSource Configuration Properties
31-3. DataSource Implementations
31-4. DataSource Configuration Properties
31-5. Additional Pooling DataSource Configuration Properties
32-1. information_schema_catalog_name Columns
32-2. applicable_roles Columns
32-3. check_constraints Columns
32-4. column_domain_usage Columns
32-5. column_privileges Columns
32-6. column_udt_usage Columns
32-7. columns Columns
32-8. constraint_column_usage Columns
32-9. constraint_table_usage Columns
32-10. data_type_privileges Columns
32-11. domain_constraints Columns
32-12. domain_udt_usage Columns
32-13. domains Columns
32-14. element_types Columns
32-15. enabled_roles Columns
32-16. key_column_usage Columns
32-17. parameters Columns
32-18. referential_constraints Columns
32-19. role_column_grants Columns
32-20. role_routine_grants Columns
32-21. role_table_grants Columns
32-22. role_usage_grants Columns
32-23. routine_privileges Columns
32-24. routines Columns
32-25. schemata Columns
32-26. sql_features Columns
32-27. sql_implementation_info Columns
32-28. sql_languages Columns
32-29. sql_packages Columns
32-30. sql_sizing Columns
32-31. sql_sizing_profiles Columns
32-32. table_constraints Columns
32-33. table_privileges Columns
32-34. tables Columns
32-35. triggers Columns
32-36. usage_privileges Columns
32-37. view_column_usage Columns
32-38. view_table_usage Columns
32-39. views Columns
33-1. Equivalent C Types for Built-In SQL Types
33-2. B-tree Strategies
33-3. Hash Strategies
33-4. R-tree Strategies
33-5. B-tree Support Functions
33-6. Hash Support Functions
33-7. R-tree Support Functions
33-8. GiST Support Functions
43-1. System Catalogs
43-2. pg_aggregate Columns
43-3. pg_am Columns
43-4. pg_amop Columns
43-5. pg_amproc Columns
43-6. pg_attrdef Columns
43-7. pg_attribute Columns
43-8. pg_cast Columns
43-9. pg_class Columns
43-10. pg_constraint Columns
43-11. pg_conversion Columns
43-12. pg_database Columns
43-13. pg_depend Columns
43-14. pg_description Columns
43-15. pg_group Columns
43-16. pg_index Columns
43-17. pg_inherits Columns
43-18. pg_language Columns
43-19. pg_largeobject Columns
43-20. pg_listener Columns
43-21. pg_namespace Columns
43-22. pg_opclass Columns
43-23. pg_operator Columns
43-24. pg_proc Columns
43-25. pg_rewrite Columns
43-26. pg_shadow Columns
43-27. pg_statistic Columns
43-28. pg_trigger Columns
43-29. pg_type Columns
43-30. System Views
43-31. pg_indexes Columns
43-32. pg_locks Columns
43-33. pg_rules Columns
43-34. pg_settings Columns
43-35. pg_stats Columns
43-36. pg_tables Columns
43-37. pg_user Columns
43-38. pg_views Columns
51-1. Sample Page Layout
51-2. PageHeaderData Layout
51-3. HeapTupleHeaderData Layout
A-1. PostgreSQL Error Codes
B-1. Month Abbreviations
B-2. Day of the Week Abbreviations
B-3. Date/Time Field Modifiers
B-4. Time Zone Abbreviations
B-5. Australian Time Zone Abbreviations
C-1. SQL Key Words
List of Examples
8-1. Using the character types
8-2. Using the boolean type
8-3. Using the bit string types
10-1. Exponentiation Operator Type Resolution
10-2. String Concatenation Operator Type Resolution
10-3. Absolute-Value and Factorial Operator Type Resolution
10-4. Rounding Function Argument Type Resolution
10-5. Substring Function Type Resolution
10-6. character Storage Type Conversion
10-7. Type Resolution with Underspecified Types in a Union
10-8. Type Resolution in a Simple Union
10-9. Type Resolution in a Transposed Union
11-1. Setting up a Partial Index to Exclude Common Values
11-2. Setting up a Partial Index to Exclude Uninteresting Values
11-3. Setting up a Partial Unique Index
19-1. An example pg_hba.conf file
19-2. An example pg_ident.conf file
27-1. libpq Example Program 1
27-2. libpq Example Program 2
27-3. libpq Example Program 3
28-1. Large Objects with libpq Example Program
29-1. pgtcl Example Program
31-1. Processing a Simple Query in JDBC
31-2. Setting fetch size to turn cursors on and off.
31-3. Deleting Rows in JDBC
31-4. Calling a built in stored function
31-5. Getting refcursor values from a function
31-6. Treating refcursor as a distinct type
31-7. Dropping a Table in JDBC
31-8. Processing Binary Data in JDBC
31-9. DataSource Code Example
31-10. DataSource JNDI Code Example
36-1. Manual Installation of PL/pgSQL
37-1. A PL/pgSQL Trigger Procedure
37-2. Porting a Simple Function from PL/SQL to PL/pgSQL
37-3. Porting a Function that Creates Another Function from PL/SQL to PL/pgSQL
37-4. Porting a Procedure With String Manipulation and OUT Parameters from PL/SQL to PL/pgSQL
37-5. Porting a Procedure from PL/SQL to PL/pgSQL