Commit 8408e3a5 authored by Peter Eisentraut's avatar Peter Eisentraut

doc: Update documentation about reg* types

Add missing index entries, add missing information on pg_upgrade man
page, order things alphabetical instead of (apparently) in the order
they were implemented, reduce repetitiveness a bit.
parent 6f72dbc4
...@@ -4473,39 +4473,43 @@ INSERT INTO mytable VALUES(-1); -- fails ...@@ -4473,39 +4473,43 @@ INSERT INTO mytable VALUES(-1); -- fails
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regproc</primary> <primary>regclass</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regprocedure</primary> <primary>regconfig</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regoper</primary> <primary>regdictionary</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regoperator</primary> <primary>regnamespace</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regclass</primary> <primary>regoper</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regtype</primary> <primary>regoperator</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regconfig</primary> <primary>regproc</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>regdictionary</primary> <primary>regprocedure</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
<primary>xid</primary> <primary>regrole</primary>
</indexterm>
<indexterm zone="datatype-oid">
<primary>regtype</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid"> <indexterm zone="datatype-oid">
...@@ -4516,17 +4520,17 @@ INSERT INTO mytable VALUES(-1); -- fails ...@@ -4516,17 +4520,17 @@ INSERT INTO mytable VALUES(-1); -- fails
<primary>tid</primary> <primary>tid</primary>
</indexterm> </indexterm>
<indexterm zone="datatype-oid">
<primary>xid</primary>
</indexterm>
<para> <para>
Object identifiers (OIDs) are used internally by Object identifiers (OIDs) are used internally by
<productname>PostgreSQL</productname> as primary keys for various <productname>PostgreSQL</productname> as primary keys for various
system tables. system tables.
Type <type>oid</type> represents an object identifier. There are also Type <type>oid</type> represents an object identifier. There are also
several alias types for <type>oid</type>: <type>regproc</type>, several alias types for <type>oid</type> named <type>reg<replaceable>something</replaceable></type>.
<type>regprocedure</type>, <type>regoper</type>, <type>regoperator</type>, <xref linkend="datatype-oid-table"/> shows an
<type>regclass</type>, <type>regtype</type>, <type>regrole</type>,
<type>regnamespace</type>, <type>regconfig</type>, and
<type>regdictionary</type>. <xref linkend="datatype-oid-table"/> shows an
overview. overview.
</para> </para>
...@@ -4592,17 +4596,32 @@ SELECT * FROM pg_attribute ...@@ -4592,17 +4596,32 @@ SELECT * FROM pg_attribute
</row> </row>
<row> <row>
<entry><type>regproc</type></entry> <entry><type>regclass</type></entry>
<entry><structname>pg_proc</structname></entry> <entry><structname>pg_class</structname></entry>
<entry>function name</entry> <entry>relation name</entry>
<entry><literal>sum</literal></entry> <entry><literal>pg_type</literal></entry>
</row> </row>
<row> <row>
<entry><type>regprocedure</type></entry> <entry><type>regconfig</type></entry>
<entry><structname>pg_proc</structname></entry> <entry><structname>pg_ts_config</structname></entry>
<entry>function with argument types</entry> <entry>text search configuration</entry>
<entry><literal>sum(int4)</literal></entry> <entry><literal>english</literal></entry>
</row>
<row>
<entry><type>regdictionary</type></entry>
<entry><structname>pg_ts_dict</structname></entry>
<entry>text search dictionary</entry>
<entry><literal>simple</literal></entry>
</row>
<row>
<entry><type>regnamespace</type></entry>
<entry><structname>pg_namespace</structname></entry>
<entry>namespace name</entry>
<entry><literal>pg_catalog</literal></entry>
</row> </row>
<row> <row>
...@@ -4620,17 +4639,17 @@ SELECT * FROM pg_attribute ...@@ -4620,17 +4639,17 @@ SELECT * FROM pg_attribute
</row> </row>
<row> <row>
<entry><type>regclass</type></entry> <entry><type>regproc</type></entry>
<entry><structname>pg_class</structname></entry> <entry><structname>pg_proc</structname></entry>
<entry>relation name</entry> <entry>function name</entry>
<entry><literal>pg_type</literal></entry> <entry><literal>sum</literal></entry>
</row> </row>
<row> <row>
<entry><type>regtype</type></entry> <entry><type>regprocedure</type></entry>
<entry><structname>pg_type</structname></entry> <entry><structname>pg_proc</structname></entry>
<entry>data type name</entry> <entry>function with argument types</entry>
<entry><literal>integer</literal></entry> <entry><literal>sum(int4)</literal></entry>
</row> </row>
<row> <row>
...@@ -4641,24 +4660,10 @@ SELECT * FROM pg_attribute ...@@ -4641,24 +4660,10 @@ SELECT * FROM pg_attribute
</row> </row>
<row> <row>
<entry><type>regnamespace</type></entry> <entry><type>regtype</type></entry>
<entry><structname>pg_namespace</structname></entry> <entry><structname>pg_type</structname></entry>
<entry>namespace name</entry> <entry>data type name</entry>
<entry><literal>pg_catalog</literal></entry> <entry><literal>integer</literal></entry>
</row>
<row>
<entry><type>regconfig</type></entry>
<entry><structname>pg_ts_config</structname></entry>
<entry>text search configuration</entry>
<entry><literal>english</literal></entry>
</row>
<row>
<entry><type>regdictionary</type></entry>
<entry><structname>pg_ts_dict</structname></entry>
<entry>text search dictionary</entry>
<entry><literal>simple</literal></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -18178,11 +18178,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -18178,11 +18178,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>to_regproc</primary> <primary>to_regnamespace</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>to_regprocedure</primary> <primary>to_regrole</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
...@@ -18194,15 +18194,15 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -18194,15 +18194,15 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>to_regtype</primary> <primary>to_regproc</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>to_regnamespace</primary> <primary>to_regprocedure</primary>
</indexterm> </indexterm>
<indexterm> <indexterm>
<primary>to_regrole</primary> <primary>to_regtype</primary>
</indexterm> </indexterm>
<para> <para>
...@@ -18390,14 +18390,9 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -18390,14 +18390,9 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<entry>get the OID of the named relation</entry> <entry>get the OID of the named relation</entry>
</row> </row>
<row> <row>
<entry><literal><function>to_regproc(<parameter>func_name</parameter>)</function></literal></entry> <entry><literal><function>to_regnamespace(<parameter>schema_name</parameter>)</function></literal></entry>
<entry><type>regproc</type></entry> <entry><type>regnamespace</type></entry>
<entry>get the OID of the named function</entry> <entry>get the OID of the named schema</entry>
</row>
<row>
<entry><literal><function>to_regprocedure(<parameter>func_name</parameter>)</function></literal></entry>
<entry><type>regprocedure</type></entry>
<entry>get the OID of the named function</entry>
</row> </row>
<row> <row>
<entry><literal><function>to_regoper(<parameter>operator_name</parameter>)</function></literal></entry> <entry><literal><function>to_regoper(<parameter>operator_name</parameter>)</function></literal></entry>
...@@ -18410,19 +18405,24 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -18410,19 +18405,24 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<entry>get the OID of the named operator</entry> <entry>get the OID of the named operator</entry>
</row> </row>
<row> <row>
<entry><literal><function>to_regtype(<parameter>type_name</parameter>)</function></literal></entry> <entry><literal><function>to_regrole(<parameter>role_name</parameter>)</function></literal></entry>
<entry><type>regtype</type></entry> <entry><type>regrole</type></entry>
<entry>get the OID of the named type</entry> <entry>get the OID of the named role</entry>
</row> </row>
<row> <row>
<entry><literal><function>to_regnamespace(<parameter>schema_name</parameter>)</function></literal></entry> <entry><literal><function>to_regproc(<parameter>func_name</parameter>)</function></literal></entry>
<entry><type>regnamespace</type></entry> <entry><type>regproc</type></entry>
<entry>get the OID of the named schema</entry> <entry>get the OID of the named function</entry>
</row> </row>
<row> <row>
<entry><literal><function>to_regrole(<parameter>role_name</parameter>)</function></literal></entry> <entry><literal><function>to_regprocedure(<parameter>func_name</parameter>)</function></literal></entry>
<entry><type>regrole</type></entry> <entry><type>regprocedure</type></entry>
<entry>get the OID of the named role</entry> <entry>get the OID of the named function</entry>
</row>
<row>
<entry><literal><function>to_regtype(<parameter>type_name</parameter>)</function></literal></entry>
<entry><type>regtype</type></entry>
<entry>get the OID of the named type</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -18720,20 +18720,18 @@ SELECT collation for ('foo' COLLATE "de_DE"); ...@@ -18720,20 +18720,18 @@ SELECT collation for ('foo' COLLATE "de_DE");
</para> </para>
<para> <para>
The <function>to_regclass</function>, <function>to_regproc</function>, The functions <function>to_regclass</function>,
<function>to_regprocedure</function>, <function>to_regoper</function>, <function>to_regnamespace</function>, <function>to_regoper</function>,
<function>to_regoperator</function>, <function>to_regtype</function>, <function>to_regoperator</function>, <function>to_regrole</function>,
<function>to_regnamespace</function>, and <function>to_regrole</function> <function>to_regproc</function>, <function>to_regprocedure</function>, and
functions translate relation, function, operator, type, schema, and role <function>to_regtype</function>, functions translate relation, schema,
names (given as <type>text</type>) to objects of operator, role, function, and type names (given as <type>text</type>) to
type <type>regclass</type>, <type>regproc</type>, <type>regprocedure</type>, objects of the corresponding <type>reg*</type> type (see <xref
<type>regoper</type>, <type>regoperator</type>, <type>regtype</type>, linkend="datatype-oid"/> about the types). These functions differ from a
<type>regnamespace</type>, and <type>regrole</type> cast from text in that they don't accept a numeric OID, and that they
respectively. These functions differ from a cast from return null rather than throwing an error if the name is not found (or, for
text in that they don't accept a numeric OID, and that they return null <function>to_regproc</function> and <function>to_regoper</function>, if the
rather than throwing an error if the name is not found (or, for given name matches multiple objects).
<function>to_regproc</function> and <function>to_regoper</function>, if
the given name matches multiple objects).
</para> </para>
<indexterm> <indexterm>
......
...@@ -773,9 +773,16 @@ psql --username=postgres --file=script.sql postgres ...@@ -773,9 +773,16 @@ psql --username=postgres --file=script.sql postgres
<para> <para>
<application>pg_upgrade</application> does not support upgrading of databases <application>pg_upgrade</application> does not support upgrading of databases
containing table columns using these <type>reg*</type> OID-referencing system data types: containing table columns using these <type>reg*</type> OID-referencing system data types:
<type>regproc</type>, <type>regprocedure</type>, <type>regoper</type>, <simplelist>
<type>regoperator</type>, <type>regconfig</type>, and <member><type>regconfig</type></member>
<type>regdictionary</type>. (<type>regtype</type> can be upgraded.) <member><type>regdictionary</type></member>
<member><type>regnamespace</type></member>
<member><type>regoper</type></member>
<member><type>regoperator</type></member>
<member><type>regproc</type></member>
<member><type>regprocedure</type></member>
</simplelist>
(<type>regclass</type>, <type>regrole</type>, and <type>regtype</type> can be upgraded.)
</para> </para>
<para> <para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment