PostgreSQL 8.0.1 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
Chapter 43. PostgreSQL Coding Conventions
- Table of Contents
- 43.1. Formatting
- 43.2. Reporting Errors Within the Server
- 43.3. Error Message Style Guide
- 43.3.1. What goes where
- 43.3.2. Formatting
- 43.3.3. Quotation marks
- 43.3.4. Use of quotes
- 43.3.5. Grammar and punctuation
- 43.3.6. Upper case vs. lower case
- 43.3.7. Avoid passive voice
- 43.3.8. Present vs past tense
- 43.3.9. Type of the object
- 43.3.10. Brackets
- 43.3.11. Assembling error messages
- 43.3.12. Reasons for errors
- 43.3.13. Function names
- 43.3.14. Tricky words to avoid
- 43.3.15. Proper spelling
- 43.3.16. Localization
43.1. Formatting
Source code formatting uses 4 column tab spacing, with tabs preserved (i.e. tabs are not expanded to spaces). Each logical indentation level is one additional tab stop. Layout rules (brace positioning, etc) follow BSD conventions.
While submitted patches do not absolutely have to follow these formatting rules, it's a good idea to do so. Your code will get run through pgindent, so there's no point in making it look nice under some other set of formatting conventions.
For Emacs, add the following (or something similar) to your ~/.emacs initialization file:
For vi, your ~/.vimrc or equivalent file should contain the following:
or equivalently from within vi, try
The text browsing tools more and less can be invoked as
to make them show tabs appropriately.