From: Tom Lane Date: Fri, 7 Nov 2008 22:54:41 +0000 (+0000) Subject: Improve documentation of pg_typeof, per gripe from David Wheeler. X-Git-Tag: REL8_4_BETA1~745 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=399ad77c66a17ff354e5fbf01ca35c76e2ae88ed;p=postgresql Improve documentation of pg_typeof, per gripe from David Wheeler. --- diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 61460f3c0f..1e32990451 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ - + Functions and Operators @@ -11871,7 +11871,24 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); pg_typeof returns the OID of the data type of the value that is passed to it. This can be helpful for troubleshooting or - dynamically constructing SQL queries. + dynamically constructing SQL queries. The function is declared as + returning regtype, which is an OID alias type (see + ); this means that it is the same as an + OID for comparison purposes but displays as a type name. For example: + +SELECT pg_typeof(33); + + pg_typeof +----------- + integer +(1 row) + +SELECT typlen FROM pg_type WHERE oid = pg_typeof(33); + typlen +-------- + 4 +(1 row) +