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: chap(at)anastigmatix(dot)net
Subject: Re: How to add built-in func?
Date: 2023-09-12 05:11:23
Message-ID: F9C066D6-A0F4-4F4A-A373-227BD17306BE@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 2023年9月12日 00:34,Chapman Flack <chap(at)anastigmatix(dot)net> 写道:
>
> On 2023-09-11 12:28, jacktby jacktby wrote:
>>> 2023年9月11日 23:51,Aleksander Alekseev <aleksander(at)timescale(dot)com> 写道:
>>> 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
>>> --
>> I need to make it used for a new operator in my pg.
>
> You can implement both a function and an operator (and all that goes with)
> in an extension, without having to hack at all on PostgreSQL itself.
> You can then, if it seems generally useful enough, offer that extension
> to go in contrib/. If it's agreed to be something everyone should have,
> it could then make its way into core.
>
> Do you have it working as an extension yet? That can be a good way
> to start, separating the difficulties you have to solve from the ones
> you don't have to solve yet.
>
> Regards,
> -Chap
I solved it , but I need to use it in my new grammar, so I have to add in into core. That’s necessary. Thanks. But My own storage engine is implemented by extension. Extension is a good idea and I’m using it now.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-09-12 05:25:33 Re: persist logical slots to disk during shutdown checkpoint
Previous Message Tom Lane 2023-09-12 04:19:53 Re: PSQL error: total cell count of XXX exceeded