5.8.7. Portability.....................................................................................................74
5.9. Inheritance ................................................................................................................ 74
5.9.1. Caveats.........................................................................................................77
5.10. Partitioning .............................................................................................................78
5.10.1. Overview....................................................................................................78
5.10.2. Implementing Partitioning .........................................................................79
5.10.3. Managing Partitions...................................................................................82
5.10.4. Partitioning and Constraint Exclusion .......................................................82
5.10.5. Alternative Partitioning Methods...............................................................84
5.10.6. Caveats.......................................................................................................84
5.11. Foreign Data ........................................................................................................... 85
5.12. Other Database Objects .......................................................................................... 86
5.13. Dependency Tracking.............................................................................................86
6. Data Manipulation................................................................................................................. 88
6.1. Inserting Data ...........................................................................................................88
6.2. Updating Data........................................................................................................... 89
6.3. Deleting Data............................................................................................................ 90
6.4. Returning Data From Modified Rows ...................................................................... 90
7. Queries .................................................................................................................................. 92
7.1. Overview ..................................................................................................................92
7.2. Table Expressions .....................................................................................................92
7.2.1. The FROM Clause.......................................................................................... 93
7.2.1.1. Joined Tables ...................................................................................93
7.2.1.2. Table and Column Aliases...............................................................97
7.2.1.3. Subqueries ....................................................................................... 98
7.2.1.4. Table Functions ...............................................................................98
7.2.1.5. LATERAL Subqueries .......................................................................99
7.2.2. The WHERE Clause...................................................................................... 101
7.2.3. The GROUP BY and HAVING Clauses......................................................... 101
7.2.4. GROUPING SETS, CUBE, and ROLLUP .......................................................104
7.2.5. Window Function Processing .................................................................... 106
7.3. Select Lists.............................................................................................................. 106
7.3.1. Select-List Items ........................................................................................ 107
7.3.2. Column Labels...........................................................................................107
7.3.3. DISTINCT ..................................................................................................108
7.4. Combining Queries................................................................................................. 108
7.5. Sorting Rows ..........................................................................................................109
7.6. LIMIT and OFFSET.................................................................................................110
7.7. VALUES Lists ..........................................................................................................110
7.8. WITH Queries (Common Table Expressions) .........................................................111
7.8.1. SELECT in WITH.........................................................................................111
7.8.2. Data-Modifying Statements in WITH .........................................................115
8. Data Types........................................................................................................................... 117
8.1. Numeric Types........................................................................................................118
8.1.1. Integer Types.............................................................................................. 119
8.1.2. Arbitrary Precision Numbers .....................................................................119
8.1.3. Floating-Point Types.................................................................................. 121
8.1.4. Serial Types................................................................................................ 122
8.2. Monetary Types ......................................................................................................123
8.3. Character Types ......................................................................................................124
8.4. Binary Data Types .................................................................................................. 126
8.4.1. bytea Hex Format.....................................................................................126
v