public inbox for [email protected]
help / color / mirror / Atom feedFrom: Christophe Pettus <[email protected]>
To: [email protected]
Cc: pgsql-generallists.postgresql.org <[email protected]>
Cc: Peter J. Holzer <[email protected]>
Subject: Re: how to check if the license is expired.
Date: Sun, 31 Mar 2024 13:09:43 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAKgrFs_hTqZgVBoq1dAL=-aMo8Qs-VXAZEDXUrmwZJ5aDYsftA@mail.gmail.com>
<CANzqJaAQSgi5YUvXq9bSGMxw7JrdAnyjYpdLUb+dPDTB3=aahQ@mail.gmail.com>
<[email protected]>
> On Mar 31, 2024, at 09:59, Peter J. Holzer <[email protected]> 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.
view thread (4+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: how to check if the license is expired.
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox