@@ -17034,8 +17034,7 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1703417034 <row>
1703517035 <entry><literal><function>pg_get_serial_sequence(<parameter>table_name</parameter>, <parameter>column_name</parameter>)</function></literal></entry>
1703617036 <entry><type>text</type></entry>
17037- <entry>get name of the sequence that a <type>serial</type>, <type>smallserial</type> or <type>bigserial</type> column
17038- uses</entry>
17037+ <entry>get name of the sequence that a serial or identity column uses</entry>
1703917038 </row>
1704017039 <row>
1704117040 <entry><literal><function>pg_get_statisticsobjdef(<parameter>statobj_oid</parameter>)</function></literal></entry>
@@ -17223,19 +17222,27 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1722317222 <para>
1722417223 <function>pg_get_serial_sequence</function> returns the name of the
1722517224 sequence associated with a column, or NULL if no sequence is associated
17226- with the column. The first input parameter is a table name with
17227- optional schema, and the second parameter is a column name. Because
17228- the first parameter is potentially a schema and table, it is not treated
17229- as a double-quoted identifier, meaning it is lower cased by default,
17230- while the second parameter, being just a column name, is treated as
17231- double-quoted and has its case preserved. The function returns a value
17232- suitably formatted for passing to sequence functions (see <xref
17233- linkend="functions-sequence">). This association can be modified or
17234- removed with <command>ALTER SEQUENCE OWNED BY</>. (The function
17235- probably should have been called
17236- <function>pg_get_owned_sequence</function>; its current name reflects the fact
17237- that it's typically used with <type>serial</> or <type>bigserial</>
17238- columns.)
17225+ with the column. If the column is an identity column, the associated
17226+ sequence is the sequence internally created for the identity column. For
17227+ columns created using one of the serial types
17228+ (<type>serial</type>, <type>smallserial</type>, <type>bigserial</type>), it
17229+ is the sequence created for that serial column definition. In the latter
17230+ case, this association can be modified or removed with <command>ALTER
17231+ SEQUENCE OWNED BY</>. (The function probably should have been called
17232+ <function>pg_get_owned_sequence</function>; its current name reflects the
17233+ fact that it has typically been used with <type>serial</>
17234+ or <type>bigserial</> columns.) The first input parameter is a table name
17235+ with optional schema, and the second parameter is a column name. Because
17236+ the first parameter is potentially a schema and table, it is not treated as
17237+ a double-quoted identifier, meaning it is lower cased by default, while the
17238+ second parameter, being just a column name, is treated as double-quoted and
17239+ has its case preserved. The function returns a value suitably formatted
17240+ for passing to sequence functions
17241+ (see <xref linkend="functions-sequence">). A typical use is in reading the
17242+ current value of a sequence for an identity or serial column, for example:
17243+ <programlisting>
17244+ SELECT currval(pg_get_serial_sequence('sometable', 'id'));
17245+ </programlisting>
1723917246 </para>
1724017247
1724117248 <para>
0 commit comments