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

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Steve Chavez <steve(at)supabase(dot)io>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pg_basetype() function to obtain a DOMAIN base type
Date: 2023-11-18 00:00:00
Message-ID: CACJufxFo9WAW_J8A=wOq4G_eeB5KBd8TKJoRtVzfrkcQAVeCVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 28, 2023 at 11:56 AM Alexander Korotkov
<aekorotkov(at)gmail(dot)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.

Attachment Content-Type Size
v2-0001-get-the-base-type-of-a-domain.patch text/x-patch 8.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-11-18 00:01:31 Re: Change GUC hashtable to use simplehash?
Previous Message Andres Freund 2023-11-17 23:27:12 Re: Change GUC hashtable to use simplehash?