-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing instruction for integrating into PostgREST #19
Comments
I had a bit of a go at this, and came up with create or replace function callable_root() returns jsonb as $$
SELECT get_postgrest_openapi_spec(
schemas := string_to_array(current_setting('pgrst.db_schemas', TRUE), ','),
version := 'not-spec'
);
$$ language sql; The problem seems to be that pgrst.db_schemas is coming back as null. If I replace the call to current_setting with the name of the schema I'm using, then it works. Can we get PostgREST to do a set_config before running this? |
Yeah, to make this work I think we need to do @laurenceisla WDYT? |
Great! That would solve many problems. Then, the go to would be to query configs from the DB by setting those values every request done to the root/openapi endpoint in PostgREST. |
No, not really. I was thinking we need to initialize the pool connections with those settings. IIRC we did this before for |
In a conversation at PostgREST/postgrest#1698 (comment) , I'd asked:
...and @steve-chavez replied:
...but that's not actually the answer I was looking for -- I wanted to run a query when one of the events in https://postgrest.org/en/stable/references/configuration.html#configuration-reloading happens. Is that at all achievable? Thanks! |
Ah, but wouldn't the pool restarting still be a problem? The request is done by PostgREST after all, or am I missing something? |
Here's a list of the ones I think we'll need:
And renamed from pgrst:
...and two new ones I think we should have (which would go straight into the info block):
...and maybe even:
Ideally, there'd be a system where there'd be a bunch of config files, including pgrst.conf and openapi.conf, and the setting names would be derived from filename + settingname. I'm happy if we don't end up with that setup, but a man can dream :p Edit: Having looked at the other thread, we could use server_proxy_uri instead if that's a preferred option (I'll have to tear out some of my code, but that's OK :-) ). HTH, |
OK, I've had another bit of a look around. How would this be for an idea:
Does that sound like a useful plan? Edit: Also, I've just created PostgREST/postgrest#3029 asking for the three variables we know we need. |
@wayland Thanks for consolidating the discussion!
@laurenceisla Right, I think it might be simpler to just add tx-settings for the special case of the root spec for now. Let's continue on PostgREST/postgrest#3029 |
Problem
Related to PostgREST/postgrest#1698 (comment).
Solution
Instructions need to be added to the README.
I assume we need a wrapper function that calls get_postgrest_openapi_spec? Then define it in https://postgrest.org/en/stable/references/configuration.html#db-root-spec as:
The text was updated successfully, but these errors were encountered: