Skip to content

Commit 8408e3a

Browse files
committed
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.
1 parent 6f72dbc commit 8408e3a

File tree

3 files changed

+98
-88
lines changed

3 files changed

+98
-88
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4473,39 +4473,43 @@ INSERT INTO mytable VALUES(-1); -- fails
44734473
</indexterm>
44744474

44754475
<indexterm zone="datatype-oid">
4476-
<primary>regproc</primary>
4476+
<primary>regclass</primary>
44774477
</indexterm>
44784478

44794479
<indexterm zone="datatype-oid">
4480-
<primary>regprocedure</primary>
4480+
<primary>regconfig</primary>
44814481
</indexterm>
44824482

44834483
<indexterm zone="datatype-oid">
4484-
<primary>regoper</primary>
4484+
<primary>regdictionary</primary>
44854485
</indexterm>
44864486

44874487
<indexterm zone="datatype-oid">
4488-
<primary>regoperator</primary>
4488+
<primary>regnamespace</primary>
44894489
</indexterm>
44904490

44914491
<indexterm zone="datatype-oid">
4492-
<primary>regclass</primary>
4492+
<primary>regoper</primary>
44934493
</indexterm>
44944494

44954495
<indexterm zone="datatype-oid">
4496-
<primary>regtype</primary>
4496+
<primary>regoperator</primary>
44974497
</indexterm>
44984498

44994499
<indexterm zone="datatype-oid">
4500-
<primary>regconfig</primary>
4500+
<primary>regproc</primary>
45014501
</indexterm>
45024502

45034503
<indexterm zone="datatype-oid">
4504-
<primary>regdictionary</primary>
4504+
<primary>regprocedure</primary>
45054505
</indexterm>
45064506

45074507
<indexterm zone="datatype-oid">
4508-
<primary>xid</primary>
4508+
<primary>regrole</primary>
4509+
</indexterm>
4510+
4511+
<indexterm zone="datatype-oid">
4512+
<primary>regtype</primary>
45094513
</indexterm>
45104514

45114515
<indexterm zone="datatype-oid">
@@ -4516,17 +4520,17 @@ INSERT INTO mytable VALUES(-1); -- fails
45164520
<primary>tid</primary>
45174521
</indexterm>
45184522

4523+
<indexterm zone="datatype-oid">
4524+
<primary>xid</primary>
4525+
</indexterm>
4526+
45194527
<para>
45204528
Object identifiers (OIDs) are used internally by
45214529
<productname>PostgreSQL</productname> as primary keys for various
45224530
system tables.
4523-
45244531
Type <type>oid</type> represents an object identifier. There are also
4525-
several alias types for <type>oid</type>: <type>regproc</type>,
4526-
<type>regprocedure</type>, <type>regoper</type>, <type>regoperator</type>,
4527-
<type>regclass</type>, <type>regtype</type>, <type>regrole</type>,
4528-
<type>regnamespace</type>, <type>regconfig</type>, and
4529-
<type>regdictionary</type>. <xref linkend="datatype-oid-table"/> shows an
4532+
several alias types for <type>oid</type> named <type>reg<replaceable>something</replaceable></type>.
4533+
<xref linkend="datatype-oid-table"/> shows an
45304534
overview.
45314535
</para>
45324536

@@ -4592,17 +4596,32 @@ SELECT * FROM pg_attribute
45924596
</row>
45934597

45944598
<row>
4595-
<entry><type>regproc</type></entry>
4596-
<entry><structname>pg_proc</structname></entry>
4597-
<entry>function name</entry>
4598-
<entry><literal>sum</literal></entry>
4599+
<entry><type>regclass</type></entry>
4600+
<entry><structname>pg_class</structname></entry>
4601+
<entry>relation name</entry>
4602+
<entry><literal>pg_type</literal></entry>
45994603
</row>
46004604

4605+
46014606
<row>
4602-
<entry><type>regprocedure</type></entry>
4603-
<entry><structname>pg_proc</structname></entry>
4604-
<entry>function with argument types</entry>
4605-
<entry><literal>sum(int4)</literal></entry>
4607+
<entry><type>regconfig</type></entry>
4608+
<entry><structname>pg_ts_config</structname></entry>
4609+
<entry>text search configuration</entry>
4610+
<entry><literal>english</literal></entry>
4611+
</row>
4612+
4613+
<row>
4614+
<entry><type>regdictionary</type></entry>
4615+
<entry><structname>pg_ts_dict</structname></entry>
4616+
<entry>text search dictionary</entry>
4617+
<entry><literal>simple</literal></entry>
4618+
</row>
4619+
4620+
<row>
4621+
<entry><type>regnamespace</type></entry>
4622+
<entry><structname>pg_namespace</structname></entry>
4623+
<entry>namespace name</entry>
4624+
<entry><literal>pg_catalog</literal></entry>
46064625
</row>
46074626

46084627
<row>
@@ -4620,17 +4639,17 @@ SELECT * FROM pg_attribute
46204639
</row>
46214640

46224641
<row>
4623-
<entry><type>regclass</type></entry>
4624-
<entry><structname>pg_class</structname></entry>
4625-
<entry>relation name</entry>
4626-
<entry><literal>pg_type</literal></entry>
4642+
<entry><type>regproc</type></entry>
4643+
<entry><structname>pg_proc</structname></entry>
4644+
<entry>function name</entry>
4645+
<entry><literal>sum</literal></entry>
46274646
</row>
46284647

46294648
<row>
4630-
<entry><type>regtype</type></entry>
4631-
<entry><structname>pg_type</structname></entry>
4632-
<entry>data type name</entry>
4633-
<entry><literal>integer</literal></entry>
4649+
<entry><type>regprocedure</type></entry>
4650+
<entry><structname>pg_proc</structname></entry>
4651+
<entry>function with argument types</entry>
4652+
<entry><literal>sum(int4)</literal></entry>
46344653
</row>
46354654

46364655
<row>
@@ -4641,24 +4660,10 @@ SELECT * FROM pg_attribute
46414660
</row>
46424661

46434662
<row>
4644-
<entry><type>regnamespace</type></entry>
4645-
<entry><structname>pg_namespace</structname></entry>
4646-
<entry>namespace name</entry>
4647-
<entry><literal>pg_catalog</literal></entry>
4648-
</row>
4649-
4650-
<row>
4651-
<entry><type>regconfig</type></entry>
4652-
<entry><structname>pg_ts_config</structname></entry>
4653-
<entry>text search configuration</entry>
4654-
<entry><literal>english</literal></entry>
4655-
</row>
4656-
4657-
<row>
4658-
<entry><type>regdictionary</type></entry>
4659-
<entry><structname>pg_ts_dict</structname></entry>
4660-
<entry>text search dictionary</entry>
4661-
<entry><literal>simple</literal></entry>
4663+
<entry><type>regtype</type></entry>
4664+
<entry><structname>pg_type</structname></entry>
4665+
<entry>data type name</entry>
4666+
<entry><literal>integer</literal></entry>
46624667
</row>
46634668
</tbody>
46644669
</tgroup>

doc/src/sgml/func.sgml

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18178,11 +18178,11 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1817818178
</indexterm>
1817918179

1818018180
<indexterm>
18181-
<primary>to_regproc</primary>
18181+
<primary>to_regnamespace</primary>
1818218182
</indexterm>
1818318183

1818418184
<indexterm>
18185-
<primary>to_regprocedure</primary>
18185+
<primary>to_regrole</primary>
1818618186
</indexterm>
1818718187

1818818188
<indexterm>
@@ -18194,15 +18194,15 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1819418194
</indexterm>
1819518195

1819618196
<indexterm>
18197-
<primary>to_regtype</primary>
18197+
<primary>to_regproc</primary>
1819818198
</indexterm>
1819918199

1820018200
<indexterm>
18201-
<primary>to_regnamespace</primary>
18201+
<primary>to_regprocedure</primary>
1820218202
</indexterm>
1820318203

1820418204
<indexterm>
18205-
<primary>to_regrole</primary>
18205+
<primary>to_regtype</primary>
1820618206
</indexterm>
1820718207

1820818208
<para>
@@ -18390,14 +18390,9 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1839018390
<entry>get the OID of the named relation</entry>
1839118391
</row>
1839218392
<row>
18393-
<entry><literal><function>to_regproc(<parameter>func_name</parameter>)</function></literal></entry>
18394-
<entry><type>regproc</type></entry>
18395-
<entry>get the OID of the named function</entry>
18396-
</row>
18397-
<row>
18398-
<entry><literal><function>to_regprocedure(<parameter>func_name</parameter>)</function></literal></entry>
18399-
<entry><type>regprocedure</type></entry>
18400-
<entry>get the OID of the named function</entry>
18393+
<entry><literal><function>to_regnamespace(<parameter>schema_name</parameter>)</function></literal></entry>
18394+
<entry><type>regnamespace</type></entry>
18395+
<entry>get the OID of the named schema</entry>
1840118396
</row>
1840218397
<row>
1840318398
<entry><literal><function>to_regoper(<parameter>operator_name</parameter>)</function></literal></entry>
@@ -18410,19 +18405,24 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
1841018405
<entry>get the OID of the named operator</entry>
1841118406
</row>
1841218407
<row>
18413-
<entry><literal><function>to_regtype(<parameter>type_name</parameter>)</function></literal></entry>
18414-
<entry><type>regtype</type></entry>
18415-
<entry>get the OID of the named type</entry>
18408+
<entry><literal><function>to_regrole(<parameter>role_name</parameter>)</function></literal></entry>
18409+
<entry><type>regrole</type></entry>
18410+
<entry>get the OID of the named role</entry>
1841618411
</row>
1841718412
<row>
18418-
<entry><literal><function>to_regnamespace(<parameter>schema_name</parameter>)</function></literal></entry>
18419-
<entry><type>regnamespace</type></entry>
18420-
<entry>get the OID of the named schema</entry>
18413+
<entry><literal><function>to_regproc(<parameter>func_name</parameter>)</function></literal></entry>
18414+
<entry><type>regproc</type></entry>
18415+
<entry>get the OID of the named function</entry>
1842118416
</row>
1842218417
<row>
18423-
<entry><literal><function>to_regrole(<parameter>role_name</parameter>)</function></literal></entry>
18424-
<entry><type>regrole</type></entry>
18425-
<entry>get the OID of the named role</entry>
18418+
<entry><literal><function>to_regprocedure(<parameter>func_name</parameter>)</function></literal></entry>
18419+
<entry><type>regprocedure</type></entry>
18420+
<entry>get the OID of the named function</entry>
18421+
</row>
18422+
<row>
18423+
<entry><literal><function>to_regtype(<parameter>type_name</parameter>)</function></literal></entry>
18424+
<entry><type>regtype</type></entry>
18425+
<entry>get the OID of the named type</entry>
1842618426
</row>
1842718427
</tbody>
1842818428
</tgroup>
@@ -18720,20 +18720,18 @@ SELECT collation for ('foo' COLLATE "de_DE");
1872018720
</para>
1872118721

1872218722
<para>
18723-
The <function>to_regclass</function>, <function>to_regproc</function>,
18724-
<function>to_regprocedure</function>, <function>to_regoper</function>,
18725-
<function>to_regoperator</function>, <function>to_regtype</function>,
18726-
<function>to_regnamespace</function>, and <function>to_regrole</function>
18727-
functions translate relation, function, operator, type, schema, and role
18728-
names (given as <type>text</type>) to objects of
18729-
type <type>regclass</type>, <type>regproc</type>, <type>regprocedure</type>,
18730-
<type>regoper</type>, <type>regoperator</type>, <type>regtype</type>,
18731-
<type>regnamespace</type>, and <type>regrole</type>
18732-
respectively. These functions differ from a cast from
18733-
text in that they don't accept a numeric OID, and that they return null
18734-
rather than throwing an error if the name is not found (or, for
18735-
<function>to_regproc</function> and <function>to_regoper</function>, if
18736-
the given name matches multiple objects).
18723+
The functions <function>to_regclass</function>,
18724+
<function>to_regnamespace</function>, <function>to_regoper</function>,
18725+
<function>to_regoperator</function>, <function>to_regrole</function>,
18726+
<function>to_regproc</function>, <function>to_regprocedure</function>, and
18727+
<function>to_regtype</function>, functions translate relation, schema,
18728+
operator, role, function, and type names (given as <type>text</type>) to
18729+
objects of the corresponding <type>reg*</type> type (see <xref
18730+
linkend="datatype-oid"/> about the types). These functions differ from a
18731+
cast from text in that they don't accept a numeric OID, and that they
18732+
return null rather than throwing an error if the name is not found (or, for
18733+
<function>to_regproc</function> and <function>to_regoper</function>, if the
18734+
given name matches multiple objects).
1873718735
</para>
1873818736

1873918737
<indexterm>

doc/src/sgml/ref/pgupgrade.sgml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,16 @@ psql --username=postgres --file=script.sql postgres
773773
<para>
774774
<application>pg_upgrade</application> does not support upgrading of databases
775775
containing table columns using these <type>reg*</type> OID-referencing system data types:
776-
<type>regproc</type>, <type>regprocedure</type>, <type>regoper</type>,
777-
<type>regoperator</type>, <type>regconfig</type>, and
778-
<type>regdictionary</type>. (<type>regtype</type> can be upgraded.)
776+
<simplelist>
777+
<member><type>regconfig</type></member>
778+
<member><type>regdictionary</type></member>
779+
<member><type>regnamespace</type></member>
780+
<member><type>regoper</type></member>
781+
<member><type>regoperator</type></member>
782+
<member><type>regproc</type></member>
783+
<member><type>regprocedure</type></member>
784+
</simplelist>
785+
(<type>regclass</type>, <type>regrole</type>, and <type>regtype</type> can be upgraded.)
779786
</para>
780787

781788
<para>

0 commit comments

Comments
 (0)