This page in other versions: 8.4 / 9.0 / 9.1 / 9.2 / 9.3  |  Development versions: devel / 9.4  |  Unsupported versions: 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3

PostgreSQL 8.3.23 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. Full Text Search
13. Concurrency Control
14. Performance Tips
III. Server Administration
15. Installation Instructions
16. Installation on Windows
17. Operating System Environment
18. Server Configuration
19. Database Roles and Privileges
20. Managing Databases
21. Client Authentication
22. Localization
23. Routine Database Maintenance Tasks
24. Backup and Restore
25. High Availability, Load Balancing, and Replication
26. Monitoring Database Activity
27. Monitoring Disk Usage
28. Reliability and the Write-Ahead Log
29. Regression Tests
IV. Client Interfaces
30. libpq - C Library
31. Large Objects
32. ECPG - Embedded SQL in C
33. The Information Schema
V. Server Programming
34. Extending SQL
35. Triggers
36. The Rule System
37. Procedural Languages
38. PL/pgSQL - SQL Procedural Language
39. PL/Tcl - Tcl Procedural Language
40. PL/Perl - Perl Procedural Language
41. PL/Python - Python Procedural Language
42. Server Programming Interface
VI. Reference
I. SQL Commands
II. PostgreSQL Client Applications
III. PostgreSQL Server Applications
VII. Internals
43. Overview of PostgreSQL Internals
44. System Catalogs
45. Frontend/Backend Protocol
46. PostgreSQL Coding Conventions
47. Native Language Support
48. Writing A Procedural Language Handler
49. Genetic Query Optimizer
50. Index Access Method Interface Definition
51. GiST Indexes
52. GIN Indexes
53. Database Physical Storage
54. BKI Backend Interface
55. How the Planner Uses Statistics
VIII. Appendixes
A. PostgreSQL Error Codes
B. Date/Time Support
C. SQL Key Words
D. SQL Conformance
E. Release Notes
F. Additional Supplied Modules
G. External Projects
H. The Source Code Repository
I. Documentation
J. Acronyms
Bibliography
Index

Comments


April 2, 2009, 2:40 p.m.

Hi. We're trying to implement two-phase commit and did not find a
complete working example in the manual. We found examples of the
separate pieces, but not the sequence in which to put them together.

Then we found this text,

"PREPARE TRANSACTION is used in place of regular COMMIT to perform
the 1st phase, COMMIT PREPARED and ROLLBACK PREPARED perform the final
2nd phase commit or abort."

I'd like to offer two examples to illustrate that, for possible
inclusion in the manual:

1. Here's the sequence that two-phase commits:

BEGIN;
update mytable set a_col='something' where red_id=1000;
PREPARE TRANSACTION 'foobar';
COMMIT PREPARED 'foobar';

2. Here's the sequence that rolls back, leaving the table unchanged:

BEGIN;
update mytable set a_col='something' where red_id=1000;
PREPARE TRANSACTION 'foobar';
ROLLBACK PREPARED 'foobar';

Examples make new things clearer, and easier to learn.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group