incorrect PostgreSQL documentation for pg_type

2024-08-02 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/catalog-pg-type.html
Description:

Regarding https://www.postgresql.org/docs/12/catalog-pg-type.html
There is an error in the documentation, at least for version 12 (cannot
check for version 16),  in the ‘References ‘ column, for the following
entries:

Table 51.63. pg_type Columns
NameTypeReferences
---
typinputregproc pg_proc.oid
typoutput   regproc pg_proc.oid
typreceive  regproc pg_proc.oid
typsend regproc pg_proc.oid
typmodinregproc pg_proc.oid
typmodout   regproc pg_proc.oid
typanalyze  regproc pg_proc.oid

The correct reference is pg_proc.proname

select VERSION();
PostgreSQL 12.14 on aarch64-unknown-linux-gnu, compiled by
aarch64-unknown-linux-gnu-gcc (GCC) 9.5.0, 64-bit

select * from pg_type where typname = 'varchar';
|oid 
|typname|typnamespace|typowner|typlen|typbyval|typtype|typcategory|typispreferred|typisdefined|typdelim|typrelid|typelem|typarray|typinput
|typoutput |typreceive |typsend|typmodin   |typmodout  
|typanalyze|typalign|typstorage|typnotnull|typbasetype|typtypmod|typndims|typcollation|typdefaultbin|typdefault|typacl|
   
|-|---|||--||---|---|--||||---||-|--|---|---|---||--||--|--|---|-|||-|--|--|
|1,043|varchar|11  |10  |-1|false   |b  |S 
|false |true|,   |0   |0  |1,015  
|varcharin|varcharout|varcharrecv|varcharsend|varchartypmodin|varchartypmodout|-
|i   |x |false |0  |-1   |0   |100  
  | |  |  |

select * from pg_proc where proname in ('varcharin',  'varcharout', 
'varcharrecv',  'varcharsend',  'varchartypmodin',  'varchartypmodout');
|oid  |proname
|pronamespace|proowner|prolang|procost|prorows|provariadic|prosupport|prokind|prosecdef|proleakproof|proisstrict|proretset|provolatile|proparallel|pronargs|pronargdefaults|prorettype|proargtypes|proallargtypes|proargmodes|proargnames|proargdefaults|protrftypes|prosrc
 |probin|proconfig|proacl|
   
|-||||---|---|---|---|--|---|-||---|-|---|---||---|--|---|--|---|---|--|---||--|-|--|
|1,046|varcharin   |11  |10  |12 |1  |0  |0 
|- |f  |false|false   |true   |false|i  
   |s  |3   |0  |1,043 |2275 26 23 |
 |   |   |  |   |varcharin   |  
   | |  |
|1,047|varcharout  |11  |10  |12 |1  |0  |0 
|- |f  |false|false   |true   |false|i  
   |s  |1   |0  |2,275 |1043   |
 |   |   |  |   |varcharout  |  
   | |  |
|2,915|varchartypmodin |11  |10  |12 |1  |0  |0 
|- |f  |false|false   |true   |false|i  
   |s  |1   |0  |23|1263   |
 |   |   |  |   |varchartypmodin |  
   | |  |
|2,916|varchartypmodout|11  |10  |12 |1  |0  |0 
|- |f  |false|false   |true   |false|i  
   |s  |1   |0  |2,275 |23 |
 |   |   |  |   |varchartypmodout|  
   | |  |
|2,432|varcharrecv |11  |10  |12 |1  |0  |0 
|- |f  |false|false   |true   |false|s  
   |s  |3   |0  |1,043 |2281 26 23 |
 |   |   |  |   |varcharrecv |  
   | |  |
|2,433|varcharsend |11  |10  |12 |1  |0  |0 
|- |f  |false|false   |true   |false|s  
   |s  |1   |0  |17|1043   |
 |   |   |  |   |varcharsend |  
   | |  |


Re: incorrect PostgreSQL documentation for pg_type

2024-08-02 Thread Tom Lane
PG Doc comments form  writes:
> There is an error in the documentation, at least for version 12 (cannot
> check for version 16),  in the ‘References ‘ column, for the following
> entries:

> Table 51.63. pg_type Columns
> Name  TypeReferences
> ---
> typinput  regproc pg_proc.oid
> typoutput regproc pg_proc.oid
> typreceiveregproc pg_proc.oid
> typsend   regproc pg_proc.oid
> typmodin  regproc pg_proc.oid
> typmodout regproc pg_proc.oid
> typanalyzeregproc pg_proc.oid

> The correct reference is pg_proc.proname

No, it's correct as written: regproc is an OID.  See

https://www.postgresql.org/docs/current/datatype-oid.html

regards, tom lane




Re: incorrect PostgreSQL documentation for pg_type

2024-08-02 Thread David Rowley
On Sat, 3 Aug 2024 at 02:54, PG Doc comments form
 wrote:
> Table 51.63. pg_type Columns
> NameTypeReferences
> ---
> typinputregproc pg_proc.oid
> typoutput   regproc pg_proc.oid
> typreceive  regproc pg_proc.oid
> typsend regproc pg_proc.oid
> typmodinregproc pg_proc.oid
> typmodout   regproc pg_proc.oid
> typanalyze  regproc pg_proc.oid
>
> The correct reference is pg_proc.proname

The following query disagrees:

# select count(*) from pg_type t inner join pg_proc p on t.typinput = p.proname;
ERROR:  operator does not exist: regproc = name

The following two should hopefully be enough to convince you it's fine as is.

# select count(*) from pg_type t inner join pg_proc p on t.typinput = p.oid;
 count
---
   627
(1 row)

# select count(*) from pg_type;
 count
---
   627
(1 row)

Where you might be getting confused is the regproc type. Its output
function converts the Oid to text.

David