Hi folks,

As discussed on -hackers [1], here is a patch to add a pg_typeof()
builtin function to core.

The function accepts one argument (type "any") and returns the regtype
of that argument.  This can be helpful in various circumstances,
including troubleshooting cast/coercion behaviour in a query, or
constructing dynamic SQL statements.

It's declared in builtins.h and defined in utils/adt/misc.c.

The patch includes a small documentation update; I added pg_typeof()
to Table 9-47. System Catalog Information Functions, and a brief
descriptive paragraph underneath the table.

This didn't seem like it warranted any additional regression tests.

Added to the November commitfest.


 doc/src/sgml/func.sgml           |   15 +++++++++++++++
 src/backend/utils/adt/misc.c     |    9 +++++++++
 src/include/catalog/catversion.h |    2 !!
 src/include/catalog/pg_proc.h    |    2 ++
 src/include/utils/builtins.h     |    1 +
 5 files changed, 27 insertions(+), 2 modifications(!)

[1] http://archives.postgresql.org/message-id/[EMAIL PROTECTED]

Attachment: pg_typeof.diff
Description: Binary data

Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:

Reply via email to