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

Поиск
Список
Период
Сортировка
От jian he
Тема Re: Add pg_basetype() function to obtain a DOMAIN base type
Дата
Msg-id CACJufxFX1by6p23QTSF6JDdOLVbNSdGwGPKvxvnKDhs2pyhmYw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add pg_basetype() function to obtain a DOMAIN base type  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Add pg_basetype() function to obtain a DOMAIN base type  (jian he <jian.universality@gmail.com>)
Re: Add pg_basetype() function to obtain a DOMAIN base type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, Mar 18, 2024 at 11:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alexander Korotkov <aekorotkov@gmail.com> writes:
> > On Mon, Mar 18, 2024 at 2:01 AM jian he <jian.universality@gmail.com> wrote:
> >> `
> >> Datum
> >> pg_basetype(PG_FUNCTION_ARGS)
> >> {
> >>      Oid oid;
> >>
> >>      oid =  get_fn_expr_argtype(fcinfo->flinfo, 0);
> >>      PG_RETURN_OID(getBaseType(oid));
> >> }
> >> `
>
> > Looks good to me.  But should it be named pg_basetypeof()?
>
> I still don't like this approach.  It forces the function to be
> used in a particular way that's highly redundant with pg_typeof.
> I think we'd be better off with
>
> pg_basetype(PG_FUNCTION_ARGS)
> {
>         Oid typid = PG_GETARG_OID(0);
>
>         PG_RETURN_OID(getBaseType(typid));
> }
>
> The use-case that the other definition handles would be implemented
> like
>
>         pg_basetype(pg_typeof(expression))
>

trying to do it this way.
not sure the following error message is expected.

SELECT pg_basetype(-1);
ERROR:  cache lookup failed for type 4294967295

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Possibility to disable `ALTER SYSTEM`
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: [PoC] Improve dead tuple storage for lazy vacuum