PostgREST / postgrest-openapi

OpenAPI output generated in SQL for a PostgREST instance
MIT License
17 stars 4 forks source link

Version detection #14

Open laurenceisla opened 1 year ago

laurenceisla commented 1 year ago

We need to find a way on how to detect the PostgREST version. Maybe using this https://github.com/PostgREST/postgrest/issues/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 commented 1 year ago

Hm, what's the need for the version?

laurenceisla commented 1 year ago

@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 commented 11 months ago

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

https://github.com/PostgREST/postgrest-openapi/blob/106e51cff64525dfbb21de2b7935f6a94173fe11/sql/main.sql#L3-L6

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 commented 10 months ago

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

steve-chavez commented 10 months ago

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 https://github.com/PostgREST/postgrest/issues/3019