5.8. Inheritance ................................................................................................................ 68
5.8.1. Caveats......................................................................................................... 70
5.9. Partitioning ...............................................................................................................71
5.9.1. Overview...................................................................................................... 71
5.9.2. Implementing Partitioning ...........................................................................72
5.9.3. Managing Partitions..................................................................................... 75
5.9.4. Partitioning and Constraint Exclusion .........................................................76
5.9.5. Alternative Partitioning Methods................................................................. 77
5.9.6. Caveats......................................................................................................... 77
5.10. Foreign Data ........................................................................................................... 78
5.11. Other Database Objects .......................................................................................... 79
5.12. Dependency Tracking............................................................................................. 79
6. Data Manipulation................................................................................................................. 81
6.1. Inserting Data ...........................................................................................................81
6.2. Updating Data...........................................................................................................82
6.3. Deleting Data............................................................................................................83
7. Queries .................................................................................................................................. 84
7.1. Overview ..................................................................................................................84
7.2. Table Expressions .....................................................................................................84
7.2.1. The FROM Clause.......................................................................................... 85
7.2.1.1. Joined Tables ...................................................................................85
7.2.1.2. Table and Column Aliases...............................................................89
7.2.1.3. Subqueries ....................................................................................... 90
7.2.1.4. Table Functions ...............................................................................90
7.2.1.5. LATERAL Subqueries .......................................................................92
7.2.2. The WHERE Clause........................................................................................93
7.2.3. The GROUP BY and HAVING Clauses...........................................................94
7.2.4. Window Function Processing ...................................................................... 96
7.3. Select Lists................................................................................................................ 96
7.3.1. Select-List Items .......................................................................................... 96
7.3.2. Column Labels............................................................................................. 97
7.3.3. DISTINCT ....................................................................................................98
7.4. Combining Queries...................................................................................................98
7.5. Sorting Rows ............................................................................................................99
7.6. LIMIT and OFFSET.................................................................................................100
7.7. VALUES Lists ..........................................................................................................100
7.8. WITH Queries (Common Table Expressions) .........................................................101
7.8.1. SELECT in WITH......................................................................................... 101
7.8.2. Data-Modifying Statements in WITH .........................................................105
8. Data Types...........................................................................................................................107
8.1. Numeric Types........................................................................................................ 108
8.1.1. Integer Types.............................................................................................. 109
8.1.2. Arbitrary Precision Numbers .....................................................................109
8.1.3. Floating-Point Types..................................................................................111
8.1.4. Serial Types................................................................................................ 112
8.2. Monetary Types ......................................................................................................113
8.3. Character Types ......................................................................................................113
8.4. Binary Data Types .................................................................................................. 115
8.4.1. bytea Hex Format.....................................................................................116
8.4.2. bytea Escape Format................................................................................116
8.5. Date/Time Types..................................................................................................... 118
8.5.1. Date/Time Input.........................................................................................119
v