pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
incorrect PostgreSQL documentation for pg_type
3+ messages / 3 participants
[nested] [flat]

* incorrect PostgreSQL documentation for pg_type
@ 2024-08-02 14:14  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 2 replies; 3+ messages in thread

From: PG Doc comments form @ 2024-08-02 14:14 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: elionescu@yahoo.com

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
Name 	    Type 	    References
----        ----        -----------
typinput 	regproc 	pg_proc.oid
typoutput 	regproc 	pg_proc.oid
typreceive 	regproc 	pg_proc.oid
typsend 	regproc 	pg_proc.oid
typmodin 	regproc 	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     |  
   |         |      |


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: incorrect PostgreSQL documentation for pg_type
@ 2024-08-02 15:11  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Doc comments form <noreply@postgresql.org>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-08-02 15:11 UTC (permalink / raw)
  To: elionescu@yahoo.com; +Cc: pgsql-docs@lists.postgresql.org

PG Doc comments form <noreply@postgresql.org> 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 	    Type 	    References
> ----        ----        -----------
> typinput 	regproc 	pg_proc.oid
> typoutput 	regproc 	pg_proc.oid
> typreceive 	regproc 	pg_proc.oid
> typsend 	regproc 	pg_proc.oid
> typmodin 	regproc 	pg_proc.oid
> typmodout 	regproc 	pg_proc.oid
> typanalyze 	regproc 	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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: incorrect PostgreSQL documentation for pg_type
@ 2024-08-02 15:12  David Rowley <dgrowleyml@gmail.com>
  parent: PG Doc comments form <noreply@postgresql.org>
  1 sibling, 0 replies; 3+ messages in thread

From: David Rowley @ 2024-08-02 15:12 UTC (permalink / raw)
  To: elionescu@yahoo.com; pgsql-docs@lists.postgresql.org

On Sat, 3 Aug 2024 at 02:54, PG Doc comments form
<noreply@postgresql.org> wrote:
> Table 51.63. pg_type Columns
> Name        Type            References
> ----        ----        -----------
> typinput        regproc         pg_proc.oid
> typoutput       regproc         pg_proc.oid
> typreceive      regproc         pg_proc.oid
> typsend         regproc         pg_proc.oid
> typmodin        regproc         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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-08-02 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 14:14 incorrect PostgreSQL documentation for pg_type PG Doc comments form <noreply@postgresql.org>
2024-08-02 15:11 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-08-02 15:12 ` David Rowley <dgrowleyml@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox