Add pg_basetype() function to extract a domain's base type.
commitb154d8a6d0e52e5f6b09739639fdf55fa88bc6b8
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 30 Mar 2024 17:57:19 +0000 (30 13:57 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 30 Mar 2024 17:57:19 +0000 (30 13:57 -0400)
treefe758a1a6130bb68b0f3f93d05d1276ef0014a78
parentecf741cfae0603d1df269d8b799455bbcaef86e7
Add pg_basetype() function to extract a domain's base type.

This SQL-callable function behaves much like our internal utility
function getBaseType(), except it returns NULL rather than failing for
an invalid type OID.  (That behavior is modeled on our experience with
other catalog-inquiry functions such as the ACL checking functions.)
The key advantage over doing a join to pg_type is that it will loop
as needed to find the bottom base type of a nest of domains.

Steve Chavez, reviewed by jian he and others

Discussion: https://postgr.es/m/CAGRrpzZSX8j=MQcbCSEisFA=ic=K3bknVfnFjAv1diVJxFHJvg@mail.gmail.com
doc/src/sgml/func.sgml
src/backend/utils/adt/misc.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/domain.out
src/test/regress/sql/domain.sql