neondatabase / pg_session_jwt

Postgres Extension for JWT Sessions
Apache License 2.0
28 stars 2 forks source link

Incorrect function markings #17

Open MMeent opened 1 month ago

MMeent commented 1 month ago

Steps to reproduce

Check the generated SQL, code, and migrations

Expected result

Actual result

Functions that depend on non-GUC backend-local state are marked as PARALLEL SAFE:

This can be solved by passing a GucStringAssignHook to DefineCustomStringVariable (or its pgrx equivalent).

conradludgate commented 1 month ago

We were informed that parallel workers are shutdown after every query. Is that then not the case?

conradludgate commented 1 month ago

This can be solved by passing a GucStringAssignHook to DefineCustomStringVariable (or its pgrx equivalent).

Looks like there is no pgrx equivalent at present. For now I will add a manual slower check for if the GUC has changed.

MMeent commented 1 month ago

We were informed that parallel workers are shutdown after every query. Is that then not the case?

no, that is correct. But data produced in a parallel worker may be different if their local state is constructed differently from others; e.g. pg_backend_pid() would output differently across backends, and is thus marked parallel restricted - the query may be parallel, but the function can only be executed in the primary process, never in a parallel portion of the plan.

davidgomes commented 1 day ago

@MMeent can we close this now?