Re: Add pg_basetype() function to obtain a DOMAIN base type

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>, Steve Chavez <steve@supabase.io>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-01-02T00:00:00Z
Lists: pgsql-hackers

Attachments

On Mon, Dec 4, 2023 at 5:11 PM John Naylor <johncnaylorls@gmail.com> wrote:
>
> On Thu, Sep 28, 2023 at 12:22 AM Alexander Korotkov
> <aekorotkov@gmail.com> wrote:
> > The one thing triggering my perfectionism is that the patch does two
> > syscache lookups instead of one.
>
> For an admin function used interactively, I'm not sure why that
> matters? Or do you see another use case?

I did a minor refactor based on v1-0001.
I think pg_basetype should stay at "9.26.4. System Catalog Information
Functions".
So I placed it before pg_char_to_encoding.
Now functions listed on "Table 9.73. System Catalog Information
Functions" will look like alphabetical ordering.
I slightly changed the src/include/catalog/pg_proc.dat.
now it looks like very similar to pg_typeof

src6=# \df pg_typeof
                           List of functions
   Schema   |   Name    | Result data type | Argument data types | Type
------------+-----------+------------------+---------------------+------
 pg_catalog | pg_typeof | regtype          | "any"               | func
(1 row)

src6=# \df pg_basetype
                            List of functions
   Schema   |    Name     | Result data type | Argument data types | Type
------------+-------------+------------------+---------------------+------
 pg_catalog | pg_basetype | regtype          | "any"               | func
(1 row)

v2-0001 is as is in the first email thread, 0002 is my changes based on v2-0001.

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add pg_basetype() function to extract a domain's base type.