Skip to content
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

Version detection #14

Open
laurenceisla opened this issue Jun 22, 2023 · 5 comments
Open

Version detection #14

laurenceisla opened this issue Jun 22, 2023 · 5 comments

Comments

@laurenceisla
Copy link
Member

laurenceisla commented Jun 22, 2023

We need to find a way on how to detect the PostgREST version. Maybe using this PostgREST/postgrest#2647 could help, but if it fails it needs to be retrieved from another source.

https://github.com/laurenceisla/postgrest-openapi/blob/74430c6e72fdf745a63727020679101a50c4fd6d/src/postgrest.sql#L506-L511

@steve-chavez
Copy link
Member

Hm, what's the need for the version?

@laurenceisla
Copy link
Member Author

laurenceisla commented Jun 22, 2023

@steve-chavez For the Info Object it's mostly to get the same result as the core repo. But it may be also needed to generate the documentarion URL (although this one needs a simplified version).

Edit: Btw I mistakenly said "PostgreSQL" version instead of "PostgREST" version.

@steve-chavez steve-chavez changed the title Version dectection Version detection Oct 21, 2023
@steve-chavez
Copy link
Member

Got it. So I guess the same problem exists for the server_proxy_uri too:

create or replace function get_postgrest_openapi_spec(
schemas text[],
server_proxy_uri text default 'http://0.0.0.0:3000',
version text default null

While the schemas can be obtained from our tx-settings.


Maybe we need a concept of session-scoped settings on PostgREST to make this work. So each config option (coming from file or env var) gets a set_config($,$, false) thus is always available. Unlike tx-settings this wouldn't have a perf cost impact.

@wayland
Copy link
Contributor

wayland commented Nov 4, 2023

What are tx-settings? I'm assuming it means transaction settings? Is this set_config within a transaction or something?

@steve-chavez
Copy link
Member

I'm assuming it means transaction settings? Is this set_config within a transaction or something?

@wayland Yes, basically set_config(.., .., true). We use them like mentioned on PostgREST/postgrest#3019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants