Re: How to add built-in func?

From: jacktby jacktby <jacktby(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Subject: Re: How to add built-in func?
Date: 2023-09-11 16:28:05
Message-ID: C48B5AE0-10DF-4EC4-BEED-4694136EBD7F@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 2023年9月11日 23:51,Aleksander Alekseev <aleksander(at)timescale(dot)com> 写道:
>
> Hi,
>
>> I only add below:
>>
>> Datum fake_dinstance2(PG_FUNCTION_ARGS)
>> {
>> PG_RETURN_INT16(0);
>> }
>> in src/backend/utils/adt/int8.c, and the I run “make install”,
>> But I can’t find the fake_distance2 in src/backend/utils/fmgrtab.c which is
>> generated by src/backend/utils/Gen_fmgrtab.pl. What else do I need to add?
>
> If the goal is to add a function that can be executed by a user (e.g.
> via psql) you have to add it to pg_proc.dat, or alternatively (and
> often better) add a corresponding extension to /contrib/. You can find
> a complete example here [1] for instance, see v4-0001 patch and the
> function pg_get_relation_publishing_info(). Make sure it has a proper
> volatility [2]. The patch [3] shows how to add an extension.
>
> [1]: https://postgr.es/m/CAAWbhmjcnoV7Xu6LHr_hxqWmVtehv404bvDye%2BQZcUDSg8NSKw%40mail.gmail.com
> [2]: https://www.postgresql.org/docs/current/xfunc-volatility.html
> [3]: https://postgr.es/m/CAJ7c6TMSat6qjPrrrK0tRTgZsdXwFAbkDn5gjeDtFnUFrjZX-g%40mail.gmail.com
> --
> Best regards,
> Aleksander Alekseev
I need to make it used for a new operator in my pg.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2023-09-11 16:34:05 Re: How to add built-in func?
Previous Message Pavel Stehule 2023-09-11 16:19:49 Re: How to add built-in func?