Submit
Path:
~
/
/
opt
/
alt
/
postgresql11
/
usr
/
share
/
doc
/
alt-postgresql11-9.2.24
/
html
/
File Content:
sql-select.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >SELECT</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.2.24 Documentation" HREF="index.html"><LINK REL="UP" TITLE="SQL Commands" HREF="sql-commands.html"><LINK REL="PREVIOUS" TITLE="SECURITY LABEL" HREF="sql-security-label.html"><LINK REL="NEXT" TITLE="SELECT INTO" HREF="sql-selectinto.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2017-11-06T22:43:11"></HEAD ><BODY CLASS="REFENTRY" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.2.24 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="SECURITY LABEL" HREF="sql-security-label.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="sql-commands.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="SELECT INTO" HREF="sql-selectinto.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="SQL-SELECT" ></A >SELECT</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN77583" ></A ><H2 >Name</H2 >SELECT, TABLE, WITH -- retrieve rows from a table or view</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN77595" ></A ><H2 >Synopsis</H2 ><PRE CLASS="SYNOPSIS" >[ WITH [ RECURSIVE ] <TT CLASS="REPLACEABLE" ><I >with_query</I ></TT > [, ...] ] SELECT [ ALL | DISTINCT [ ON ( <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [, ...] ) ] ] * | <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [ [ AS ] <TT CLASS="REPLACEABLE" ><I >output_name</I ></TT > ] [, ...] [ FROM <TT CLASS="REPLACEABLE" ><I >from_item</I ></TT > [, ...] ] [ WHERE <TT CLASS="REPLACEABLE" ><I >condition</I ></TT > ] [ GROUP BY <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [, ...] ] [ HAVING <TT CLASS="REPLACEABLE" ><I >condition</I ></TT > [, ...] ] [ WINDOW <TT CLASS="REPLACEABLE" ><I >window_name</I ></TT > AS ( <TT CLASS="REPLACEABLE" ><I >window_definition</I ></TT > ) [, ...] ] [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] <TT CLASS="REPLACEABLE" ><I >select</I ></TT > ] [ ORDER BY <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [ ASC | DESC | USING <TT CLASS="REPLACEABLE" ><I >operator</I ></TT > ] [ NULLS { FIRST | LAST } ] [, ...] ] [ LIMIT { <TT CLASS="REPLACEABLE" ><I >count</I ></TT > | ALL } ] [ OFFSET <TT CLASS="REPLACEABLE" ><I >start</I ></TT > [ ROW | ROWS ] ] [ FETCH { FIRST | NEXT } [ <TT CLASS="REPLACEABLE" ><I >count</I ></TT > ] { ROW | ROWS } ONLY ] [ FOR { UPDATE | SHARE } [ OF <TT CLASS="REPLACEABLE" ><I >table_name</I ></TT > [, ...] ] [ NOWAIT ] [...] ] <SPAN CLASS="phrase" ><SPAN CLASS="PHRASE" >where <TT CLASS="REPLACEABLE" ><I >from_item</I ></TT > can be one of:</SPAN ></SPAN > [ ONLY ] <TT CLASS="REPLACEABLE" ><I >table_name</I ></TT > [ * ] [ [ AS ] <TT CLASS="REPLACEABLE" ><I >alias</I ></TT > [ ( <TT CLASS="REPLACEABLE" ><I >column_alias</I ></TT > [, ...] ) ] ] ( <TT CLASS="REPLACEABLE" ><I >select</I ></TT > ) [ AS ] <TT CLASS="REPLACEABLE" ><I >alias</I ></TT > [ ( <TT CLASS="REPLACEABLE" ><I >column_alias</I ></TT > [, ...] ) ] <TT CLASS="REPLACEABLE" ><I >with_query_name</I ></TT > [ [ AS ] <TT CLASS="REPLACEABLE" ><I >alias</I ></TT > [ ( <TT CLASS="REPLACEABLE" ><I >column_alias</I ></TT > [, ...] ) ] ] <TT CLASS="REPLACEABLE" ><I >function_name</I ></TT > ( [ <TT CLASS="REPLACEABLE" ><I >argument</I ></TT > [, ...] ] ) [ AS ] <TT CLASS="REPLACEABLE" ><I >alias</I ></TT > [ ( <TT CLASS="REPLACEABLE" ><I >column_alias</I ></TT > [, ...] | <TT CLASS="REPLACEABLE" ><I >column_definition</I ></TT > [, ...] ) ] <TT CLASS="REPLACEABLE" ><I >function_name</I ></TT > ( [ <TT CLASS="REPLACEABLE" ><I >argument</I ></TT > [, ...] ] ) AS ( <TT CLASS="REPLACEABLE" ><I >column_definition</I ></TT > [, ...] ) <TT CLASS="REPLACEABLE" ><I >from_item</I ></TT > [ NATURAL ] <TT CLASS="REPLACEABLE" ><I >join_type</I ></TT > <TT CLASS="REPLACEABLE" ><I >from_item</I ></TT > [ ON <TT CLASS="REPLACEABLE" ><I >join_condition</I ></TT > | USING ( <TT CLASS="REPLACEABLE" ><I >join_column</I ></TT > [, ...] ) ] <SPAN CLASS="phrase" ><SPAN CLASS="PHRASE" >and <TT CLASS="REPLACEABLE" ><I >with_query</I ></TT > is:</SPAN ></SPAN > <TT CLASS="REPLACEABLE" ><I >with_query_name</I ></TT > [ ( <TT CLASS="REPLACEABLE" ><I >column_name</I ></TT > [, ...] ) ] AS ( <TT CLASS="REPLACEABLE" ><I >select</I ></TT > | <TT CLASS="REPLACEABLE" ><I >values</I ></TT > | <TT CLASS="REPLACEABLE" ><I >insert</I ></TT > | <TT CLASS="REPLACEABLE" ><I >update</I ></TT > | <TT CLASS="REPLACEABLE" ><I >delete</I ></TT > ) TABLE [ ONLY ] <TT CLASS="REPLACEABLE" ><I >table_name</I ></TT > [ * ]</PRE ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN77648" ></A ><H2 >Description</H2 ><P > <TT CLASS="COMMAND" >SELECT</TT > retrieves rows from zero or more tables. The general processing of <TT CLASS="COMMAND" >SELECT</TT > is as follows: <P ></P ></P><OL TYPE="1" ><LI ><P > All queries in the <TT CLASS="LITERAL" >WITH</TT > list are computed. These effectively serve as temporary tables that can be referenced in the <TT CLASS="LITERAL" >FROM</TT > list. A <TT CLASS="LITERAL" >WITH</TT > query that is referenced more than once in <TT CLASS="LITERAL" >FROM</TT > is computed only once. (See <A HREF="sql-select.html#SQL-WITH" ><I ><I >WITH</I > Clause</I ></A > below.) </P ></LI ><LI ><P > All elements in the <TT CLASS="LITERAL" >FROM</TT > list are computed. (Each element in the <TT CLASS="LITERAL" >FROM</TT > list is a real or virtual table.) If more than one element is specified in the <TT CLASS="LITERAL" >FROM</TT > list, they are cross-joined together. (See <A HREF="sql-select.html#SQL-FROM" ><I ><I >FROM</I > Clause</I ></A > below.) </P ></LI ><LI ><P > If the <TT CLASS="LITERAL" >WHERE</TT > clause is specified, all rows that do not satisfy the condition are eliminated from the output. (See <A HREF="sql-select.html#SQL-WHERE" ><I ><I >WHERE</I > Clause</I ></A > below.) </P ></LI ><LI ><P > If the <TT CLASS="LITERAL" >GROUP BY</TT > clause is specified, the output is combined into groups of rows that match on one or more values. If the <TT CLASS="LITERAL" >HAVING</TT > clause is present, it eliminates groups that do not satisfy the given condition. (See <A HREF="sql-select.html#SQL-GROUPBY" ><I ><I >GROUP BY</I > Clause</I ></A > and <A HREF="sql-select.html#SQL-HAVING" ><I ><I >HAVING</I > Clause</I ></A > below.) </P ></LI ><LI ><P > The actual output rows are computed using the <TT CLASS="COMMAND" >SELECT</TT > output expressions for each selected row or row group. (See <A HREF="sql-select.html#SQL-SELECT-LIST" ><I ><I >SELECT</I > List</I ></A > below.) </P ></LI ><LI ><P ><TT CLASS="LITERAL" >SELECT DISTINCT</TT > eliminates duplicate rows from the result. <TT CLASS="LITERAL" >SELECT DISTINCT ON</TT > eliminates rows that match on all the specified expressions. <TT CLASS="LITERAL" >SELECT ALL</TT > (the default) will return all candidate rows, including duplicates. (See <A HREF="sql-select.html#SQL-DISTINCT" ><I ><I >DISTINCT</I > Clause</I ></A > below.) </P ></LI ><LI ><P > Using the operators <TT CLASS="LITERAL" >UNION</TT >, <TT CLASS="LITERAL" >INTERSECT</TT >, and <TT CLASS="LITERAL" >EXCEPT</TT >, the output of more than one <TT CLASS="COMMAND" >SELECT</TT > statement can be combined to form a single result set. The <TT CLASS="LITERAL" >UNION</TT > operator returns all rows that are in one or both of the result sets. The <TT CLASS="LITERAL" >INTERSECT</TT > operator returns all rows that are strictly in both result sets. The <TT CLASS="LITERAL" >EXCEPT</TT > operator returns the rows that are in the first result set but not in the second. In all three cases, duplicate rows are eliminated unless <TT CLASS="LITERAL" >ALL</TT > is specified. The noise word <TT CLASS="LITERAL" >DISTINCT</TT > can be added to explicitly specify eliminating duplicate rows. Notice that <TT CLASS="LITERAL" >DISTINCT</TT > is the default behavior here, even though <TT CLASS="LITERAL" >ALL</TT > is the default for <TT CLASS="COMMAND" >SELECT</TT > itself. (See <A HREF="sql-select.html#SQL-UNION" ><I ><I >UNION</I > Clause</I ></A >, <A HREF="sql-select.html#SQL-INTERSECT" ><I ><I >INTERSECT</I > Clause</I ></A >, and <A HREF="sql-select.html#SQL-EXCEPT" ><I ><I >EXCEPT</I > Clause</I ></A > below.) </P ></LI ><LI ><P > If the <TT CLASS="LITERAL" >ORDER BY</TT > clause is specified, the returned rows are sorted in the specified order. If <TT CLASS="LITERAL" >ORDER BY</TT > is not given, the rows are returned in whatever order the system finds fastest to produce. (See <A HREF="sql-select.html#SQL-ORDERBY" ><I ><I >ORDER BY</I > Clause</I ></A > below.) </P ></LI ><LI ><P > If the <TT CLASS="LITERAL" >LIMIT</TT > (or <TT CLASS="LITERAL" >FETCH FIRST</TT >) or <TT CLASS="LITERAL" >OFFSET</TT > clause is specified, the <TT CLASS="COMMAND" >SELECT</TT > statement only returns a subset of the result rows. (See <A HREF="sql-select.html#SQL-LIMIT" ><I ><I >LIMIT</I > Clause</I ></A > below.) </P ></LI ><LI ><P > If <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > is specified, the <TT CLASS="COMMAND" >SELECT</TT > statement locks the selected rows against concurrent updates. (See <A HREF="sql-select.html#SQL-FOR-UPDATE-SHARE" ><I ><I >FOR UPDATE</I >/<I >FOR SHARE</I > Clause</I ></A > below.) </P ></LI ></OL ><P> </P ><P > You must have <TT CLASS="LITERAL" >SELECT</TT > privilege on each column used in a <TT CLASS="COMMAND" >SELECT</TT > command. The use of <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > requires <TT CLASS="LITERAL" >UPDATE</TT > privilege as well (for at least one column of each table so selected). </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN77728" ></A ><H2 >Parameters</H2 ><DIV CLASS="REFSECT2" ><A NAME="SQL-WITH" ></A ><H3 ><TT CLASS="LITERAL" >WITH</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >WITH</TT > clause allows you to specify one or more subqueries that can be referenced by name in the primary query. The subqueries effectively act as temporary tables or views for the duration of the primary query. Each subquery can be a <TT CLASS="COMMAND" >SELECT</TT >, <TT CLASS="COMMAND" >VALUES</TT >, <TT CLASS="COMMAND" >INSERT</TT >, <TT CLASS="COMMAND" >UPDATE</TT > or <TT CLASS="COMMAND" >DELETE</TT > statement. When writing a data-modifying statement (<TT CLASS="COMMAND" >INSERT</TT >, <TT CLASS="COMMAND" >UPDATE</TT > or <TT CLASS="COMMAND" >DELETE</TT >) in <TT CLASS="LITERAL" >WITH</TT >, it is usual to include a <TT CLASS="LITERAL" >RETURNING</TT > clause. It is the output of <TT CLASS="LITERAL" >RETURNING</TT >, <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >not</I ></SPAN > the underlying table that the statement modifies, that forms the temporary table that is read by the primary query. If <TT CLASS="LITERAL" >RETURNING</TT > is omitted, the statement is still executed, but it produces no output so it cannot be referenced as a table by the primary query. </P ><P > A name (without schema qualification) must be specified for each <TT CLASS="LITERAL" >WITH</TT > query. Optionally, a list of column names can be specified; if this is omitted, the column names are inferred from the subquery. </P ><P > If <TT CLASS="LITERAL" >RECURSIVE</TT > is specified, it allows a <TT CLASS="COMMAND" >SELECT</TT > subquery to reference itself by name. Such a subquery must have the form </P><PRE CLASS="SYNOPSIS" ><TT CLASS="REPLACEABLE" ><I >non_recursive_term</I ></TT > UNION [ ALL | DISTINCT ] <TT CLASS="REPLACEABLE" ><I >recursive_term</I ></TT ></PRE ><P> where the recursive self-reference must appear on the right-hand side of the <TT CLASS="LITERAL" >UNION</TT >. Only one recursive self-reference is permitted per query. Recursive data-modifying statements are not supported, but you can use the results of a recursive <TT CLASS="COMMAND" >SELECT</TT > query in a data-modifying statement. See <A HREF="queries-with.html" >Section 7.8</A > for an example. </P ><P > Another effect of <TT CLASS="LITERAL" >RECURSIVE</TT > is that <TT CLASS="LITERAL" >WITH</TT > queries need not be ordered: a query can reference another one that is later in the list. (However, circular references, or mutual recursion, are not implemented.) Without <TT CLASS="LITERAL" >RECURSIVE</TT >, <TT CLASS="LITERAL" >WITH</TT > queries can only reference sibling <TT CLASS="LITERAL" >WITH</TT > queries that are earlier in the <TT CLASS="LITERAL" >WITH</TT > list. </P ><P > A key property of <TT CLASS="LITERAL" >WITH</TT > queries is that they are evaluated only once per execution of the primary query, even if the primary query refers to them more than once. In particular, data-modifying statements are guaranteed to be executed once and only once, regardless of whether the primary query reads all or any of their output. </P ><P > The primary query and the <TT CLASS="LITERAL" >WITH</TT > queries are all (notionally) executed at the same time. This implies that the effects of a data-modifying statement in <TT CLASS="LITERAL" >WITH</TT > cannot be seen from other parts of the query, other than by reading its <TT CLASS="LITERAL" >RETURNING</TT > output. If two such data-modifying statements attempt to modify the same row, the results are unspecified. </P ><P > See <A HREF="queries-with.html" >Section 7.8</A > for additional information. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-FROM" ></A ><H3 ><TT CLASS="LITERAL" >FROM</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >FROM</TT > clause specifies one or more source tables for the <TT CLASS="COMMAND" >SELECT</TT >. If multiple sources are specified, the result is the Cartesian product (cross join) of all the sources. But usually qualification conditions are added to restrict the returned rows to a small subset of the Cartesian product. </P ><P > The <TT CLASS="LITERAL" >FROM</TT > clause can contain the following elements: <P ></P ></P><DIV CLASS="VARIABLELIST" ><DL ><DT ><TT CLASS="REPLACEABLE" ><I >table_name</I ></TT ></DT ><DD ><P > The name (optionally schema-qualified) of an existing table or view. If <TT CLASS="LITERAL" >ONLY</TT > is specified before the table name, only that table is scanned. If <TT CLASS="LITERAL" >ONLY</TT > is not specified, the table and all its descendant tables (if any) are scanned. Optionally, <TT CLASS="LITERAL" >*</TT > can be specified after the table name to explicitly indicate that descendant tables are included. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >alias</I ></TT ></DT ><DD ><P > A substitute name for the <TT CLASS="LITERAL" >FROM</TT > item containing the alias. An alias is used for brevity or to eliminate ambiguity for self-joins (where the same table is scanned multiple times). When an alias is provided, it completely hides the actual name of the table or function; for example given <TT CLASS="LITERAL" >FROM foo AS f</TT >, the remainder of the <TT CLASS="COMMAND" >SELECT</TT > must refer to this <TT CLASS="LITERAL" >FROM</TT > item as <TT CLASS="LITERAL" >f</TT > not <TT CLASS="LITERAL" >foo</TT >. If an alias is written, a column alias list can also be written to provide substitute names for one or more columns of the table. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >select</I ></TT ></DT ><DD ><P > A sub-<TT CLASS="COMMAND" >SELECT</TT > can appear in the <TT CLASS="LITERAL" >FROM</TT > clause. This acts as though its output were created as a temporary table for the duration of this single <TT CLASS="COMMAND" >SELECT</TT > command. Note that the sub-<TT CLASS="COMMAND" >SELECT</TT > must be surrounded by parentheses, and an alias <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >must</I ></SPAN > be provided for it. A <A HREF="sql-values.html" >VALUES</A > command can also be used here. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >with_query_name</I ></TT ></DT ><DD ><P > A <TT CLASS="LITERAL" >WITH</TT > query is referenced by writing its name, just as though the query's name were a table name. (In fact, the <TT CLASS="LITERAL" >WITH</TT > query hides any real table of the same name for the purposes of the primary query. If necessary, you can refer to a real table of the same name by schema-qualifying the table's name.) An alias can be provided in the same way as for a table. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >function_name</I ></TT ></DT ><DD ><P > Function calls can appear in the <TT CLASS="LITERAL" >FROM</TT > clause. (This is especially useful for functions that return result sets, but any function can be used.) This acts as though its output were created as a temporary table for the duration of this single <TT CLASS="COMMAND" >SELECT</TT > command. An alias can also be used. If an alias is written, a column alias list can also be written to provide substitute names for one or more attributes of the function's composite return type. If the function has been defined as returning the <TT CLASS="TYPE" >record</TT > data type, then an alias or the key word <TT CLASS="LITERAL" >AS</TT > must be present, followed by a column definition list in the form <TT CLASS="LITERAL" >( <TT CLASS="REPLACEABLE" ><I >column_name</I ></TT > <TT CLASS="REPLACEABLE" ><I >data_type</I ></TT > [<SPAN CLASS="OPTIONAL" >, ... </SPAN >] )</TT >. The column definition list must match the actual number and types of columns returned by the function. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >join_type</I ></TT ></DT ><DD ><P > One of <P ></P ></P><UL ><LI ><P ><TT CLASS="LITERAL" >[ INNER ] JOIN</TT ></P ></LI ><LI ><P ><TT CLASS="LITERAL" >LEFT [ OUTER ] JOIN</TT ></P ></LI ><LI ><P ><TT CLASS="LITERAL" >RIGHT [ OUTER ] JOIN</TT ></P ></LI ><LI ><P ><TT CLASS="LITERAL" >FULL [ OUTER ] JOIN</TT ></P ></LI ><LI ><P ><TT CLASS="LITERAL" >CROSS JOIN</TT ></P ></LI ></UL ><P> For the <TT CLASS="LITERAL" >INNER</TT > and <TT CLASS="LITERAL" >OUTER</TT > join types, a join condition must be specified, namely exactly one of <TT CLASS="LITERAL" >NATURAL</TT >, <TT CLASS="LITERAL" >ON <TT CLASS="REPLACEABLE" ><I >join_condition</I ></TT ></TT >, or <TT CLASS="LITERAL" >USING (<TT CLASS="REPLACEABLE" ><I >join_column</I ></TT > [, ...])</TT >. See below for the meaning. For <TT CLASS="LITERAL" >CROSS JOIN</TT >, none of these clauses can appear. </P ><P > A <TT CLASS="LITERAL" >JOIN</TT > clause combines two <TT CLASS="LITERAL" >FROM</TT > items. Use parentheses if necessary to determine the order of nesting. In the absence of parentheses, <TT CLASS="LITERAL" >JOIN</TT >s nest left-to-right. In any case <TT CLASS="LITERAL" >JOIN</TT > binds more tightly than the commas separating <TT CLASS="LITERAL" >FROM</TT > items. </P ><P ><TT CLASS="LITERAL" >CROSS JOIN</TT > and <TT CLASS="LITERAL" >INNER JOIN</TT > produce a simple Cartesian product, the same result as you get from listing the two items at the top level of <TT CLASS="LITERAL" >FROM</TT >, but restricted by the join condition (if any). <TT CLASS="LITERAL" >CROSS JOIN</TT > is equivalent to <TT CLASS="LITERAL" >INNER JOIN ON (TRUE)</TT >, that is, no rows are removed by qualification. These join types are just a notational convenience, since they do nothing you couldn't do with plain <TT CLASS="LITERAL" >FROM</TT > and <TT CLASS="LITERAL" >WHERE</TT >. </P ><P ><TT CLASS="LITERAL" >LEFT OUTER JOIN</TT > returns all rows in the qualified Cartesian product (i.e., all combined rows that pass its join condition), plus one copy of each row in the left-hand table for which there was no right-hand row that passed the join condition. This left-hand row is extended to the full width of the joined table by inserting null values for the right-hand columns. Note that only the <TT CLASS="LITERAL" >JOIN</TT > clause's own condition is considered while deciding which rows have matches. Outer conditions are applied afterwards. </P ><P > Conversely, <TT CLASS="LITERAL" >RIGHT OUTER JOIN</TT > returns all the joined rows, plus one row for each unmatched right-hand row (extended with nulls on the left). This is just a notational convenience, since you could convert it to a <TT CLASS="LITERAL" >LEFT OUTER JOIN</TT > by switching the left and right inputs. </P ><P ><TT CLASS="LITERAL" >FULL OUTER JOIN</TT > returns all the joined rows, plus one row for each unmatched left-hand row (extended with nulls on the right), plus one row for each unmatched right-hand row (extended with nulls on the left). </P ></DD ><DT ><TT CLASS="LITERAL" >ON <TT CLASS="REPLACEABLE" ><I >join_condition</I ></TT ></TT ></DT ><DD ><P ><TT CLASS="REPLACEABLE" ><I >join_condition</I ></TT > is an expression resulting in a value of type <TT CLASS="TYPE" >boolean</TT > (similar to a <TT CLASS="LITERAL" >WHERE</TT > clause) that specifies which rows in a join are considered to match. </P ></DD ><DT ><TT CLASS="LITERAL" >USING ( <TT CLASS="REPLACEABLE" ><I >join_column</I ></TT > [, ...] )</TT ></DT ><DD ><P > A clause of the form <TT CLASS="LITERAL" >USING ( a, b, ... )</TT > is shorthand for <TT CLASS="LITERAL" >ON left_table.a = right_table.a AND left_table.b = right_table.b ...</TT >. Also, <TT CLASS="LITERAL" >USING</TT > implies that only one of each pair of equivalent columns will be included in the join output, not both. </P ></DD ><DT ><TT CLASS="LITERAL" >NATURAL</TT ></DT ><DD ><P > <TT CLASS="LITERAL" >NATURAL</TT > is shorthand for a <TT CLASS="LITERAL" >USING</TT > list that mentions all columns in the two tables that have matching names. If there are no common column names, <TT CLASS="LITERAL" >NATURAL</TT > is equivalent to <TT CLASS="LITERAL" >ON TRUE</TT >. </P ></DD ></DL ></DIV ><P> </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-WHERE" ></A ><H3 ><TT CLASS="LITERAL" >WHERE</TT > Clause</H3 ><P > The optional <TT CLASS="LITERAL" >WHERE</TT > clause has the general form </P><PRE CLASS="SYNOPSIS" >WHERE <TT CLASS="REPLACEABLE" ><I >condition</I ></TT ></PRE ><P> where <TT CLASS="REPLACEABLE" ><I >condition</I ></TT > is any expression that evaluates to a result of type <TT CLASS="TYPE" >boolean</TT >. Any row that does not satisfy this condition will be eliminated from the output. A row satisfies the condition if it returns true when the actual row values are substituted for any variable references. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-GROUPBY" ></A ><H3 ><TT CLASS="LITERAL" >GROUP BY</TT > Clause</H3 ><P > The optional <TT CLASS="LITERAL" >GROUP BY</TT > clause has the general form </P><PRE CLASS="SYNOPSIS" >GROUP BY <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [, ...]</PRE ><P> </P ><P > <TT CLASS="LITERAL" >GROUP BY</TT > will condense into a single row all selected rows that share the same values for the grouped expressions. <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > can be an input column name, or the name or ordinal number of an output column (<TT CLASS="COMMAND" >SELECT</TT > list item), or an arbitrary expression formed from input-column values. In case of ambiguity, a <TT CLASS="LITERAL" >GROUP BY</TT > name will be interpreted as an input-column name rather than an output column name. </P ><P > Aggregate functions, if any are used, are computed across all rows making up each group, producing a separate value for each group (whereas without <TT CLASS="LITERAL" >GROUP BY</TT >, an aggregate produces a single value computed across all the selected rows). When <TT CLASS="LITERAL" >GROUP BY</TT > is present, it is not valid for the <TT CLASS="COMMAND" >SELECT</TT > list expressions to refer to ungrouped columns except within aggregate functions or if the ungrouped column is functionally dependent on the grouped columns, since there would otherwise be more than one possible value to return for an ungrouped column. A functional dependency exists if the grouped columns (or a subset thereof) are the primary key of the table containing the ungrouped column. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-HAVING" ></A ><H3 ><TT CLASS="LITERAL" >HAVING</TT > Clause</H3 ><P > The optional <TT CLASS="LITERAL" >HAVING</TT > clause has the general form </P><PRE CLASS="SYNOPSIS" >HAVING <TT CLASS="REPLACEABLE" ><I >condition</I ></TT ></PRE ><P> where <TT CLASS="REPLACEABLE" ><I >condition</I ></TT > is the same as specified for the <TT CLASS="LITERAL" >WHERE</TT > clause. </P ><P > <TT CLASS="LITERAL" >HAVING</TT > eliminates group rows that do not satisfy the condition. <TT CLASS="LITERAL" >HAVING</TT > is different from <TT CLASS="LITERAL" >WHERE</TT >: <TT CLASS="LITERAL" >WHERE</TT > filters individual rows before the application of <TT CLASS="LITERAL" >GROUP BY</TT >, while <TT CLASS="LITERAL" >HAVING</TT > filters group rows created by <TT CLASS="LITERAL" >GROUP BY</TT >. Each column referenced in <TT CLASS="REPLACEABLE" ><I >condition</I ></TT > must unambiguously reference a grouping column, unless the reference appears within an aggregate function. </P ><P > The presence of <TT CLASS="LITERAL" >HAVING</TT > turns a query into a grouped query even if there is no <TT CLASS="LITERAL" >GROUP BY</TT > clause. This is the same as what happens when the query contains aggregate functions but no <TT CLASS="LITERAL" >GROUP BY</TT > clause. All the selected rows are considered to form a single group, and the <TT CLASS="COMMAND" >SELECT</TT > list and <TT CLASS="LITERAL" >HAVING</TT > clause can only reference table columns from within aggregate functions. Such a query will emit a single row if the <TT CLASS="LITERAL" >HAVING</TT > condition is true, zero rows if it is not true. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-WINDOW" ></A ><H3 ><TT CLASS="LITERAL" >WINDOW</TT > Clause</H3 ><P > The optional <TT CLASS="LITERAL" >WINDOW</TT > clause has the general form </P><PRE CLASS="SYNOPSIS" >WINDOW <TT CLASS="REPLACEABLE" ><I >window_name</I ></TT > AS ( <TT CLASS="REPLACEABLE" ><I >window_definition</I ></TT > ) [, ...]</PRE ><P> where <TT CLASS="REPLACEABLE" ><I >window_name</I ></TT > is a name that can be referenced from <TT CLASS="LITERAL" >OVER</TT > clauses or subsequent window definitions, and <TT CLASS="REPLACEABLE" ><I >window_definition</I ></TT > is </P><PRE CLASS="SYNOPSIS" >[ <TT CLASS="REPLACEABLE" ><I >existing_window_name</I ></TT > ] [ PARTITION BY <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [, ...] ] [ ORDER BY <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [ ASC | DESC | USING <TT CLASS="REPLACEABLE" ><I >operator</I ></TT > ] [ NULLS { FIRST | LAST } ] [, ...] ] [ <TT CLASS="REPLACEABLE" ><I >frame_clause</I ></TT > ]</PRE ><P> </P ><P > If an <TT CLASS="REPLACEABLE" ><I >existing_window_name</I ></TT > is specified it must refer to an earlier entry in the <TT CLASS="LITERAL" >WINDOW</TT > list; the new window copies its partitioning clause from that entry, as well as its ordering clause if any. In this case the new window cannot specify its own <TT CLASS="LITERAL" >PARTITION BY</TT > clause, and it can specify <TT CLASS="LITERAL" >ORDER BY</TT > only if the copied window does not have one. The new window always uses its own frame clause; the copied window must not specify a frame clause. </P ><P > The elements of the <TT CLASS="LITERAL" >PARTITION BY</TT > list are interpreted in much the same fashion as elements of a <A HREF="sql-select.html#SQL-GROUPBY" ><I ><I >GROUP BY</I > Clause</I ></A >, except that they are always simple expressions and never the name or number of an output column. Another difference is that these expressions can contain aggregate function calls, which are not allowed in a regular <TT CLASS="LITERAL" >GROUP BY</TT > clause. They are allowed here because windowing occurs after grouping and aggregation. </P ><P > Similarly, the elements of the <TT CLASS="LITERAL" >ORDER BY</TT > list are interpreted in much the same fashion as elements of an <A HREF="sql-select.html#SQL-ORDERBY" ><I ><I >ORDER BY</I > Clause</I ></A >, except that the expressions are always taken as simple expressions and never the name or number of an output column. </P ><P > The optional <TT CLASS="REPLACEABLE" ><I >frame_clause</I ></TT > defines the <I CLASS="FIRSTTERM" >window frame</I > for window functions that depend on the frame (not all do). The window frame is a set of related rows for each row of the query (called the <I CLASS="FIRSTTERM" >current row</I >). The <TT CLASS="REPLACEABLE" ><I >frame_clause</I ></TT > can be one of </P><PRE CLASS="SYNOPSIS" >{ RANGE | ROWS } <TT CLASS="REPLACEABLE" ><I >frame_start</I ></TT > { RANGE | ROWS } BETWEEN <TT CLASS="REPLACEABLE" ><I >frame_start</I ></TT > AND <TT CLASS="REPLACEABLE" ><I >frame_end</I ></TT ></PRE ><P> where <TT CLASS="REPLACEABLE" ><I >frame_start</I ></TT > and <TT CLASS="REPLACEABLE" ><I >frame_end</I ></TT > can be one of </P><PRE CLASS="SYNOPSIS" >UNBOUNDED PRECEDING <TT CLASS="REPLACEABLE" ><I >value</I ></TT > PRECEDING CURRENT ROW <TT CLASS="REPLACEABLE" ><I >value</I ></TT > FOLLOWING UNBOUNDED FOLLOWING</PRE ><P> If <TT CLASS="REPLACEABLE" ><I >frame_end</I ></TT > is omitted it defaults to <TT CLASS="LITERAL" >CURRENT ROW</TT >. Restrictions are that <TT CLASS="REPLACEABLE" ><I >frame_start</I ></TT > cannot be <TT CLASS="LITERAL" >UNBOUNDED FOLLOWING</TT >, <TT CLASS="REPLACEABLE" ><I >frame_end</I ></TT > cannot be <TT CLASS="LITERAL" >UNBOUNDED PRECEDING</TT >, and the <TT CLASS="REPLACEABLE" ><I >frame_end</I ></TT > choice cannot appear earlier in the above list than the <TT CLASS="REPLACEABLE" ><I >frame_start</I ></TT > choice — for example <TT CLASS="LITERAL" >RANGE BETWEEN CURRENT ROW AND <TT CLASS="REPLACEABLE" ><I >value</I ></TT > PRECEDING</TT > is not allowed. </P ><P > The default framing option is <TT CLASS="LITERAL" >RANGE UNBOUNDED PRECEDING</TT >, which is the same as <TT CLASS="LITERAL" >RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW</TT >; it sets the frame to be all rows from the partition start up through the current row's last peer in the <TT CLASS="LITERAL" >ORDER BY</TT > ordering (which means all rows if there is no <TT CLASS="LITERAL" >ORDER BY</TT >). In general, <TT CLASS="LITERAL" >UNBOUNDED PRECEDING</TT > means that the frame starts with the first row of the partition, and similarly <TT CLASS="LITERAL" >UNBOUNDED FOLLOWING</TT > means that the frame ends with the last row of the partition (regardless of <TT CLASS="LITERAL" >RANGE</TT > or <TT CLASS="LITERAL" >ROWS</TT > mode). In <TT CLASS="LITERAL" >ROWS</TT > mode, <TT CLASS="LITERAL" >CURRENT ROW</TT > means that the frame starts or ends with the current row; but in <TT CLASS="LITERAL" >RANGE</TT > mode it means that the frame starts or ends with the current row's first or last peer in the <TT CLASS="LITERAL" >ORDER BY</TT > ordering. The <TT CLASS="REPLACEABLE" ><I >value</I ></TT > <TT CLASS="LITERAL" >PRECEDING</TT > and <TT CLASS="REPLACEABLE" ><I >value</I ></TT > <TT CLASS="LITERAL" >FOLLOWING</TT > cases are currently only allowed in <TT CLASS="LITERAL" >ROWS</TT > mode. They indicate that the frame starts or ends with the row that many rows before or after the current row. <TT CLASS="REPLACEABLE" ><I >value</I ></TT > must be an integer expression not containing any variables, aggregate functions, or window functions. The value must not be null or negative; but it can be zero, which selects the current row itself. </P ><P > Beware that the <TT CLASS="LITERAL" >ROWS</TT > options can produce unpredictable results if the <TT CLASS="LITERAL" >ORDER BY</TT > ordering does not order the rows uniquely. The <TT CLASS="LITERAL" >RANGE</TT > options are designed to ensure that rows that are peers in the <TT CLASS="LITERAL" >ORDER BY</TT > ordering are treated alike; any two peer rows will be both in or both not in the frame. </P ><P > The purpose of a <TT CLASS="LITERAL" >WINDOW</TT > clause is to specify the behavior of <I CLASS="FIRSTTERM" >window functions</I > appearing in the query's <A HREF="sql-select.html#SQL-SELECT-LIST" ><I ><I >SELECT</I > List</I ></A > or <A HREF="sql-select.html#SQL-ORDERBY" ><I ><I >ORDER BY</I > Clause</I ></A >. These functions can reference the <TT CLASS="LITERAL" >WINDOW</TT > clause entries by name in their <TT CLASS="LITERAL" >OVER</TT > clauses. A <TT CLASS="LITERAL" >WINDOW</TT > clause entry does not have to be referenced anywhere, however; if it is not used in the query it is simply ignored. It is possible to use window functions without any <TT CLASS="LITERAL" >WINDOW</TT > clause at all, since a window function call can specify its window definition directly in its <TT CLASS="LITERAL" >OVER</TT > clause. However, the <TT CLASS="LITERAL" >WINDOW</TT > clause saves typing when the same window definition is needed for more than one window function. </P ><P > Window functions are described in detail in <A HREF="tutorial-window.html" >Section 3.5</A >, <A HREF="sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS" >Section 4.2.8</A >, and <A HREF="queries-table-expressions.html#QUERIES-WINDOW" >Section 7.2.4</A >. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-SELECT-LIST" ></A ><H3 ><TT CLASS="COMMAND" >SELECT</TT > List</H3 ><P > The <TT CLASS="COMMAND" >SELECT</TT > list (between the key words <TT CLASS="LITERAL" >SELECT</TT > and <TT CLASS="LITERAL" >FROM</TT >) specifies expressions that form the output rows of the <TT CLASS="COMMAND" >SELECT</TT > statement. The expressions can (and usually do) refer to columns computed in the <TT CLASS="LITERAL" >FROM</TT > clause. </P ><P > Just as in a table, every output column of a <TT CLASS="COMMAND" >SELECT</TT > has a name. In a simple <TT CLASS="COMMAND" >SELECT</TT > this name is just used to label the column for display, but when the <TT CLASS="COMMAND" >SELECT</TT > is a sub-query of a larger query, the name is seen by the larger query as the column name of the virtual table produced by the sub-query. To specify the name to use for an output column, write <TT CLASS="LITERAL" >AS</TT > <TT CLASS="REPLACEABLE" ><I >output_name</I ></TT > after the column's expression. (You can omit <TT CLASS="LITERAL" >AS</TT >, but only if the desired output name does not match any <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > keyword (see <A HREF="sql-keywords-appendix.html" >Appendix C</A >). For protection against possible future keyword additions, it is recommended that you always either write <TT CLASS="LITERAL" >AS</TT > or double-quote the output name.) If you do not specify a column name, a name is chosen automatically by <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. If the column's expression is a simple column reference then the chosen name is the same as that column's name. In more complex cases a function or type name may be used, or the system may fall back on a generated name such as <TT CLASS="LITERAL" >?column?</TT >. </P ><P > An output column's name can be used to refer to the column's value in <TT CLASS="LITERAL" >ORDER BY</TT > and <TT CLASS="LITERAL" >GROUP BY</TT > clauses, but not in the <TT CLASS="LITERAL" >WHERE</TT > or <TT CLASS="LITERAL" >HAVING</TT > clauses; there you must write out the expression instead. </P ><P > Instead of an expression, <TT CLASS="LITERAL" >*</TT > can be written in the output list as a shorthand for all the columns of the selected rows. Also, you can write <TT CLASS="LITERAL" ><TT CLASS="REPLACEABLE" ><I >table_name</I ></TT >.*</TT > as a shorthand for the columns coming from just that table. In these cases it is not possible to specify new names with <TT CLASS="LITERAL" >AS</TT >; the output column names will be the same as the table columns' names. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-DISTINCT" ></A ><H3 ><TT CLASS="LITERAL" >DISTINCT</TT > Clause</H3 ><P > If <TT CLASS="LITERAL" >SELECT DISTINCT</TT > is specified, all duplicate rows are removed from the result set (one row is kept from each group of duplicates). <TT CLASS="LITERAL" >SELECT ALL</TT > specifies the opposite: all rows are kept; that is the default. </P ><P > <TT CLASS="LITERAL" >SELECT DISTINCT ON ( <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [, ...] )</TT > keeps only the first row of each set of rows where the given expressions evaluate to equal. The <TT CLASS="LITERAL" >DISTINCT ON</TT > expressions are interpreted using the same rules as for <TT CLASS="LITERAL" >ORDER BY</TT > (see above). Note that the <SPAN CLASS="QUOTE" >"first row"</SPAN > of each set is unpredictable unless <TT CLASS="LITERAL" >ORDER BY</TT > is used to ensure that the desired row appears first. For example: </P><PRE CLASS="PROGRAMLISTING" >SELECT DISTINCT ON (location) location, time, report FROM weather_reports ORDER BY location, time DESC;</PRE ><P> retrieves the most recent weather report for each location. But if we had not used <TT CLASS="LITERAL" >ORDER BY</TT > to force descending order of time values for each location, we'd have gotten a report from an unpredictable time for each location. </P ><P > The <TT CLASS="LITERAL" >DISTINCT ON</TT > expression(s) must match the leftmost <TT CLASS="LITERAL" >ORDER BY</TT > expression(s). The <TT CLASS="LITERAL" >ORDER BY</TT > clause will normally contain additional expression(s) that determine the desired precedence of rows within each <TT CLASS="LITERAL" >DISTINCT ON</TT > group. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-UNION" ></A ><H3 ><TT CLASS="LITERAL" >UNION</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >UNION</TT > clause has this general form: </P><PRE CLASS="SYNOPSIS" ><TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT > UNION [ ALL | DISTINCT ] <TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT ></PRE ><P><TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT > is any <TT CLASS="COMMAND" >SELECT</TT > statement without an <TT CLASS="LITERAL" >ORDER BY</TT >, <TT CLASS="LITERAL" >LIMIT</TT >, <TT CLASS="LITERAL" >FOR UPDATE</TT >, or <TT CLASS="LITERAL" >FOR SHARE</TT > clause. (<TT CLASS="LITERAL" >ORDER BY</TT > and <TT CLASS="LITERAL" >LIMIT</TT > can be attached to a subexpression if it is enclosed in parentheses. Without parentheses, these clauses will be taken to apply to the result of the <TT CLASS="LITERAL" >UNION</TT >, not to its right-hand input expression.) </P ><P > The <TT CLASS="LITERAL" >UNION</TT > operator computes the set union of the rows returned by the involved <TT CLASS="COMMAND" >SELECT</TT > statements. A row is in the set union of two result sets if it appears in at least one of the result sets. The two <TT CLASS="COMMAND" >SELECT</TT > statements that represent the direct operands of the <TT CLASS="LITERAL" >UNION</TT > must produce the same number of columns, and corresponding columns must be of compatible data types. </P ><P > The result of <TT CLASS="LITERAL" >UNION</TT > does not contain any duplicate rows unless the <TT CLASS="LITERAL" >ALL</TT > option is specified. <TT CLASS="LITERAL" >ALL</TT > prevents elimination of duplicates. (Therefore, <TT CLASS="LITERAL" >UNION ALL</TT > is usually significantly quicker than <TT CLASS="LITERAL" >UNION</TT >; use <TT CLASS="LITERAL" >ALL</TT > when you can.) <TT CLASS="LITERAL" >DISTINCT</TT > can be written to explicitly specify the default behavior of eliminating duplicate rows. </P ><P > Multiple <TT CLASS="LITERAL" >UNION</TT > operators in the same <TT CLASS="COMMAND" >SELECT</TT > statement are evaluated left to right, unless otherwise indicated by parentheses. </P ><P > Currently, <TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT > cannot be specified either for a <TT CLASS="LITERAL" >UNION</TT > result or for any input of a <TT CLASS="LITERAL" >UNION</TT >. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-INTERSECT" ></A ><H3 ><TT CLASS="LITERAL" >INTERSECT</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >INTERSECT</TT > clause has this general form: </P><PRE CLASS="SYNOPSIS" ><TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT > INTERSECT [ ALL | DISTINCT ] <TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT ></PRE ><P><TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT > is any <TT CLASS="COMMAND" >SELECT</TT > statement without an <TT CLASS="LITERAL" >ORDER BY</TT >, <TT CLASS="LITERAL" >LIMIT</TT >, <TT CLASS="LITERAL" >FOR UPDATE</TT >, or <TT CLASS="LITERAL" >FOR SHARE</TT > clause. </P ><P > The <TT CLASS="LITERAL" >INTERSECT</TT > operator computes the set intersection of the rows returned by the involved <TT CLASS="COMMAND" >SELECT</TT > statements. A row is in the intersection of two result sets if it appears in both result sets. </P ><P > The result of <TT CLASS="LITERAL" >INTERSECT</TT > does not contain any duplicate rows unless the <TT CLASS="LITERAL" >ALL</TT > option is specified. With <TT CLASS="LITERAL" >ALL</TT >, a row that has <TT CLASS="REPLACEABLE" ><I >m</I ></TT > duplicates in the left table and <TT CLASS="REPLACEABLE" ><I >n</I ></TT > duplicates in the right table will appear min(<TT CLASS="REPLACEABLE" ><I >m</I ></TT >,<TT CLASS="REPLACEABLE" ><I >n</I ></TT >) times in the result set. <TT CLASS="LITERAL" >DISTINCT</TT > can be written to explicitly specify the default behavior of eliminating duplicate rows. </P ><P > Multiple <TT CLASS="LITERAL" >INTERSECT</TT > operators in the same <TT CLASS="COMMAND" >SELECT</TT > statement are evaluated left to right, unless parentheses dictate otherwise. <TT CLASS="LITERAL" >INTERSECT</TT > binds more tightly than <TT CLASS="LITERAL" >UNION</TT >. That is, <TT CLASS="LITERAL" >A UNION B INTERSECT C</TT > will be read as <TT CLASS="LITERAL" >A UNION (B INTERSECT C)</TT >. </P ><P > Currently, <TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT > cannot be specified either for an <TT CLASS="LITERAL" >INTERSECT</TT > result or for any input of an <TT CLASS="LITERAL" >INTERSECT</TT >. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-EXCEPT" ></A ><H3 ><TT CLASS="LITERAL" >EXCEPT</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >EXCEPT</TT > clause has this general form: </P><PRE CLASS="SYNOPSIS" ><TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT > EXCEPT [ ALL | DISTINCT ] <TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT ></PRE ><P><TT CLASS="REPLACEABLE" ><I >select_statement</I ></TT > is any <TT CLASS="COMMAND" >SELECT</TT > statement without an <TT CLASS="LITERAL" >ORDER BY</TT >, <TT CLASS="LITERAL" >LIMIT</TT >, <TT CLASS="LITERAL" >FOR UPDATE</TT >, or <TT CLASS="LITERAL" >FOR SHARE</TT > clause. </P ><P > The <TT CLASS="LITERAL" >EXCEPT</TT > operator computes the set of rows that are in the result of the left <TT CLASS="COMMAND" >SELECT</TT > statement but not in the result of the right one. </P ><P > The result of <TT CLASS="LITERAL" >EXCEPT</TT > does not contain any duplicate rows unless the <TT CLASS="LITERAL" >ALL</TT > option is specified. With <TT CLASS="LITERAL" >ALL</TT >, a row that has <TT CLASS="REPLACEABLE" ><I >m</I ></TT > duplicates in the left table and <TT CLASS="REPLACEABLE" ><I >n</I ></TT > duplicates in the right table will appear max(<TT CLASS="REPLACEABLE" ><I >m</I ></TT >-<TT CLASS="REPLACEABLE" ><I >n</I ></TT >,0) times in the result set. <TT CLASS="LITERAL" >DISTINCT</TT > can be written to explicitly specify the default behavior of eliminating duplicate rows. </P ><P > Multiple <TT CLASS="LITERAL" >EXCEPT</TT > operators in the same <TT CLASS="COMMAND" >SELECT</TT > statement are evaluated left to right, unless parentheses dictate otherwise. <TT CLASS="LITERAL" >EXCEPT</TT > binds at the same level as <TT CLASS="LITERAL" >UNION</TT >. </P ><P > Currently, <TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT > cannot be specified either for an <TT CLASS="LITERAL" >EXCEPT</TT > result or for any input of an <TT CLASS="LITERAL" >EXCEPT</TT >. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-ORDERBY" ></A ><H3 ><TT CLASS="LITERAL" >ORDER BY</TT > Clause</H3 ><P > The optional <TT CLASS="LITERAL" >ORDER BY</TT > clause has this general form: </P><PRE CLASS="SYNOPSIS" >ORDER BY <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > [ ASC | DESC | USING <TT CLASS="REPLACEABLE" ><I >operator</I ></TT > ] [ NULLS { FIRST | LAST } ] [, ...]</PRE ><P> The <TT CLASS="LITERAL" >ORDER BY</TT > clause causes the result rows to be sorted according to the specified expression(s). If two rows are equal according to the leftmost expression, they are compared according to the next expression and so on. If they are equal according to all specified expressions, they are returned in an implementation-dependent order. </P ><P > Each <TT CLASS="REPLACEABLE" ><I >expression</I ></TT > can be the name or ordinal number of an output column (<TT CLASS="COMMAND" >SELECT</TT > list item), or it can be an arbitrary expression formed from input-column values. </P ><P > The ordinal number refers to the ordinal (left-to-right) position of the output column. This feature makes it possible to define an ordering on the basis of a column that does not have a unique name. This is never absolutely necessary because it is always possible to assign a name to an output column using the <TT CLASS="LITERAL" >AS</TT > clause. </P ><P > It is also possible to use arbitrary expressions in the <TT CLASS="LITERAL" >ORDER BY</TT > clause, including columns that do not appear in the <TT CLASS="COMMAND" >SELECT</TT > output list. Thus the following statement is valid: </P><PRE CLASS="PROGRAMLISTING" >SELECT name FROM distributors ORDER BY code;</PRE ><P> A limitation of this feature is that an <TT CLASS="LITERAL" >ORDER BY</TT > clause applying to the result of a <TT CLASS="LITERAL" >UNION</TT >, <TT CLASS="LITERAL" >INTERSECT</TT >, or <TT CLASS="LITERAL" >EXCEPT</TT > clause can only specify an output column name or number, not an expression. </P ><P > If an <TT CLASS="LITERAL" >ORDER BY</TT > expression is a simple name that matches both an output column name and an input column name, <TT CLASS="LITERAL" >ORDER BY</TT > will interpret it as the output column name. This is the opposite of the choice that <TT CLASS="LITERAL" >GROUP BY</TT > will make in the same situation. This inconsistency is made to be compatible with the SQL standard. </P ><P > Optionally one can add the key word <TT CLASS="LITERAL" >ASC</TT > (ascending) or <TT CLASS="LITERAL" >DESC</TT > (descending) after any expression in the <TT CLASS="LITERAL" >ORDER BY</TT > clause. If not specified, <TT CLASS="LITERAL" >ASC</TT > is assumed by default. Alternatively, a specific ordering operator name can be specified in the <TT CLASS="LITERAL" >USING</TT > clause. An ordering operator must be a less-than or greater-than member of some B-tree operator family. <TT CLASS="LITERAL" >ASC</TT > is usually equivalent to <TT CLASS="LITERAL" >USING <</TT > and <TT CLASS="LITERAL" >DESC</TT > is usually equivalent to <TT CLASS="LITERAL" >USING ></TT >. (But the creator of a user-defined data type can define exactly what the default sort ordering is, and it might correspond to operators with other names.) </P ><P > If <TT CLASS="LITERAL" >NULLS LAST</TT > is specified, null values sort after all non-null values; if <TT CLASS="LITERAL" >NULLS FIRST</TT > is specified, null values sort before all non-null values. If neither is specified, the default behavior is <TT CLASS="LITERAL" >NULLS LAST</TT > when <TT CLASS="LITERAL" >ASC</TT > is specified or implied, and <TT CLASS="LITERAL" >NULLS FIRST</TT > when <TT CLASS="LITERAL" >DESC</TT > is specified (thus, the default is to act as though nulls are larger than non-nulls). When <TT CLASS="LITERAL" >USING</TT > is specified, the default nulls ordering depends on whether the operator is a less-than or greater-than operator. </P ><P > Note that ordering options apply only to the expression they follow; for example <TT CLASS="LITERAL" >ORDER BY x, y DESC</TT > does not mean the same thing as <TT CLASS="LITERAL" >ORDER BY x DESC, y DESC</TT >. </P ><P > Character-string data is sorted according to the collation that applies to the column being sorted. That can be overridden at need by including a <TT CLASS="LITERAL" >COLLATE</TT > clause in the <TT CLASS="REPLACEABLE" ><I >expression</I ></TT >, for example <TT CLASS="LITERAL" >ORDER BY mycolumn COLLATE "en_US"</TT >. For more information see <A HREF="sql-expressions.html#SQL-SYNTAX-COLLATE-EXPRS" >Section 4.2.10</A > and <A HREF="collation.html" >Section 22.2</A >. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-LIMIT" ></A ><H3 ><TT CLASS="LITERAL" >LIMIT</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >LIMIT</TT > clause consists of two independent sub-clauses: </P><PRE CLASS="SYNOPSIS" >LIMIT { <TT CLASS="REPLACEABLE" ><I >count</I ></TT > | ALL } OFFSET <TT CLASS="REPLACEABLE" ><I >start</I ></TT ></PRE ><P> <TT CLASS="REPLACEABLE" ><I >count</I ></TT > specifies the maximum number of rows to return, while <TT CLASS="REPLACEABLE" ><I >start</I ></TT > specifies the number of rows to skip before starting to return rows. When both are specified, <TT CLASS="REPLACEABLE" ><I >start</I ></TT > rows are skipped before starting to count the <TT CLASS="REPLACEABLE" ><I >count</I ></TT > rows to be returned. </P ><P > If the <TT CLASS="REPLACEABLE" ><I >count</I ></TT > expression evaluates to NULL, it is treated as <TT CLASS="LITERAL" >LIMIT ALL</TT >, i.e., no limit. If <TT CLASS="REPLACEABLE" ><I >start</I ></TT > evaluates to NULL, it is treated the same as <TT CLASS="LITERAL" >OFFSET 0</TT >. </P ><P > SQL:2008 introduced a different syntax to achieve the same result, which <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > also supports. It is: </P><PRE CLASS="SYNOPSIS" >OFFSET <TT CLASS="REPLACEABLE" ><I >start</I ></TT > { ROW | ROWS } FETCH { FIRST | NEXT } [ <TT CLASS="REPLACEABLE" ><I >count</I ></TT > ] { ROW | ROWS } ONLY</PRE ><P> In this syntax, to write anything except a simple integer constant for <TT CLASS="REPLACEABLE" ><I >start</I ></TT > or <TT CLASS="REPLACEABLE" ><I >count</I ></TT >, you must write parentheses around it. If <TT CLASS="REPLACEABLE" ><I >count</I ></TT > is omitted in a <TT CLASS="LITERAL" >FETCH</TT > clause, it defaults to 1. <TT CLASS="LITERAL" >ROW</TT > and <TT CLASS="LITERAL" >ROWS</TT > as well as <TT CLASS="LITERAL" >FIRST</TT > and <TT CLASS="LITERAL" >NEXT</TT > are noise words that don't influence the effects of these clauses. According to the standard, the <TT CLASS="LITERAL" >OFFSET</TT > clause must come before the <TT CLASS="LITERAL" >FETCH</TT > clause if both are present; but <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > is laxer and allows either order. </P ><P > When using <TT CLASS="LITERAL" >LIMIT</TT >, it is a good idea to use an <TT CLASS="LITERAL" >ORDER BY</TT > clause that constrains the result rows into a unique order. Otherwise you will get an unpredictable subset of the query's rows — you might be asking for the tenth through twentieth rows, but tenth through twentieth in what ordering? You don't know what ordering unless you specify <TT CLASS="LITERAL" >ORDER BY</TT >. </P ><P > The query planner takes <TT CLASS="LITERAL" >LIMIT</TT > into account when generating a query plan, so you are very likely to get different plans (yielding different row orders) depending on what you use for <TT CLASS="LITERAL" >LIMIT</TT > and <TT CLASS="LITERAL" >OFFSET</TT >. Thus, using different <TT CLASS="LITERAL" >LIMIT</TT >/<TT CLASS="LITERAL" >OFFSET</TT > values to select different subsets of a query result <SPAN CLASS="emphasis" ><I CLASS="EMPHASIS" >will give inconsistent results</I ></SPAN > unless you enforce a predictable result ordering with <TT CLASS="LITERAL" >ORDER BY</TT >. This is not a bug; it is an inherent consequence of the fact that SQL does not promise to deliver the results of a query in any particular order unless <TT CLASS="LITERAL" >ORDER BY</TT > is used to constrain the order. </P ><P > It is even possible for repeated executions of the same <TT CLASS="LITERAL" >LIMIT</TT > query to return different subsets of the rows of a table, if there is not an <TT CLASS="LITERAL" >ORDER BY</TT > to enforce selection of a deterministic subset. Again, this is not a bug; determinism of the results is simply not guaranteed in such a case. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-FOR-UPDATE-SHARE" ></A ><H3 ><TT CLASS="LITERAL" >FOR UPDATE</TT >/<TT CLASS="LITERAL" >FOR SHARE</TT > Clause</H3 ><P > The <TT CLASS="LITERAL" >FOR UPDATE</TT > clause has this form: </P><PRE CLASS="SYNOPSIS" >FOR UPDATE [ OF <TT CLASS="REPLACEABLE" ><I >table_name</I ></TT > [, ...] ] [ NOWAIT ]</PRE ><P> </P ><P > The closely related <TT CLASS="LITERAL" >FOR SHARE</TT > clause has this form: </P><PRE CLASS="SYNOPSIS" >FOR SHARE [ OF <TT CLASS="REPLACEABLE" ><I >table_name</I ></TT > [, ...] ] [ NOWAIT ]</PRE ><P> </P ><P > <TT CLASS="LITERAL" >FOR UPDATE</TT > causes the rows retrieved by the <TT CLASS="COMMAND" >SELECT</TT > statement to be locked as though for update. This prevents them from being modified or deleted by other transactions until the current transaction ends. That is, other transactions that attempt <TT CLASS="COMMAND" >UPDATE</TT >, <TT CLASS="COMMAND" >DELETE</TT >, or <TT CLASS="COMMAND" >SELECT FOR UPDATE</TT > of these rows will be blocked until the current transaction ends. Also, if an <TT CLASS="COMMAND" >UPDATE</TT >, <TT CLASS="COMMAND" >DELETE</TT >, or <TT CLASS="COMMAND" >SELECT FOR UPDATE</TT > from another transaction has already locked a selected row or rows, <TT CLASS="COMMAND" >SELECT FOR UPDATE</TT > will wait for the other transaction to complete, and will then lock and return the updated row (or no row, if the row was deleted). Within a <TT CLASS="LITERAL" >REPEATABLE READ</TT > or <TT CLASS="LITERAL" >SERIALIZABLE</TT > transaction, however, an error will be thrown if a row to be locked has changed since the transaction started. For further discussion see <A HREF="mvcc.html" >Chapter 13</A >. </P ><P > <TT CLASS="LITERAL" >FOR SHARE</TT > behaves similarly, except that it acquires a shared rather than exclusive lock on each retrieved row. A shared lock blocks other transactions from performing <TT CLASS="COMMAND" >UPDATE</TT >, <TT CLASS="COMMAND" >DELETE</TT >, or <TT CLASS="COMMAND" >SELECT FOR UPDATE</TT > on these rows, but it does not prevent them from performing <TT CLASS="COMMAND" >SELECT FOR SHARE</TT >. </P ><P > To prevent the operation from waiting for other transactions to commit, use the <TT CLASS="LITERAL" >NOWAIT</TT > option. With <TT CLASS="LITERAL" >NOWAIT</TT >, the statement reports an error, rather than waiting, if a selected row cannot be locked immediately. Note that <TT CLASS="LITERAL" >NOWAIT</TT > applies only to the row-level lock(s) — the required <TT CLASS="LITERAL" >ROW SHARE</TT > table-level lock is still taken in the ordinary way (see <A HREF="mvcc.html" >Chapter 13</A >). You can use <A HREF="sql-lock.html" >LOCK</A > with the <TT CLASS="LITERAL" >NOWAIT</TT > option first, if you need to acquire the table-level lock without waiting. </P ><P > If specific tables are named in <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT >, then only rows coming from those tables are locked; any other tables used in the <TT CLASS="COMMAND" >SELECT</TT > are simply read as usual. A <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > clause without a table list affects all tables used in the statement. If <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > is applied to a view or sub-query, it affects all tables used in the view or sub-query. However, <TT CLASS="LITERAL" >FOR UPDATE</TT >/<TT CLASS="LITERAL" >FOR SHARE</TT > do not apply to <TT CLASS="LITERAL" >WITH</TT > queries referenced by the primary query. If you want row locking to occur within a <TT CLASS="LITERAL" >WITH</TT > query, specify <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > within the <TT CLASS="LITERAL" >WITH</TT > query. </P ><P > Multiple <TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT > clauses can be written if it is necessary to specify different locking behavior for different tables. If the same table is mentioned (or implicitly affected) by both <TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT > clauses, then it is processed as <TT CLASS="LITERAL" >FOR UPDATE</TT >. Similarly, a table is processed as <TT CLASS="LITERAL" >NOWAIT</TT > if that is specified in any of the clauses affecting it. </P ><P > <TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT > cannot be used in contexts where returned rows cannot be clearly identified with individual table rows; for example they cannot be used with aggregation. </P ><P > When <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > appears at the top level of a <TT CLASS="COMMAND" >SELECT</TT > query, the rows that are locked are exactly those that are returned by the query; in the case of a join query, the rows locked are those that contribute to returned join rows. In addition, rows that satisfied the query conditions as of the query snapshot will be locked, although they will not be returned if they were updated after the snapshot and no longer satisfy the query conditions. If a <TT CLASS="LITERAL" >LIMIT</TT > is used, locking stops once enough rows have been returned to satisfy the limit (but note that rows skipped over by <TT CLASS="LITERAL" >OFFSET</TT > will get locked). Similarly, if <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > is used in a cursor's query, only rows actually fetched or stepped past by the cursor will be locked. </P ><P > When <TT CLASS="LITERAL" >FOR UPDATE</TT > or <TT CLASS="LITERAL" >FOR SHARE</TT > appears in a sub-<TT CLASS="COMMAND" >SELECT</TT >, the rows locked are those returned to the outer query by the sub-query. This might involve fewer rows than inspection of the sub-query alone would suggest, since conditions from the outer query might be used to optimize execution of the sub-query. For example, </P><PRE CLASS="PROGRAMLISTING" >SELECT * FROM (SELECT * FROM mytable FOR UPDATE) ss WHERE col1 = 5;</PRE ><P> will lock only rows having <TT CLASS="LITERAL" >col1 = 5</TT >, even though that condition is not textually within the sub-query. </P ><DIV CLASS="CAUTION" ><P ></P ><TABLE CLASS="CAUTION" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Caution</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > Avoid locking a row and then modifying it within a later savepoint or <SPAN CLASS="APPLICATION" >PL/pgSQL</SPAN > exception block. A subsequent rollback would cause the lock to be lost. For example: </P><PRE CLASS="PROGRAMLISTING" >BEGIN; SELECT * FROM mytable WHERE key = 1 FOR UPDATE; SAVEPOINT s; UPDATE mytable SET ... WHERE key = 1; ROLLBACK TO s;</PRE ><P> After the <TT CLASS="COMMAND" >ROLLBACK</TT >, the row is effectively unlocked, rather than returned to its pre-savepoint state of being locked but not modified. This hazard occurs if a row locked in the current transaction is updated or deleted, or if a shared lock is upgraded to exclusive: in all these cases, the former lock state is forgotten. If the transaction is then rolled back to a state between the original locking command and the subsequent change, the row will appear not to be locked at all. This is an implementation deficiency which will be addressed in a future release of <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >. </P ></TD ></TR ></TABLE ></DIV ><DIV CLASS="CAUTION" ><P ></P ><TABLE CLASS="CAUTION" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Caution</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > It is possible for a <TT CLASS="COMMAND" >SELECT</TT > command running at the <TT CLASS="LITERAL" >READ COMMITTED</TT > transaction isolation level and using <TT CLASS="LITERAL" >ORDER BY</TT > and <TT CLASS="LITERAL" >FOR UPDATE/SHARE</TT > to return rows out of order. This is because <TT CLASS="LITERAL" >ORDER BY</TT > is applied first. The command sorts the result, but might then block trying to obtain a lock on one or more of the rows. Once the <TT CLASS="LITERAL" >SELECT</TT > unblocks, some of the ordering column values might have been modified, leading to those rows appearing to be out of order (though they are in order in terms of the original column values). This can be worked around at need by placing the <TT CLASS="LITERAL" >FOR UPDATE/SHARE</TT > clause in a sub-query, for example </P><PRE CLASS="PROGRAMLISTING" >SELECT * FROM (SELECT * FROM mytable FOR UPDATE) ss ORDER BY column1;</PRE ><P> Note that this will result in locking all rows of <TT CLASS="STRUCTNAME" >mytable</TT >, whereas <TT CLASS="LITERAL" >FOR UPDATE</TT > at the top level would lock only the actually returned rows. This can make for a significant performance difference, particularly if the <TT CLASS="LITERAL" >ORDER BY</TT > is combined with <TT CLASS="LITERAL" >LIMIT</TT > or other restrictions. So this technique is recommended only if concurrent updates of the ordering columns are expected and a strictly sorted result is required. </P ><P > At the <TT CLASS="LITERAL" >REPEATABLE READ</TT > or <TT CLASS="LITERAL" >SERIALIZABLE</TT > transaction isolation level this would cause a serialization failure (with a <TT CLASS="LITERAL" >SQLSTATE</TT > of <TT CLASS="LITERAL" >'40001'</TT >), so there is no possibility of receiving rows out of order under these isolation levels. </P ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="REFSECT2" ><A NAME="SQL-TABLE" ></A ><H3 ><TT CLASS="LITERAL" >TABLE</TT > Command</H3 ><P > The command </P><PRE CLASS="PROGRAMLISTING" >TABLE <TT CLASS="REPLACEABLE" ><I >name</I ></TT ></PRE ><P> is completely equivalent to </P><PRE CLASS="PROGRAMLISTING" >SELECT * FROM <TT CLASS="REPLACEABLE" ><I >name</I ></TT ></PRE ><P> It can be used as a top-level command or as a space-saving syntax variant in parts of complex queries. </P ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN78429" ></A ><H2 >Examples</H2 ><P > To join the table <TT CLASS="LITERAL" >films</TT > with the table <TT CLASS="LITERAL" >distributors</TT >: </P><PRE CLASS="PROGRAMLISTING" >SELECT f.title, f.did, d.name, f.date_prod, f.kind FROM distributors d, films f WHERE f.did = d.did title | did | name | date_prod | kind -------------------+-----+--------------+------------+---------- The Third Man | 101 | British Lion | 1949-12-23 | Drama The African Queen | 101 | British Lion | 1951-08-11 | Romantic ...</PRE ><P> </P ><P > To sum the column <TT CLASS="LITERAL" >len</TT > of all films and group the results by <TT CLASS="LITERAL" >kind</TT >: </P><PRE CLASS="PROGRAMLISTING" >SELECT kind, sum(len) AS total FROM films GROUP BY kind; kind | total ----------+------- Action | 07:34 Comedy | 02:58 Drama | 14:28 Musical | 06:42 Romantic | 04:38</PRE ><P> </P ><P > To sum the column <TT CLASS="LITERAL" >len</TT > of all films, group the results by <TT CLASS="LITERAL" >kind</TT > and show those group totals that are less than 5 hours: </P><PRE CLASS="PROGRAMLISTING" >SELECT kind, sum(len) AS total FROM films GROUP BY kind HAVING sum(len) < interval '5 hours'; kind | total ----------+------- Comedy | 02:58 Romantic | 04:38</PRE ><P> </P ><P > The following two examples are identical ways of sorting the individual results according to the contents of the second column (<TT CLASS="LITERAL" >name</TT >): </P><PRE CLASS="PROGRAMLISTING" >SELECT * FROM distributors ORDER BY name; SELECT * FROM distributors ORDER BY 2; did | name -----+------------------ 109 | 20th Century Fox 110 | Bavaria Atelier 101 | British Lion 107 | Columbia 102 | Jean Luc Godard 113 | Luso films 104 | Mosfilm 103 | Paramount 106 | Toho 105 | United Artists 111 | Walt Disney 112 | Warner Bros. 108 | Westward</PRE ><P> </P ><P > The next example shows how to obtain the union of the tables <TT CLASS="LITERAL" >distributors</TT > and <TT CLASS="LITERAL" >actors</TT >, restricting the results to those that begin with the letter W in each table. Only distinct rows are wanted, so the key word <TT CLASS="LITERAL" >ALL</TT > is omitted. </P><PRE CLASS="PROGRAMLISTING" >distributors: actors: did | name id | name -----+-------------- ----+---------------- 108 | Westward 1 | Woody Allen 111 | Walt Disney 2 | Warren Beatty 112 | Warner Bros. 3 | Walter Matthau ... ... SELECT distributors.name FROM distributors WHERE distributors.name LIKE 'W%' UNION SELECT actors.name FROM actors WHERE actors.name LIKE 'W%'; name ---------------- Walt Disney Walter Matthau Warner Bros. Warren Beatty Westward Woody Allen</PRE ><P> </P ><P > This example shows how to use a function in the <TT CLASS="LITERAL" >FROM</TT > clause, both with and without a column definition list: </P><PRE CLASS="PROGRAMLISTING" >CREATE FUNCTION distributors(int) RETURNS SETOF distributors AS $$ SELECT * FROM distributors WHERE did = $1; $$ LANGUAGE SQL; SELECT * FROM distributors(111); did | name -----+------------- 111 | Walt Disney CREATE FUNCTION distributors_2(int) RETURNS SETOF record AS $$ SELECT * FROM distributors WHERE did = $1; $$ LANGUAGE SQL; SELECT * FROM distributors_2(111) AS (f1 int, f2 text); f1 | f2 -----+------------- 111 | Walt Disney</PRE ><P> </P ><P > This example shows how to use a simple <TT CLASS="LITERAL" >WITH</TT > clause: </P><PRE CLASS="PROGRAMLISTING" >WITH t AS ( SELECT random() as x FROM generate_series(1, 3) ) SELECT * FROM t UNION ALL SELECT * FROM t x -------------------- 0.534150459803641 0.520092216785997 0.0735620250925422 0.534150459803641 0.520092216785997 0.0735620250925422</PRE ><P> Notice that the <TT CLASS="LITERAL" >WITH</TT > query was evaluated only once, so that we got two sets of the same three random values. </P ><P > This example uses <TT CLASS="LITERAL" >WITH RECURSIVE</TT > to find all subordinates (direct or indirect) of the employee Mary, and their level of indirectness, from a table that shows only direct subordinates: </P><PRE CLASS="PROGRAMLISTING" >WITH RECURSIVE employee_recursive(distance, employee_name, manager_name) AS ( SELECT 1, employee_name, manager_name FROM employee WHERE manager_name = 'Mary' UNION ALL SELECT er.distance + 1, e.employee_name, e.manager_name FROM employee_recursive er, employee e WHERE er.employee_name = e.manager_name ) SELECT distance, employee_name FROM employee_recursive;</PRE ><P> Notice the typical form of recursive queries: an initial condition, followed by <TT CLASS="LITERAL" >UNION</TT >, followed by the recursive part of the query. Be sure that the recursive part of the query will eventually return no tuples, or else the query will loop indefinitely. (See <A HREF="queries-with.html" >Section 7.8</A > for more examples.) </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN78463" ></A ><H2 >Compatibility</H2 ><P > Of course, the <TT CLASS="COMMAND" >SELECT</TT > statement is compatible with the SQL standard. But there are some extensions and some missing features. </P ><DIV CLASS="REFSECT2" ><A NAME="AEN78467" ></A ><H3 >Omitted <TT CLASS="LITERAL" >FROM</TT > Clauses</H3 ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > allows one to omit the <TT CLASS="LITERAL" >FROM</TT > clause. It has a straightforward use to compute the results of simple expressions: </P><PRE CLASS="PROGRAMLISTING" >SELECT 2+2; ?column? ---------- 4</PRE ><P> Some other <ACRONYM CLASS="ACRONYM" >SQL</ACRONYM > databases cannot do this except by introducing a dummy one-row table from which to do the <TT CLASS="COMMAND" >SELECT</TT >. </P ><P > Note that if a <TT CLASS="LITERAL" >FROM</TT > clause is not specified, the query cannot reference any database tables. For example, the following query is invalid: </P><PRE CLASS="PROGRAMLISTING" >SELECT distributors.* WHERE distributors.name = 'Westward';</PRE ><P><SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > releases prior to 8.1 would accept queries of this form, and add an implicit entry to the query's <TT CLASS="LITERAL" >FROM</TT > clause for each table referenced by the query. This is no longer allowed. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78481" ></A ><H3 >Omitting the <TT CLASS="LITERAL" >AS</TT > Key Word</H3 ><P > In the SQL standard, the optional key word <TT CLASS="LITERAL" >AS</TT > can be omitted before an output column name whenever the new column name is a valid column name (that is, not the same as any reserved keyword). <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > is slightly more restrictive: <TT CLASS="LITERAL" >AS</TT > is required if the new column name matches any keyword at all, reserved or not. Recommended practice is to use <TT CLASS="LITERAL" >AS</TT > or double-quote output column names, to prevent any possible conflict against future keyword additions. </P ><P > In <TT CLASS="LITERAL" >FROM</TT > items, both the standard and <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > allow <TT CLASS="LITERAL" >AS</TT > to be omitted before an alias that is an unreserved keyword. But this is impractical for output column names, because of syntactic ambiguities. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78493" ></A ><H3 ><TT CLASS="LITERAL" >ONLY</TT > and Inheritance</H3 ><P > The SQL standard requires parentheses around the table name when writing <TT CLASS="LITERAL" >ONLY</TT >, for example <TT CLASS="LITERAL" >SELECT * FROM ONLY (tab1), ONLY (tab2) WHERE ...</TT >. <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > considers these parentheses to be optional. </P ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > allows a trailing <TT CLASS="LITERAL" >*</TT > to be written to explicitly specify the non-<TT CLASS="LITERAL" >ONLY</TT > behavior of including child tables. The standard does not allow this. </P ><P > (These points apply equally to all SQL commands supporting the <TT CLASS="LITERAL" >ONLY</TT > option.) </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78506" ></A ><H3 >Namespace Available to <TT CLASS="LITERAL" >GROUP BY</TT > and <TT CLASS="LITERAL" >ORDER BY</TT ></H3 ><P > In the SQL-92 standard, an <TT CLASS="LITERAL" >ORDER BY</TT > clause can only use output column names or numbers, while a <TT CLASS="LITERAL" >GROUP BY</TT > clause can only use expressions based on input column names. <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > extends each of these clauses to allow the other choice as well (but it uses the standard's interpretation if there is ambiguity). <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > also allows both clauses to specify arbitrary expressions. Note that names appearing in an expression will always be taken as input-column names, not as output-column names. </P ><P > SQL:1999 and later use a slightly different definition which is not entirely upward compatible with SQL-92. In most cases, however, <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > will interpret an <TT CLASS="LITERAL" >ORDER BY</TT > or <TT CLASS="LITERAL" >GROUP BY</TT > expression the same way SQL:1999 does. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78519" ></A ><H3 >Functional Dependencies</H3 ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > recognizes functional dependency (allowing columns to be omitted from <TT CLASS="LITERAL" >GROUP BY</TT >) only when a table's primary key is included in the <TT CLASS="LITERAL" >GROUP BY</TT > list. The SQL standard specifies additional conditions that should be recognized. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78525" ></A ><H3 ><TT CLASS="LITERAL" >WINDOW</TT > Clause Restrictions</H3 ><P > The SQL standard provides additional options for the window <TT CLASS="REPLACEABLE" ><I >frame_clause</I ></TT >. <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > currently supports only the options listed above. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78531" ></A ><H3 ><TT CLASS="LITERAL" >LIMIT</TT > and <TT CLASS="LITERAL" >OFFSET</TT ></H3 ><P > The clauses <TT CLASS="LITERAL" >LIMIT</TT > and <TT CLASS="LITERAL" >OFFSET</TT > are <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN >-specific syntax, also used by <SPAN CLASS="PRODUCTNAME" >MySQL</SPAN >. The SQL:2008 standard has introduced the clauses <TT CLASS="LITERAL" >OFFSET ... FETCH {FIRST|NEXT} ...</TT > for the same functionality, as shown above in <A HREF="sql-select.html#SQL-LIMIT" ><I ><I >LIMIT</I > Clause</I ></A >. This syntax is also used by <SPAN CLASS="PRODUCTNAME" >IBM DB2</SPAN >. (Applications written for <SPAN CLASS="PRODUCTNAME" >Oracle</SPAN > frequently use a workaround involving the automatically generated <TT CLASS="LITERAL" >rownum</TT > column, which is not available in PostgreSQL, to implement the effects of these clauses.) </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78545" ></A ><H3 ><TT CLASS="LITERAL" >FOR UPDATE</TT > and <TT CLASS="LITERAL" >FOR SHARE</TT ></H3 ><P > Although <TT CLASS="LITERAL" >FOR UPDATE</TT > appears in the SQL standard, the standard allows it only as an option of <TT CLASS="COMMAND" >DECLARE CURSOR</TT >. <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > allows it in any <TT CLASS="COMMAND" >SELECT</TT > query as well as in sub-<TT CLASS="COMMAND" >SELECT</TT >s, but this is an extension. The <TT CLASS="LITERAL" >FOR SHARE</TT > variant, and the <TT CLASS="LITERAL" >NOWAIT</TT > option, do not appear in the standard. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78557" ></A ><H3 >Data-Modifying Statements in <TT CLASS="LITERAL" >WITH</TT ></H3 ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > allows <TT CLASS="COMMAND" >INSERT</TT >, <TT CLASS="COMMAND" >UPDATE</TT >, and <TT CLASS="COMMAND" >DELETE</TT > to be used as <TT CLASS="LITERAL" >WITH</TT > queries. This is not found in the SQL standard. </P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN78566" ></A ><H3 >Nonstandard Clauses</H3 ><P > The clause <TT CLASS="LITERAL" >DISTINCT ON</TT > is not defined in the SQL standard. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="sql-security-label.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="sql-selectinto.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >SECURITY LABEL</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="sql-commands.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >SELECT INTO</TD ></TR ></TABLE ></DIV ></BODY ></HTML >
Submit
FILE
FOLDER
Name
Size
Permission
Action
LEGALNOTICE.html
2681 bytes
0644
acronyms.html
16284 bytes
0644
admin.html
12564 bytes
0644
adminpack.html
7889 bytes
0644
app-clusterdb.html
10602 bytes
0644
app-createdb.html
12856 bytes
0644
app-createlang.html
9907 bytes
0644
app-createuser.html
15640 bytes
0644
app-dropdb.html
9642 bytes
0644
app-droplang.html
9638 bytes
0644
app-dropuser.html
9596 bytes
0644
app-ecpg.html
8718 bytes
0644
app-initdb.html
15405 bytes
0644
app-pg-ctl.html
22459 bytes
0644
app-pg-dumpall.html
20706 bytes
0644
app-pgbasebackup.html
19833 bytes
0644
app-pgconfig.html
11093 bytes
0644
app-pgcontroldata.html
3979 bytes
0644
app-pgdump.html
43964 bytes
0644
app-pgreceivexlog.html
11057 bytes
0644
app-pgresetxlog.html
11566 bytes
0644
app-pgrestore.html
30269 bytes
0644
app-postgres.html
31828 bytes
0644
app-postmaster.html
3005 bytes
0644
app-psql.html
138871 bytes
0644
app-reindexdb.html
11281 bytes
0644
app-vacuumdb.html
12616 bytes
0644
appendixes.html
26329 bytes
0644
applevel-consistency.html
10315 bytes
0644
archive-recovery-settings.html
7338 bytes
0644
arrays.html
28079 bytes
0644
auth-delay.html
3780 bytes
0644
auth-methods.html
36202 bytes
0644
auth-pg-hba-conf.html
29759 bytes
0644
auth-username-maps.html
8597 bytes
0644
auto-explain.html
9887 bytes
0644
backup-dump.html
15927 bytes
0644
backup-file.html
7996 bytes
0644
backup.html
4485 bytes
0644
biblio.html
11549 bytes
0644
bki-commands.html
9646 bytes
0644
bki-example.html
3049 bytes
0644
bki-format.html
3463 bytes
0644
bki-structure.html
4320 bytes
0644
bki.html
4330 bytes
0644
bookindex.html
243165 bytes
0644
btree-gin.html
4600 bytes
0644
btree-gist.html
6884 bytes
0644
bug-reporting.html
18646 bytes
0644
catalog-pg-aggregate.html
5502 bytes
0644
catalog-pg-am.html
10547 bytes
0644
catalog-pg-amop.html
7593 bytes
0644
catalog-pg-amproc.html
4885 bytes
0644
catalog-pg-attrdef.html
4364 bytes
0644
catalog-pg-attribute.html
10287 bytes
0644
catalog-pg-auth-members.html
4255 bytes
0644
catalog-pg-authid.html
6815 bytes
0644
catalog-pg-cast.html
6955 bytes
0644
catalog-pg-class.html
12661 bytes
0644
catalog-pg-collation.html
5897 bytes
0644
catalog-pg-constraint.html
11579 bytes
0644
catalog-pg-conversion.html
4430 bytes
0644
catalog-pg-database.html
7027 bytes
0644
catalog-pg-db-role-setting.html
4068 bytes
0644
catalog-pg-default-acl.html
5267 bytes
0644
catalog-pg-depend.html
8635 bytes
0644
catalog-pg-description.html
4478 bytes
0644
catalog-pg-enum.html
4716 bytes
0644
catalog-pg-extension.html
5282 bytes
0644
catalog-pg-foreign-data-wrapper.html
4945 bytes
0644
catalog-pg-foreign-server.html
4688 bytes
0644
catalog-pg-foreign-table.html
4036 bytes
0644
catalog-pg-index.html
8868 bytes
0644
catalog-pg-inherits.html
3888 bytes
0644
catalog-pg-language.html
5952 bytes
0644
catalog-pg-largeobject-metadata.html
3630 bytes
0644
catalog-pg-largeobject.html
5154 bytes
0644
catalog-pg-namespace.html
3751 bytes
0644
catalog-pg-opclass.html
5863 bytes
0644
catalog-pg-operator.html
6645 bytes
0644
catalog-pg-opfamily.html
4811 bytes
0644
catalog-pg-pltemplate.html
5364 bytes
0644
catalog-pg-proc.html
13403 bytes
0644
catalog-pg-range.html
5182 bytes
0644
catalog-pg-rewrite.html
5391 bytes
0644
catalog-pg-seclabel.html
4515 bytes
0644
catalog-pg-shdepend.html
7043 bytes
0644
catalog-pg-shdescription.html
4247 bytes
0644
catalog-pg-shseclabel.html
4404 bytes
0644
catalog-pg-statistic.html
9538 bytes
0644
catalog-pg-tablespace.html
4158 bytes
0644
catalog-pg-trigger.html
8287 bytes
0644
catalog-pg-ts-config-map.html
4193 bytes
0644
catalog-pg-ts-config.html
4481 bytes
0644
catalog-pg-ts-dict.html
4716 bytes
0644
catalog-pg-ts-parser.html
5082 bytes
0644
catalog-pg-ts-template.html
4258 bytes
0644
catalog-pg-type.html
19905 bytes
0644
catalog-pg-user-mapping.html
3847 bytes
0644
catalogs-overview.html
10431 bytes
0644
catalogs.html
10387 bytes
0644
charset.html
4162 bytes
0644
chkpass.html
4391 bytes
0644
citext.html
11148 bytes
0644
client-authentication-problems.html
4224 bytes
0644
client-authentication.html
5914 bytes
0644
client-interfaces.html
13717 bytes
0644
collation.html
14222 bytes
0644
config-setting.html
11146 bytes
0644
connect-estab.html
4315 bytes
0644
continuous-archiving.html
49830 bytes
0644
contrib-dblink-build-sql-delete.html
5451 bytes
0644
contrib-dblink-build-sql-insert.html
6052 bytes
0644
contrib-dblink-build-sql-update.html
6281 bytes
0644
contrib-dblink-cancel-query.html
3820 bytes
0644
contrib-dblink-close.html
4650 bytes
0644
contrib-dblink-connect-u.html
4482 bytes
0644
contrib-dblink-connect.html
7325 bytes
0644
contrib-dblink-disconnect.html
3718 bytes
0644
contrib-dblink-error-message.html
3508 bytes
0644
contrib-dblink-exec.html
5466 bytes
0644
contrib-dblink-fetch.html
5979 bytes
0644
contrib-dblink-function.html
8630 bytes
0644
contrib-dblink-get-connections.html
3206 bytes
0644
contrib-dblink-get-notify.html
4168 bytes
0644
contrib-dblink-get-pkey.html
4498 bytes
0644
contrib-dblink-get-result.html
6959 bytes
0644
contrib-dblink-is-busy.html
3490 bytes
0644
contrib-dblink-open.html
5464 bytes
0644
contrib-dblink-send-query.html
4170 bytes
0644
contrib-prog-client.html
3434 bytes
0644
contrib-prog-server.html
3837 bytes
0644
contrib-prog.html
3320 bytes
0644
contrib-spi.html
11236 bytes
0644
contrib.html
8904 bytes
0644
creating-cluster.html
12465 bytes
0644
cube.html
15941 bytes
0644
database-roles.html
6092 bytes
0644
datatype-binary.html
12893 bytes
0644
datatype-bit.html
5096 bytes
0644
datatype-boolean.html
5267 bytes
0644
datatype-character.html
11893 bytes
0644
datatype-datetime.html
50763 bytes
0644
datatype-enum.html
6433 bytes
0644
datatype-geometric.html
12503 bytes
0644
datatype-json.html
3439 bytes
0644
datatype-money.html
5482 bytes
0644
datatype-net-types.html
10423 bytes
0644
datatype-numeric.html
22353 bytes
0644
datatype-oid.html
9686 bytes
0644
datatype-pseudo.html
7285 bytes
0644
datatype-textsearch.html
10033 bytes
0644
datatype-uuid.html
4560 bytes
0644
datatype-xml.html
11334 bytes
0644
datatype.html
16609 bytes
0644
datetime-appendix.html
3525 bytes
0644
datetime-config-files.html
8980 bytes
0644
datetime-input-rules.html
6763 bytes
0644
datetime-keywords.html
5096 bytes
0644
datetime-units-history.html
7634 bytes
0644
dblink.html
5322 bytes
0644
ddl-alter.html
10498 bytes
0644
ddl-basics.html
7816 bytes
0644
ddl-constraints.html
22790 bytes
0644
ddl-default.html
4540 bytes
0644
ddl-depend.html
6498 bytes
0644
ddl-foreign-data.html
4485 bytes
0644
ddl-inherit.html
15308 bytes
0644
ddl-others.html
3080 bytes
0644
ddl-partitioning.html
27763 bytes
0644
ddl-priv.html
6066 bytes
0644
ddl-schemas.html
18046 bytes
0644
ddl-system-columns.html
8049 bytes
0644
ddl.html
6382 bytes
0644
dict-int.html
4793 bytes
0644
dict-xsyn.html
6481 bytes
0644
different-replication-solutions.html
14793 bytes
0644
disk-full.html
3517 bytes
0644
disk-usage.html
5661 bytes
0644
diskusage.html
2668 bytes
0644
dml-delete.html
3565 bytes
0644
dml-insert.html
5801 bytes
0644
dml-returning.html
5104 bytes
0644
dml-update.html
5556 bytes
0644
dml.html
2944 bytes
0644
docguide-authoring.html
6757 bytes
0644
docguide-build.html
15280 bytes
0644
docguide-docbook.html
3853 bytes
0644
docguide-style.html
7429 bytes
0644
docguide-toolsets.html
20683 bytes
0644
docguide.html
3624 bytes
0644
dummy-seclabel.html
4358 bytes
0644
dynamic-trace.html
27234 bytes
0644
earthdistance.html
8806 bytes
0644
ecpg-commands.html
9527 bytes
0644
ecpg-concept.html
4979 bytes
0644
ecpg-connect.html
10826 bytes
0644
ecpg-cpp.html
9624 bytes
0644
ecpg-descriptors.html
34909 bytes
0644
ecpg-develop.html
7964 bytes
0644
ecpg-dynamic.html
6515 bytes
0644
ecpg-errors.html
25737 bytes
0644
ecpg-informix-compat.html
52760 bytes
0644
ecpg-library.html
5798 bytes
0644
ecpg-lo.html
5527 bytes
0644
ecpg-pgtypes.html
54457 bytes
0644
ecpg-preproc.html
8985 bytes
0644
ecpg-process.html
5386 bytes
0644
ecpg-sql-allocate-descriptor.html
3983 bytes
0644
ecpg-sql-commands.html
4698 bytes
0644
ecpg-sql-connect.html
9375 bytes
0644
ecpg-sql-deallocate-descriptor.html
3773 bytes
0644
ecpg-sql-declare.html
5397 bytes
0644
ecpg-sql-describe.html
4595 bytes
0644
ecpg-sql-disconnect.html
4733 bytes
0644
ecpg-sql-execute-immediate.html
3877 bytes
0644
ecpg-sql-get-descriptor.html
7709 bytes
0644
ecpg-sql-open.html
4642 bytes
0644
ecpg-sql-prepare.html
4177 bytes
0644
ecpg-sql-set-autocommit.html
3333 bytes
0644
ecpg-sql-set-connection.html
3929 bytes
0644
ecpg-sql-set-descriptor.html
5505 bytes
0644
ecpg-sql-type.html
5026 bytes
0644
ecpg-sql-var.html
3539 bytes
0644
ecpg-sql-whenever.html
4686 bytes
0644
ecpg-variables.html
40283 bytes
0644
ecpg.html
10344 bytes
0644
encryption-options.html
7495 bytes
0644
errcodes-appendix.html
36965 bytes
0644
error-message-reporting.html
14124 bytes
0644
error-style-guide.html
16769 bytes
0644
event-log-registration.html
4188 bytes
0644
executor.html
6612 bytes
0644
explicit-joins.html
11019 bytes
0644
explicit-locking.html
25073 bytes
0644
extend-extensions.html
32430 bytes
0644
extend-how.html
4552 bytes
0644
extend-pgxs.html
11761 bytes
0644
extend-type-system.html
10111 bytes
0644
extend.html
9982 bytes
0644
external-admin-tools.html
2722 bytes
0644
external-extensions.html
3263 bytes
0644
external-interfaces.html
5513 bytes
0644
external-pl.html
4670 bytes
0644
external-projects.html
3004 bytes
0644
fdw-callbacks.html
12905 bytes
0644
fdw-functions.html
4496 bytes
0644
fdw-helpers.html
5988 bytes
0644
fdw-planning.html
9845 bytes
0644
fdwhandler.html
3990 bytes
0644
features-sql-standard.html
39105 bytes
0644
features.html
7566 bytes
0644
file-fdw.html
7709 bytes
0644
functions-admin.html
50395 bytes
0644
functions-aggregate.html
21814 bytes
0644
functions-array.html
13521 bytes
0644
functions-binarystring.html
12588 bytes
0644
functions-bitstring.html
6786 bytes
0644
functions-comparison.html
10638 bytes
0644
functions-comparisons.html
13531 bytes
0644
functions-conditional.html
11007 bytes
0644
functions-datetime.html
48303 bytes
0644
functions-enum.html
5491 bytes
0644
functions-formatting.html
35401 bytes
0644
functions-geometry.html
20347 bytes
0644
functions-info.html
58658 bytes
0644
functions-json.html
3814 bytes
0644
functions-logical.html
4665 bytes
0644
functions-matching.html
75728 bytes
0644
functions-math.html
20401 bytes
0644
functions-net.html
13502 bytes
0644
functions-range.html
10857 bytes
0644
functions-sequence.html
12925 bytes
0644
functions-srf.html
8840 bytes
0644
functions-string.html
59052 bytes
0644
functions-subquery.html
16381 bytes
0644
functions-textsearch.html
20488 bytes
0644
functions-trigger.html
4548 bytes
0644
functions-window.html
12085 bytes
0644
functions-xml.html
32169 bytes
0644
functions.html
9939 bytes
0644
fuzzystrmatch.html
8061 bytes
0644
geqo-biblio.html
3459 bytes
0644
geqo-intro.html
4415 bytes
0644
geqo-intro2.html
5627 bytes
0644
geqo-pg-intro.html
8785 bytes
0644
geqo.html
3616 bytes
0644
gin-examples.html
3322 bytes
0644
gin-extensibility.html
14402 bytes
0644
gin-implementation.html
6564 bytes
0644
gin-intro.html
4662 bytes
0644
gin-limit.html
2817 bytes
0644
gin-tips.html
5713 bytes
0644
gin.html
2929 bytes
0644
gist-examples.html
3752 bytes
0644
gist-extensibility.html
24354 bytes
0644
gist-implementation.html
4101 bytes
0644
gist-intro.html
3616 bytes
0644
gist.html
2679 bytes
0644
git.html
4564 bytes
0644
high-availability.html
7698 bytes
0644
history.html
11918 bytes
0644
hot-standby.html
36045 bytes
0644
hstore.html
22629 bytes
0644
index-catalog.html
7996 bytes
0644
index-cost-estimation.html
9991 bytes
0644
index-functions.html
19114 bytes
0644
index-locking.html
8049 bytes
0644
index-scanning.html
10707 bytes
0644
index-unique-checks.html
9192 bytes
0644
index.html
8071 bytes
0644
indexam.html
5247 bytes
0644
indexes-bitmap-scans.html
6580 bytes
0644
indexes-collations.html
3640 bytes
0644
indexes-examine.html
7161 bytes
0644
indexes-expressional.html
4813 bytes
0644
indexes-intro.html
6313 bytes
0644
indexes-multicolumn.html
6298 bytes
0644
indexes-opclass.html
7336 bytes
0644
indexes-ordering.html
6480 bytes
0644
indexes-partial.html
11812 bytes
0644
indexes-types.html
10233 bytes
0644
indexes-unique.html
4002 bytes
0644
indexes.html
3619 bytes
0644
information-schema.html
11177 bytes
0644
infoschema-administrable-role-authorizations.html
3751 bytes
0644
infoschema-applicable-roles.html
3970 bytes
0644
infoschema-attributes.html
12807 bytes
0644
infoschema-character-sets.html
7050 bytes
0644
infoschema-check-constraint-routine-usage.html
4349 bytes
0644
infoschema-check-constraints.html
3876 bytes
0644
infoschema-collation-character-set-applicab.html
4425 bytes
0644
infoschema-collations.html
3885 bytes
0644
infoschema-column-domain-usage.html
4322 bytes
0644
infoschema-column-options.html
4109 bytes
0644
infoschema-column-privileges.html
5029 bytes
0644
infoschema-column-udt-usage.html
4583 bytes
0644
infoschema-columns.html
17625 bytes
0644
infoschema-constraint-column-usage.html
4873 bytes
0644
infoschema-constraint-table-usage.html
4774 bytes
0644
infoschema-data-type-privileges.html
5089 bytes
0644
infoschema-datatypes.html
4229 bytes
0644
infoschema-domain-constraints.html
4664 bytes
0644
infoschema-domain-udt-usage.html
4171 bytes
0644
infoschema-domains.html
11367 bytes
0644
infoschema-element-types.html
11374 bytes
0644
infoschema-enabled-roles.html
3780 bytes
0644
infoschema-foreign-data-wrapper-options.html
3910 bytes
0644
infoschema-foreign-data-wrappers.html
4227 bytes
0644
infoschema-foreign-server-options.html
3853 bytes
0644
infoschema-foreign-servers.html
4571 bytes
0644
infoschema-foreign-table-options.html
3974 bytes
0644
infoschema-foreign-tables.html
4072 bytes
0644
infoschema-information-schema-catalog-name.html
3357 bytes
0644
infoschema-key-column-usage.html
5185 bytes
0644
infoschema-parameters.html
10799 bytes
0644
infoschema-referential-constraints.html
5664 bytes
0644
infoschema-role-column-grants.html
5017 bytes
0644
infoschema-role-routine-grants.html
5360 bytes
0644
infoschema-role-table-grants.html
5427 bytes
0644
infoschema-role-udt-grants.html
4781 bytes
0644
infoschema-role-usage-grants.html
5010 bytes
0644
infoschema-routine-privileges.html
5032 bytes
0644
infoschema-routines.html
23052 bytes
0644
infoschema-schema.html
3180 bytes
0644
infoschema-schemata.html
4248 bytes
0644
infoschema-sequences.html
6111 bytes
0644
infoschema-sql-features.html
4708 bytes
0644
infoschema-sql-implementation-info.html
4503 bytes
0644
infoschema-sql-languages.html
5094 bytes
0644
infoschema-sql-packages.html
4178 bytes
0644
infoschema-sql-parts.html
4080 bytes
0644
infoschema-sql-sizing-profiles.html
4177 bytes
0644
infoschema-sql-sizing.html
4101 bytes
0644
infoschema-table-constraints.html
4914 bytes
0644
infoschema-table-privileges.html
5097 bytes
0644
infoschema-tables.html
5957 bytes
0644
infoschema-triggered-update-columns.html
4554 bytes
0644
infoschema-triggers.html
9447 bytes
0644
infoschema-udt-privileges.html
4509 bytes
0644
infoschema-usage-privileges.html
5512 bytes
0644
infoschema-user-defined-types.html
9753 bytes
0644
infoschema-user-mapping-options.html
4449 bytes
0644
infoschema-user-mappings.html
3833 bytes
0644
infoschema-view-column-usage.html
4728 bytes
0644
infoschema-view-routine-usage.html
4368 bytes
0644
infoschema-view-table-usage.html
4389 bytes
0644
infoschema-views.html
5529 bytes
0644
install-getsource.html
3574 bytes
0644
install-post.html
8076 bytes
0644
install-procedure.html
46527 bytes
0644
install-requirements.html
14481 bytes
0644
install-short.html
2870 bytes
0644
install-windows-full.html
19274 bytes
0644
install-windows-libpq.html
6283 bytes
0644
install-windows.html
6620 bytes
0644
installation-platform-notes.html
39380 bytes
0644
installation.html
4160 bytes
0644
intagg.html
6254 bytes
0644
intarray.html
13757 bytes
0644
internals.html
15638 bytes
0644
intro-whatis.html
4011 bytes
0644
isn.html
13356 bytes
0644
kernel-resources.html
37822 bytes
0644
largeobjects.html
4675 bytes
0644
libpq-async.html
21020 bytes
0644
libpq-build.html
6369 bytes
0644
libpq-cancel.html
6777 bytes
0644
libpq-connect.html
51248 bytes
0644
libpq-control.html
6280 bytes
0644
libpq-copy.html
22442 bytes
0644
libpq-envars.html
9820 bytes
0644
libpq-events.html
23093 bytes
0644
libpq-example.html
16024 bytes
0644
libpq-exec.html
64877 bytes
0644
libpq-fastpath.html
6124 bytes
0644
libpq-ldap.html
5506 bytes
0644
libpq-misc.html
13815 bytes
0644
libpq-notice-processing.html
6284 bytes
0644
libpq-notify.html
6715 bytes
0644
libpq-pgpass.html
4861 bytes
0644
libpq-pgservice.html
3905 bytes
0644
libpq-single-row-mode.html
6353 bytes
0644
libpq-ssl.html
19972 bytes
0644
libpq-status.html
17695 bytes
0644
libpq-threading.html
5544 bytes
0644
libpq.html
7918 bytes
0644
lo-examplesect.html
8696 bytes
0644
lo-funcs.html
4640 bytes
0644
lo-implementation.html
3353 bytes
0644
lo-interfaces.html
15155 bytes
0644
lo-intro.html
3206 bytes
0644
lo.html
6627 bytes
0644
locale.html
13691 bytes
0644
locking-indexes.html
4350 bytes
0644
log-shipping-alternative.html
11057 bytes
0644
logfile-maintenance.html
7143 bytes
0644
ltree.html
27295 bytes
0644
maintenance.html
5538 bytes
0644
manage-ag-config.html
3746 bytes
0644
manage-ag-createdb.html
6310 bytes
0644
manage-ag-dropdb.html
3605 bytes
0644
manage-ag-overview.html
5144 bytes
0644
manage-ag-tablespaces.html
9250 bytes
0644
manage-ag-templatedbs.html
8162 bytes
0644
managing-databases.html
3273 bytes
0644
monitoring-locks.html
3673 bytes
0644
monitoring-ps.html
6782 bytes
0644
monitoring-stats.html
58063 bytes
0644
monitoring.html
4458 bytes
0644
multibyte.html
31965 bytes
0644
mvcc-caveats.html
4077 bytes
0644
mvcc-intro.html
4552 bytes
0644
mvcc.html
4302 bytes
0644
nls-programmer.html
10078 bytes
0644
nls-translator.html
14522 bytes
0644
nls.html
3134 bytes
0644
non-durability.html
4484 bytes
0644
notation.html
4415 bytes
0644
oid2name.html
11962 bytes
0644
overview.html
4093 bytes
0644
pageinspect.html
8117 bytes
0644
parser-stage.html
8117 bytes
0644
passwordcheck.html
4788 bytes
0644
performance-tips.html
4501 bytes
0644
perm-functions.html
3338 bytes
0644
pgarchivecleanup.html
8999 bytes
0644
pgbench.html
30833 bytes
0644
pgbuffercache.html
7715 bytes
0644
pgcrypto.html
38804 bytes
0644
pgfreespacemap.html
5230 bytes
0644
pgrowlocks.html
6078 bytes
0644
pgstandby.html
15204 bytes
0644
pgstatstatements.html
16068 bytes
0644
pgstattuple.html
9449 bytes
0644
pgtestfsync.html
5254 bytes
0644
pgtesttiming.html
12476 bytes
0644
pgtrgm.html
12333 bytes
0644
pgupgrade.html
24737 bytes
0644
planner-optimizer.html
9396 bytes
0644
planner-stats-details.html
3276 bytes
0644
planner-stats-security.html
5556 bytes
0644
planner-stats.html
9058 bytes
0644
plhandler.html
13748 bytes
0644
plperl-builtins.html
18276 bytes
0644
plperl-data.html
2878 bytes
0644
plperl-funcs.html
13369 bytes
0644
plperl-global.html
5067 bytes
0644
plperl-triggers.html
6446 bytes
0644
plperl-trusted.html
6712 bytes
0644
plperl-under-the-hood.html
8991 bytes
0644
plperl.html
4930 bytes
0644
plpgsql-control-structures.html
46183 bytes
0644
plpgsql-cursors.html
25586 bytes
0644
plpgsql-declarations.html
21746 bytes
0644
plpgsql-development-tips.html
9511 bytes
0644
plpgsql-errors-and-messages.html
10094 bytes
0644
plpgsql-expressions.html
4662 bytes
0644
plpgsql-implementation.html
18043 bytes
0644
plpgsql-overview.html
9032 bytes
0644
plpgsql-porting.html
27094 bytes
0644
plpgsql-statements.html
32221 bytes
0644
plpgsql-structure.html
8329 bytes
0644
plpgsql-trigger.html
22322 bytes
0644
plpgsql.html
6965 bytes
0644
plpython-data.html
14648 bytes
0644
plpython-database.html
15413 bytes
0644
plpython-do.html
2771 bytes
0644
plpython-envar.html
3885 bytes
0644
plpython-funcs.html
5478 bytes
0644
plpython-python23.html
7207 bytes
0644
plpython-sharing.html
3032 bytes
0644
plpython-subtransaction.html
7888 bytes
0644
plpython-trigger.html
5069 bytes
0644
plpython-util.html
5104 bytes
0644
plpython.html
6067 bytes
0644
pltcl-data.html
2906 bytes
0644
pltcl-dbaccess.html
13902 bytes
0644
pltcl-functions.html
6177 bytes
0644
pltcl-global.html
5066 bytes
0644
pltcl-overview.html
5288 bytes
0644
pltcl-procnames.html
3222 bytes
0644
pltcl-trigger.html
9452 bytes
0644
pltcl-unknown.html
5075 bytes
0644
pltcl.html
3400 bytes
0644
populate.html
17114 bytes
0644
postgres-user.html
3314 bytes
0644
preface.html
5070 bytes
0644
preventing-server-spoofing.html
4604 bytes
0644
protocol-changes.html
6650 bytes
0644
protocol-error-fields.html
6131 bytes
0644
protocol-flow.html
46202 bytes
0644
protocol-message-formats.html
40844 bytes
0644
protocol-message-types.html
4933 bytes
0644
protocol-overview.html
9670 bytes
0644
protocol-replication.html
14666 bytes
0644
protocol.html
5652 bytes
0644
queries-limit.html
5335 bytes
0644
queries-order.html
7369 bytes
0644
queries-overview.html
5068 bytes
0644
queries-select-lists.html
9308 bytes
0644
queries-table-expressions.html
39874 bytes
0644
queries-union.html
5114 bytes
0644
queries-values.html
4930 bytes
0644
queries-with.html
20880 bytes
0644
queries.html
4418 bytes
0644
query-path.html
5470 bytes
0644
querytree.html
11136 bytes
0644
rangetypes.html
22735 bytes
0644
recovery-config.html
3550 bytes
0644
recovery-target-settings.html
7762 bytes
0644
reference-client.html
6102 bytes
0644
reference-server.html
3964 bytes
0644
reference.html
23162 bytes
0644
regress-coverage.html
3325 bytes
0644
regress-evaluation.html
12487 bytes
0644
regress-run.html
13710 bytes
0644
regress-variant.html
7177 bytes
0644
regress.html
4277 bytes
0644
release-0-01.html
2555 bytes
0644
release-0-02.html
4292 bytes
0644
release-0-03.html
7798 bytes
0644
release-1-0.html
4229 bytes
0644
release-1-01.html
9346 bytes
0644
release-1-02.html
6489 bytes
0644
release-1-09.html
2525 bytes
0644
release-6-0.html
7920 bytes
0644
release-6-1-1.html
3719 bytes
0644
release-6-1.html
9025 bytes
0644
release-6-2-1.html
4405 bytes
0644
release-6-2.html
8883 bytes
0644
release-6-3-1.html
4444 bytes
0644
release-6-3-2.html
4157 bytes
0644
release-6-3.html
16311 bytes
0644
release-6-4-1.html
4061 bytes
0644
release-6-4-2.html
2908 bytes
0644
release-6-4.html
14732 bytes
0644
release-6-5-1.html
3842 bytes
0644
release-6-5-2.html
4102 bytes
0644
release-6-5-3.html
3053 bytes
0644
release-6-5.html
17387 bytes
0644
release-7-0-1.html
3920 bytes
0644
release-7-0-2.html
2887 bytes
0644
release-7-0-3.html
4656 bytes
0644
release-7-0.html
23104 bytes
0644
release-7-1-1.html
3262 bytes
0644
release-7-1-2.html
2975 bytes
0644
release-7-1-3.html
3139 bytes
0644
release-7-1.html
13017 bytes
0644
release-7-2-1.html
4011 bytes
0644
release-7-2-2.html
3793 bytes
0644
release-7-2-3.html
3364 bytes
0644
release-7-2-4.html
3587 bytes
0644
release-7-2-5.html
3746 bytes
0644
release-7-2-6.html
3624 bytes
0644
release-7-2-7.html
3726 bytes
0644
release-7-2-8.html
3948 bytes
0644
release-7-2.html
27098 bytes
0644
release-7-3-1.html
4168 bytes
0644
release-7-3-10.html
7493 bytes
0644
release-7-3-11.html
4111 bytes
0644
release-7-3-12.html
3527 bytes
0644
release-7-3-13.html
4618 bytes
0644
release-7-3-14.html
3931 bytes
0644
release-7-3-15.html
6315 bytes
0644
release-7-3-16.html
3424 bytes
0644
release-7-3-17.html
3550 bytes
0644
release-7-3-18.html
3647 bytes
0644
release-7-3-19.html
3686 bytes
0644
release-7-3-2.html
5205 bytes
0644
release-7-3-20.html
3524 bytes
0644
release-7-3-21.html
6216 bytes
0644
release-7-3-3.html
10290 bytes
0644
release-7-3-4.html
3502 bytes
0644
release-7-3-5.html
4493 bytes
0644
release-7-3-6.html
4428 bytes
0644
release-7-3-7.html
3352 bytes
0644
release-7-3-8.html
3571 bytes
0644
release-7-3-9.html
4079 bytes
0644
release-7-3.html
33053 bytes
0644
release-7-4-1.html
7116 bytes
0644
release-7-4-10.html
3806 bytes
0644
release-7-4-11.html
4857 bytes
0644
release-7-4-12.html
4221 bytes
0644
release-7-4-13.html
6961 bytes
0644
release-7-4-14.html
3673 bytes
0644
release-7-4-15.html
4270 bytes
0644
release-7-4-16.html
3972 bytes
0644
release-7-4-17.html
4013 bytes
0644
release-7-4-18.html
3927 bytes
0644
release-7-4-19.html
7242 bytes
0644
release-7-4-2.html
8260 bytes
0644
release-7-4-20.html
6605 bytes
0644
release-7-4-21.html
3922 bytes
0644
release-7-4-22.html
4071 bytes
0644
release-7-4-23.html
4423 bytes
0644
release-7-4-24.html
4289 bytes
0644
release-7-4-25.html
4506 bytes
0644
release-7-4-26.html
5455 bytes
0644
release-7-4-27.html
5164 bytes
0644
release-7-4-28.html
5629 bytes
0644
release-7-4-29.html
6960 bytes
0644
release-7-4-3.html
4615 bytes
0644
release-7-4-30.html
6211 bytes
0644
release-7-4-4.html
4085 bytes
0644
release-7-4-5.html
3194 bytes
0644
release-7-4-6.html
4731 bytes
0644
release-7-4-7.html
4274 bytes
0644
release-7-4-8.html
10156 bytes
0644
release-7-4-9.html
5118 bytes
0644
release-7-4.html
57378 bytes
0644
release-8-0-1.html
4744 bytes
0644
release-8-0-10.html
4751 bytes
0644
release-8-0-11.html
3969 bytes
0644
release-8-0-12.html
3134 bytes
0644
release-8-0-13.html
4118 bytes
0644
release-8-0-14.html
4518 bytes
0644
release-8-0-15.html
9101 bytes
0644
release-8-0-16.html
8946 bytes
0644
release-8-0-17.html
3920 bytes
0644
release-8-0-18.html
5579 bytes
0644
release-8-0-19.html
4976 bytes
0644
release-8-0-2.html
9566 bytes
0644
release-8-0-20.html
4312 bytes
0644
release-8-0-21.html
4504 bytes
0644
release-8-0-22.html
6440 bytes
0644
release-8-0-23.html
6023 bytes
0644
release-8-0-24.html
7002 bytes
0644
release-8-0-25.html
7427 bytes
0644
release-8-0-26.html
8026 bytes
0644
release-8-0-3.html
7425 bytes
0644
release-8-0-4.html
6680 bytes
0644
release-8-0-5.html
4816 bytes
0644
release-8-0-6.html
5694 bytes
0644
release-8-0-7.html
5909 bytes
0644
release-8-0-8.html
7225 bytes
0644
release-8-0-9.html
4306 bytes
0644
release-8-0.html
66818 bytes
0644
release-8-1-1.html
5459 bytes
0644
release-8-1-10.html
4781 bytes
0644
release-8-1-11.html
9946 bytes
0644
release-8-1-12.html
9341 bytes
0644
release-8-1-13.html
4292 bytes
0644
release-8-1-14.html
6901 bytes
0644
release-8-1-15.html
6274 bytes
0644
release-8-1-16.html
5278 bytes
0644
release-8-1-17.html
6035 bytes
0644
release-8-1-18.html
6442 bytes
0644
release-8-1-19.html
6612 bytes
0644
release-8-1-2.html
6335 bytes
0644
release-8-1-20.html
7298 bytes
0644
release-8-1-21.html
7213 bytes
0644
release-8-1-22.html
8324 bytes
0644
release-8-1-23.html
7933 bytes
0644
release-8-1-3.html
7026 bytes
0644
release-8-1-4.html
8873 bytes
0644
release-8-1-5.html
5479 bytes
0644
release-8-1-6.html
5337 bytes
0644
release-8-1-7.html
4558 bytes
0644
release-8-1-8.html
3116 bytes
0644
release-8-1-9.html
4388 bytes
0644
release-8-1.html
62113 bytes
0644
release-8-2-1.html
5065 bytes
0644
release-8-2-10.html
8180 bytes
0644
release-8-2-11.html
7147 bytes
0644
release-8-2-12.html
6748 bytes
0644
release-8-2-13.html
7348 bytes
0644
release-8-2-14.html
7876 bytes
0644
release-8-2-15.html
8155 bytes
0644
release-8-2-16.html
9293 bytes
0644
release-8-2-17.html
8214 bytes
0644
release-8-2-18.html
10277 bytes
0644
release-8-2-19.html
8589 bytes
0644
release-8-2-2.html
5802 bytes
0644
release-8-2-20.html
6244 bytes
0644
release-8-2-21.html
5593 bytes
0644
release-8-2-22.html
9617 bytes
0644
release-8-2-23.html
9559 bytes
0644
release-8-2-3.html
3095 bytes
0644
release-8-2-4.html
5428 bytes
0644
release-8-2-5.html
5995 bytes
0644
release-8-2-6.html
10551 bytes
0644
release-8-2-7.html
9311 bytes
0644
release-8-2-8.html
7521 bytes
0644
release-8-2-9.html
4281 bytes
0644
release-8-2.html
69398 bytes
0644
release-8-3-1.html
10585 bytes
0644
release-8-3-10.html
10725 bytes
0644
release-8-3-11.html
8963 bytes
0644
release-8-3-12.html
12119 bytes
0644
release-8-3-13.html
9506 bytes
0644
release-8-3-14.html
6242 bytes
0644
release-8-3-15.html
6381 bytes
0644
release-8-3-16.html
11015 bytes
0644
release-8-3-17.html
10590 bytes
0644
release-8-3-18.html
11265 bytes
0644
release-8-3-19.html
8466 bytes
0644
release-8-3-2.html
12203 bytes
0644
release-8-3-20.html
9251 bytes
0644
release-8-3-21.html
5034 bytes
0644
release-8-3-22.html
10585 bytes
0644
release-8-3-23.html
6284 bytes
0644
release-8-3-3.html
4275 bytes
0644
release-8-3-4.html
11273 bytes
0644
release-8-3-5.html
8689 bytes
0644
release-8-3-6.html
9197 bytes
0644
release-8-3-7.html
9729 bytes
0644
release-8-3-8.html
9260 bytes
0644
release-8-3-9.html
10206 bytes
0644
release-8-3.html
69773 bytes
0644
release-8-4-1.html
9563 bytes
0644
release-8-4-10.html
11932 bytes
0644
release-8-4-11.html
13787 bytes
0644
release-8-4-12.html
9987 bytes
0644
release-8-4-13.html
9714 bytes
0644
release-8-4-14.html
5117 bytes
0644
release-8-4-15.html
10626 bytes
0644
release-8-4-16.html
7329 bytes
0644
release-8-4-17.html
9572 bytes
0644
release-8-4-18.html
7048 bytes
0644
release-8-4-19.html
7780 bytes
0644
release-8-4-2.html
15697 bytes
0644
release-8-4-20.html
16258 bytes
0644
release-8-4-21.html
5450 bytes
0644
release-8-4-22.html
11306 bytes
0644
release-8-4-3.html
13928 bytes
0644
release-8-4-4.html
10736 bytes
0644
release-8-4-5.html
15933 bytes
0644
release-8-4-6.html
10430 bytes
0644
release-8-4-7.html
6220 bytes
0644
release-8-4-8.html
8850 bytes
0644
release-8-4-9.html
14528 bytes
0644
release-8-4.html
87976 bytes
0644
release-9-0-1.html
5946 bytes
0644
release-9-0-10.html
5693 bytes
0644
release-9-0-11.html
12666 bytes
0644
release-9-0-12.html
8824 bytes
0644
release-9-0-13.html
11671 bytes
0644
release-9-0-14.html
8759 bytes
0644
release-9-0-15.html
9147 bytes
0644
release-9-0-16.html
17408 bytes
0644
release-9-0-17.html
6335 bytes
0644
release-9-0-18.html
11879 bytes
0644
release-9-0-19.html
26610 bytes
0644
release-9-0-2.html
13636 bytes
0644
release-9-0-20.html
15836 bytes
0644
release-9-0-21.html
5166 bytes
0644
release-9-0-22.html
4321 bytes
0644
release-9-0-23.html
16158 bytes
0644
release-9-0-3.html
7256 bytes
0644
release-9-0-4.html
11345 bytes
0644
release-9-0-5.html
17915 bytes
0644
release-9-0-6.html
13426 bytes
0644
release-9-0-7.html
18091 bytes
0644
release-9-0-8.html
10993 bytes
0644
release-9-0-9.html
11743 bytes
0644
release-9-0.html
96127 bytes
0644
release-9-1-1.html
3670 bytes
0644
release-9-1-10.html
10352 bytes
0644
release-9-1-11.html
9584 bytes
0644
release-9-1-12.html
18554 bytes
0644
release-9-1-13.html
6685 bytes
0644
release-9-1-14.html
13036 bytes
0644
release-9-1-15.html
28969 bytes
0644
release-9-1-16.html
19119 bytes
0644
release-9-1-17.html
4947 bytes
0644
release-9-1-18.html
4102 bytes
0644
release-9-1-19.html
17617 bytes
0644
release-9-1-2.html
21571 bytes
0644
release-9-1-20.html
17541 bytes
0644
release-9-1-21.html
7601 bytes
0644
release-9-1-22.html
7258 bytes
0644
release-9-1-23.html
12653 bytes
0644
release-9-1-24.html
8731 bytes
0644
release-9-1-3.html
21153 bytes
0644
release-9-1-4.html
16018 bytes
0644
release-9-1-5.html
14042 bytes
0644
release-9-1-6.html
9521 bytes
0644
release-9-1-7.html
14941 bytes
0644
release-9-1-8.html
10154 bytes
0644
release-9-1-9.html
12679 bytes
0644
release-9-1.html
78963 bytes
0644
release-9-2-1.html
7111 bytes
0644
release-9-2-10.html
32368 bytes
0644
release-9-2-11.html
20298 bytes
0644
release-9-2-12.html
5130 bytes
0644
release-9-2-13.html
4102 bytes
0644
release-9-2-14.html
18386 bytes
0644
release-9-2-15.html
18605 bytes
0644
release-9-2-16.html
7598 bytes
0644
release-9-2-17.html
8195 bytes
0644
release-9-2-18.html
12718 bytes
0644
release-9-2-19.html
10514 bytes
0644
release-9-2-2.html
23001 bytes
0644
release-9-2-20.html
13332 bytes
0644
release-9-2-21.html
14198 bytes
0644
release-9-2-22.html
15865 bytes
0644
release-9-2-23.html
8126 bytes
0644
release-9-2-24.html
7877 bytes
0644
release-9-2-3.html
13373 bytes
0644
release-9-2-4.html
14800 bytes
0644
release-9-2-5.html
12005 bytes
0644
release-9-2-6.html
11684 bytes
0644
release-9-2-7.html
20022 bytes
0644
release-9-2-8.html
7375 bytes
0644
release-9-2-9.html
15615 bytes
0644
release-9-2.html
79519 bytes
0644
release.html
22882 bytes
0644
resources.html
4226 bytes
0644
role-attributes.html
7855 bytes
0644
role-membership.html
8390 bytes
0644
role-removal.html
5303 bytes
0644
routine-reindex.html
3628 bytes
0644
routine-vacuuming.html
38023 bytes
0644
row-estimation-examples.html
20767 bytes
0644
rowtypes.html
23412 bytes
0644
rule-system.html
4117 bytes
0644
rules-privileges.html
11663 bytes
0644
rules-status.html
4512 bytes
0644
rules-triggers.html
9476 bytes
0644
rules-update.html
32615 bytes
0644
rules-views.html
26888 bytes
0644
rules.html
4948 bytes
0644
runtime-config-autovacuum.html
10974 bytes
0644
runtime-config-client.html
32815 bytes
0644
runtime-config-compatible.html
14827 bytes
0644
runtime-config-connection.html
23478 bytes
0644
runtime-config-custom.html
3548 bytes
0644
runtime-config-developer.html
14070 bytes
0644
runtime-config-error-handling.html
3570 bytes
0644
runtime-config-file-locations.html
6977 bytes
0644
runtime-config-locks.html
7634 bytes
0644
runtime-config-logging.html
45446 bytes
0644
runtime-config-preset.html
8710 bytes
0644
runtime-config-query.html
24950 bytes
0644
runtime-config-replication.html
18294 bytes
0644
runtime-config-resource.html
27901 bytes
0644
runtime-config-short.html
6683 bytes
0644
runtime-config-statistics.html
8616 bytes
0644
runtime-config-wal.html
27093 bytes
0644
runtime-config.html
8249 bytes
0644
runtime.html
5241 bytes
0644
seg.html
15470 bytes
0644
sepgsql.html
30829 bytes
0644
server-programming.html
9618 bytes
0644
server-shutdown.html
6469 bytes
0644
server-start.html
14217 bytes
0644
source-format.html
5133 bytes
0644
source.html
4071 bytes
0644
sourcerepo.html
3411 bytes
0644
spgist-examples.html
2703 bytes
0644
spgist-extensibility.html
31282 bytes
0644
spgist-implementation.html
8098 bytes
0644
spgist-intro.html
4323 bytes
0644
spgist.html
2966 bytes
0644
spi-examples.html
6217 bytes
0644
spi-interface-support.html
3770 bytes
0644
spi-interface.html
5998 bytes
0644
spi-memory.html
7089 bytes
0644
spi-realloc.html
3627 bytes
0644
spi-spi-connect.html
4052 bytes
0644
spi-spi-copytuple.html
3453 bytes
0644
spi-spi-cursor-close.html
3336 bytes
0644
spi-spi-cursor-fetch.html
4110 bytes
0644
spi-spi-cursor-find.html
3464 bytes
0644
spi-spi-cursor-move.html
3890 bytes
0644
spi-spi-cursor-open-with-args.html
6178 bytes
0644
spi-spi-cursor-open-with-paramlist.html
5035 bytes
0644
spi-spi-cursor-open.html
5732 bytes
0644
spi-spi-exec.html
3591 bytes
0644
spi-spi-execp.html
4866 bytes
0644
spi-spi-execute-plan-with-paramlist.html
4893 bytes
0644
spi-spi-execute-plan.html
5901 bytes
0644
spi-spi-execute-with-args.html
6221 bytes
0644
spi-spi-execute.html
12598 bytes
0644
spi-spi-finish.html
3655 bytes
0644
spi-spi-fname.html
3767 bytes
0644
spi-spi-fnumber.html
3936 bytes
0644
spi-spi-freeplan.html
3505 bytes
0644
spi-spi-freetuple.html
3277 bytes
0644
spi-spi-freetupletable.html
3628 bytes
0644
spi-spi-getargcount.html
3698 bytes
0644
spi-spi-getargtypeid.html
4141 bytes
0644
spi-spi-getbinval.html
4287 bytes
0644
spi-spi-getnspname.html
3467 bytes
0644
spi-spi-getrelname.html
3351 bytes
0644
spi-spi-gettype.html
3714 bytes
0644
spi-spi-gettypeid.html
3718 bytes
0644
spi-spi-getvalue.html
4166 bytes
0644
spi-spi-is-cursor-plan.html
4560 bytes
0644
spi-spi-keepplan.html
3884 bytes
0644
spi-spi-modifytuple.html
5631 bytes
0644
spi-spi-palloc.html
3157 bytes
0644
spi-spi-pfree.html
3275 bytes
0644
spi-spi-pop.html
2743 bytes
0644
spi-spi-prepare-cursor.html
5055 bytes
0644
spi-spi-prepare-params.html
4412 bytes
0644
spi-spi-prepare.html
7661 bytes
0644
spi-spi-push.html
3737 bytes
0644
spi-spi-returntuple.html
4097 bytes
0644
spi-spi-saveplan.html
4576 bytes
0644
spi-spi-scroll-cursor-fetch.html
4809 bytes
0644
spi-spi-scroll-cursor-move.html
4899 bytes
0644
spi-visibility.html
4152 bytes
0644
spi.html
10843 bytes
0644
sql-abort.html
4177 bytes
0644
sql-alteraggregate.html
6111 bytes
0644
sql-altercollation.html
5084 bytes
0644
sql-alterconversion.html
5170 bytes
0644
sql-alterdatabase.html
8778 bytes
0644
sql-alterdefaultprivileges.html
9407 bytes
0644
sql-alterdomain.html
11113 bytes
0644
sql-alterextension.html
11745 bytes
0644
sql-alterforeigndatawrapper.html
7378 bytes
0644
sql-alterforeigntable.html
12707 bytes
0644
sql-alterfunction.html
12845 bytes
0644
sql-altergroup.html
5239 bytes
0644
sql-alterindex.html
7655 bytes
0644
sql-alterlanguage.html
4022 bytes
0644
sql-alterlargeobject.html
3730 bytes
0644
sql-alteropclass.html
5114 bytes
0644
sql-alteroperator.html
5435 bytes
0644
sql-alteropfamily.html
13564 bytes
0644
sql-alterrole.html
13028 bytes
0644
sql-alterschema.html
4314 bytes
0644
sql-altersequence.html
13031 bytes
0644
sql-alterserver.html
5928 bytes
0644
sql-altertable.html
43543 bytes
0644
sql-altertablespace.html
5866 bytes
0644
sql-altertrigger.html
4647 bytes
0644
sql-altertsconfig.html
8126 bytes
0644
sql-altertsdictionary.html
6539 bytes
0644
sql-altertsparser.html
4257 bytes
0644
sql-altertstemplate.html
4223 bytes
0644
sql-altertype.html
11193 bytes
0644
sql-alteruser.html
4720 bytes
0644
sql-alterusermapping.html
5714 bytes
0644
sql-alterview.html
6969 bytes
0644
sql-analyze.html
10674 bytes
0644
sql-begin.html
6695 bytes
0644
sql-checkpoint.html
3758 bytes
0644
sql-close.html
4984 bytes
0644
sql-cluster.html
9404 bytes
0644
sql-commands.html
18810 bytes
0644
sql-comment.html
13799 bytes
0644
sql-commit-prepared.html
4516 bytes
0644
sql-commit.html
3992 bytes
0644
sql-copy.html
37443 bytes
0644
sql-createaggregate.html
13829 bytes
0644
sql-createcast.html
19632 bytes
0644
sql-createcollation.html
6739 bytes
0644
sql-createconversion.html
6538 bytes
0644
sql-createdatabase.html
12133 bytes
0644
sql-createdomain.html
8544 bytes
0644
sql-createextension.html
9083 bytes
0644
sql-createforeigndatawrapper.html
8059 bytes
0644
sql-createforeigntable.html
7718 bytes
0644
sql-createfunction.html
31076 bytes
0644
sql-creategroup.html
4012 bytes
0644
sql-createindex.html
25934 bytes
0644
sql-createlanguage.html
14888 bytes
0644
sql-createopclass.html
12676 bytes
0644
sql-createoperator.html
10688 bytes
0644
sql-createopfamily.html
5626 bytes
0644
sql-createrole.html
19325 bytes
0644
sql-createrule.html
12656 bytes
0644
sql-createschema.html
8319 bytes
0644
sql-createsequence.html
13862 bytes
0644
sql-createserver.html
6251 bytes
0644
sql-createtable.html
59172 bytes
0644
sql-createtableas.html
12772 bytes
0644
sql-createtablespace.html
6104 bytes
0644
sql-createtrigger.html
23175 bytes
0644
sql-createtsconfig.html
5352 bytes
0644
sql-createtsdictionary.html
5533 bytes
0644
sql-createtsparser.html
5947 bytes
0644
sql-createtstemplate.html
5437 bytes
0644
sql-createtype.html
39460 bytes
0644
sql-createuser.html
4524 bytes
0644
sql-createusermapping.html
5503 bytes
0644
sql-createview.html
10556 bytes
0644
sql-deallocate.html
3785 bytes
0644
sql-declare.html
15400 bytes
0644
sql-delete.html
11777 bytes
0644
sql-discard.html
4309 bytes
0644
sql-do.html
5204 bytes
0644
sql-drop-owned.html
5058 bytes
0644
sql-dropaggregate.html
4561 bytes
0644
sql-dropcast.html
4344 bytes
0644
sql-dropcollation.html
4409 bytes
0644
sql-dropconversion.html
4437 bytes
0644
sql-dropdatabase.html
4344 bytes
0644
sql-dropdomain.html
4257 bytes
0644
sql-dropextension.html
4785 bytes
0644
sql-dropforeigndatawrapper.html
4526 bytes
0644
sql-dropforeigntable.html
4560 bytes
0644
sql-dropfunction.html
5838 bytes
0644
sql-dropgroup.html
3047 bytes
0644
sql-dropindex.html
5182 bytes
0644
sql-droplanguage.html
4841 bytes
0644
sql-dropopclass.html
5678 bytes
0644
sql-dropoperator.html
5222 bytes
0644
sql-dropopfamily.html
5279 bytes
0644
sql-droprole.html
5158 bytes
0644
sql-droprule.html
4151 bytes
0644
sql-dropschema.html
4529 bytes
0644
sql-dropsequence.html
4367 bytes
0644
sql-dropserver.html
4265 bytes
0644
sql-droptable.html
5028 bytes
0644
sql-droptablespace.html
4585 bytes
0644
sql-droptrigger.html
4711 bytes
0644
sql-droptsconfig.html
4772 bytes
0644
sql-droptsdictionary.html
4689 bytes
0644
sql-droptsparser.html
4595 bytes
0644
sql-droptstemplate.html
4567 bytes
0644
sql-droptype.html
4463 bytes
0644
sql-dropuser.html
3181 bytes
0644
sql-dropusermapping.html
4679 bytes
0644
sql-dropview.html
4262 bytes
0644
sql-end.html
4157 bytes
0644
sql-execute.html
5073 bytes
0644
sql-explain.html
17094 bytes
0644
sql-expressions.html
47801 bytes
0644
sql-fetch.html
14251 bytes
0644
sql-grant.html
29245 bytes
0644
sql-insert.html
12860 bytes
0644
sql-keywords-appendix.html
106534 bytes
0644
sql-listen.html
5903 bytes
0644
sql-load.html
4207 bytes
0644
sql-lock.html
11869 bytes
0644
sql-move.html
4984 bytes
0644
sql-notify.html
10948 bytes
0644
sql-prepare-transaction.html
8640 bytes
0644
sql-prepare.html
9181 bytes
0644
sql-reassign-owned.html
5344 bytes
0644
sql-reindex.html
11103 bytes
0644
sql-release-savepoint.html
5005 bytes
0644
sql-reset.html
4993 bytes
0644
sql-revoke.html
14879 bytes
0644
sql-rollback-prepared.html
4627 bytes
0644
sql-rollback-to.html
6401 bytes
0644
sql-rollback.html
3996 bytes
0644
sql-savepoint.html
5605 bytes
0644
sql-security-label.html
8879 bytes
0644
sql-select.html
79544 bytes
0644
sql-selectinto.html
7634 bytes
0644
sql-set-constraints.html
7068 bytes
0644
sql-set-role.html
6915 bytes
0644
sql-set-session-authorization.html
6062 bytes
0644
sql-set-transaction.html
12696 bytes
0644
sql-set.html
12057 bytes
0644
sql-show.html
6851 bytes
0644
sql-start-transaction.html
4983 bytes
0644
sql-syntax-calling-funcs.html
8080 bytes
0644
sql-syntax-lexical.html
43370 bytes
0644
sql-syntax.html
5430 bytes
0644
sql-truncate.html
9364 bytes
0644
sql-unlisten.html
4923 bytes
0644
sql-update.html
15669 bytes
0644
sql-vacuum.html
10669 bytes
0644
sql-values.html
10640 bytes
0644
sql.html
13569 bytes
0644
ssh-tunnels.html
6263 bytes
0644
ssl-tcp.html
13477 bytes
0644
sslinfo.html
7594 bytes
0644
standby-settings.html
5427 bytes
0644
storage-file-layout.html
12936 bytes
0644
storage-fsm.html
3821 bytes
0644
storage-init.html
2760 bytes
0644
storage-page-layout.html
13891 bytes
0644
storage-toast.html
11478 bytes
0644
storage-vm.html
3540 bytes
0644
storage.html
2952 bytes
0644
stylesheet.css
1538 bytes
0644
supported-platforms.html
5042 bytes
0644
tablefunc.html
32193 bytes
0644
tcn.html
4974 bytes
0644
test-parser.html
4530 bytes
0644
textsearch-configuration.html
6257 bytes
0644
textsearch-controls.html
26966 bytes
0644
textsearch-debugging.html
17227 bytes
0644
textsearch-dictionaries.html
31261 bytes
0644
textsearch-features.html
21310 bytes
0644
textsearch-indexes.html
7387 bytes
0644
textsearch-intro.html
18453 bytes
0644
textsearch-limitations.html
3859 bytes
0644
textsearch-migration.html
5034 bytes
0644
textsearch-parsers.html
9210 bytes
0644
textsearch-psql.html
9345 bytes
0644
textsearch-tables.html
9750 bytes
0644
textsearch.html
5878 bytes
0644
transaction-iso.html
27240 bytes
0644
trigger-datachanges.html
5072 bytes
0644
trigger-definition.html
15507 bytes
0644
trigger-example.html
7749 bytes
0644
trigger-interface.html
10719 bytes
0644
triggers.html
3798 bytes
0644
tsearch2.html
9950 bytes
0644
tutorial-accessdb.html
7040 bytes
0644
tutorial-advanced-intro.html
3341 bytes
0644
tutorial-advanced.html
2856 bytes
0644
tutorial-agg.html
7594 bytes
0644
tutorial-arch.html
4852 bytes
0644
tutorial-concepts.html
3839 bytes
0644
tutorial-conclusion.html
2849 bytes
0644
tutorial-createdb.html
9200 bytes
0644
tutorial-delete.html
3517 bytes
0644
tutorial-fk.html
4422 bytes
0644
tutorial-inheritance.html
6137 bytes
0644
tutorial-install.html
4522 bytes
0644
tutorial-join.html
9685 bytes
0644
tutorial-populate.html
4839 bytes
0644
tutorial-select.html
8033 bytes
0644
tutorial-sql-intro.html
4904 bytes
0644
tutorial-sql.html
3060 bytes
0644
tutorial-start.html
2629 bytes
0644
tutorial-table.html
5704 bytes
0644
tutorial-transactions.html
9948 bytes
0644
tutorial-update.html
3159 bytes
0644
tutorial-views.html
3375 bytes
0644
tutorial-window.html
12481 bytes
0644
tutorial.html
5209 bytes
0644
typeconv-func.html
12170 bytes
0644
typeconv-oper.html
14907 bytes
0644
typeconv-overview.html
8301 bytes
0644
typeconv-query.html
5450 bytes
0644
typeconv-union-case.html
6612 bytes
0644
typeconv.html
3721 bytes
0644
unaccent.html
6742 bytes
0644
unsupported-features-sql-standard.html
35115 bytes
0644
upgrading.html
12795 bytes
0644
user-manag.html
3983 bytes
0644
using-explain.html
41824 bytes
0644
uuid-ossp.html
7228 bytes
0644
vacuumlo.html
7548 bytes
0644
view-pg-available-extension-versions.html
4642 bytes
0644
view-pg-available-extensions.html
3944 bytes
0644
view-pg-cursors.html
5669 bytes
0644
view-pg-group.html
3897 bytes
0644
view-pg-indexes.html
4155 bytes
0644
view-pg-locks.html
14444 bytes
0644
view-pg-prepared-statements.html
5060 bytes
0644
view-pg-prepared-xacts.html
4912 bytes
0644
view-pg-roles.html
6073 bytes
0644
view-pg-rules.html
3999 bytes
0644
view-pg-seclabels.html
5123 bytes
0644
view-pg-settings.html
10600 bytes
0644
view-pg-shadow.html
5381 bytes
0644
view-pg-stats.html
8887 bytes
0644
view-pg-tables.html
4836 bytes
0644
view-pg-timezone-abbrevs.html
3860 bytes
0644
view-pg-timezone-names.html
4177 bytes
0644
view-pg-user-mappings.html
5165 bytes
0644
view-pg-user.html
4517 bytes
0644
view-pg-views.html
3853 bytes
0644
views-overview.html
6542 bytes
0644
wal-async-commit.html
9016 bytes
0644
wal-configuration.html
14960 bytes
0644
wal-internals.html
6151 bytes
0644
wal-intro.html
5534 bytes
0644
wal-reliability.html
11479 bytes
0644
wal.html
2928 bytes
0644
warm-standby-failover.html
6102 bytes
0644
warm-standby.html
34646 bytes
0644
xaggr.html
9902 bytes
0644
xfunc-c.html
78520 bytes
0644
xfunc-internal.html
4004 bytes
0644
xfunc-overload.html
5911 bytes
0644
xfunc-pl.html
2991 bytes
0644
xfunc-sql.html
38027 bytes
0644
xfunc-volatility.html
9839 bytes
0644
xfunc.html
4518 bytes
0644
xindex.html
44593 bytes
0644
xml2.html
16900 bytes
0644
xoper-optimization.html
23144 bytes
0644
xoper.html
4835 bytes
0644
xplang-install.html
11127 bytes
0644
xplang.html
4235 bytes
0644
xtypes.html
12114 bytes
0644
N4ST4R_ID | Naxtarrr