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: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Steve Chavez <steve@supabase.io>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2023-11-18T00:00:00Z
Lists: pgsql-hackers

Attachments

On Thu, Sep 28, 2023 at 11:56 AM Alexander Korotkov
<aekorotkov@gmail.com> wrote:
>
> The one thing triggering my perfectionism is that the patch does two
> syscache lookups instead of one.  In order to fit into one syscache
> lookup we could add "bool missing_ok" argument to
> getBaseTypeAndTypmod().  However, getBaseTypeAndTypmod() is heavily
> used in our codebase.  So, changing its signature would be invasive.
> Could we invent getBaseTypeAndTypmodExtended() (ideas for a better
> name?) that does all the job and supports "bool missing_ok" argument,
> and have getBaseTypeAndTypmod() as a wrapper with the same signature?
>

hi.
attached patch, not 100% confident it's totally correct, but one
syscache lookup.
another function getBaseTypeAndTypmodExtended added.

getBaseTypeAndTypmodExtended function signature:
Oid getBaseTypeAndTypmodExtended(Oid typid, int32 *typmod, bool missing_ok).

based on Steve Chavez's patch, minor doc changes.

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.