Search Postgresql Archives

Re: how to check if the license is expired.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Mar 31, 2024, at 09:59, Peter J. Holzer <hjp-pgsql@xxxxxx> wrote:
> Is this an acceptable performance penalty per API call? If not, is it
> really necessary to check this on every call? Maybe it can be done just
> once per session or once per hour.

It's probably not required to check it every API call.  Two places come to mind:

_PG_init -- Although I don't know the possibility or wisdom of reading from a file there.
shmem_startup_hook -- It's definitely OK to read from a file there.

Remember that you have the full ability to crash PostgreSQL in an extension, so it really needs to be bulletproof.  You don't want the shared library to fail to load if the license isn't valid.  Instead:

-- If the functionality is exposed as functions, return an error when one of those functions is used, if the extension is not licensed.
-- If the functionality modifies PostgreSQL behavior, disable that modification.

If you are validating the license via a network call... I would counsel against having a network call as part of PostgreSQL's startup process.  It might work to make the call on-demand the first time the extension is used, and the result stored locally, although I would limit that to function calls rather than, say, a hook into the planner.

You also need to decide exactly how you want to distribute this extension.  Most PostgreSQL extensions are supplied as source and built against PostgreSQL.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux