From: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se> |
Subject: | Re: [PoC] Federated Authn/z with OAUTHBEARER |
Date: | 2024-08-28 16:31:07 |
Message-ID: | CAOYmi+nwexxyLWxFFV1_owEY4DOOQL2dM31L98pNvg_8M7zAig@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Aug 26, 2024 at 4:23 PM Jacob Champion
<jacob(dot)champion(at)enterprisedb(dot)com> wrote:
> I was having trouble reasoning about the palloc-that-isn't-palloc code
> during the first few drafts, so I will try a round with the jsonapi_
> prefix.
v27 takes a stab at that. I have kept the ALLOC/FREE naming to match
the strategy in other src/common source files.
The name of the variable JSONAPI_USE_PQEXPBUFFER leads to sections of
code that look like this:
+#ifdef JSONAPI_USE_PQEXPBUFFER
+ if (!new_prediction || !new_fnames || !new_fnull)
+ return false;
+#endif
To me it wouldn't be immediately obvious why "using PQExpBuffer" has
anything to do with this code; the key idea is that we expect any
allocations to be able to fail. Maybe a name like JSONAPI_ALLOW_OOM or
JSONAPI_SHLIB_ALLOCATIONS or...?
> It complicates the test coverage situation a little
> bit, but I think my current patch was maybe insufficient there anyway,
> since the coverage for the backend flavor silently dropped...
To do this without too much pain, I split the "forbidden" objects into
their own shared library, used only by the JSON tests which needed
them. I tried not to wrap too much ceremony around them, since they're
only needed in one place, so they don't have an associated Meson
dependency object.
> > Or maybe there is a clever way to avoid even that: Create a
> > fixed JsonLexContext like
> >
> > static const JsonLexContext failed_oom;
I think this turned out nicely. Two slight deviations from this are
that we can't return a pointer-to-const, and we also need an OOM
sentinel for the JsonIncrementalState, since it's possible to
initialize incremental parsing into a JsonLexContext that's on the
stack.
--Jacob
Attachment | Content-Type | Size |
---|---|---|
since-v26.diff.txt | text/plain | 50.4 KB |
v27-0001-common-jsonapi-support-libpq-as-a-client.patch | application/octet-stream | 46.2 KB |
v27-0002-libpq-add-OAUTHBEARER-SASL-mechanism.patch | application/octet-stream | 118.6 KB |
v27-0003-backend-add-OAUTHBEARER-SASL-mechanism.patch | application/octet-stream | 67.8 KB |
v27-0004-Review-comments.patch | application/octet-stream | 6.3 KB |
v27-0005-DO-NOT-MERGE-Add-pytest-suite-for-OAuth.patch | application/octet-stream | 180.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Karlsson | 2024-08-28 16:43:49 | Re: tiny step toward threading: reduce dependence on setlocale() |
Previous Message | Andreas Karlsson | 2024-08-28 16:26:04 | Re: Remaining dependency on setlocale() |