neon
neon copied to clipboard
Forward parameters to compute in proxy
Currently proxy eats parameters that are not needed for it e.g it doesn't pass application name to compute.
The other question is what is a precise list of parameters we need to support? Are there any parameters that we fundamentally cannot support?
The proxy should pass through everything, and let Postgres reject invalid ones. It's not the proxy's job to guess which ones are valid, IMHO.
If necessary, the proxy could recognize some options to control the proxy itself, though. I don't know if we have any such options today, or if that's needed in the future.
Plus one on passthrough except authentication parameters that proxy changes because it performs the mapping via console.
Also such parameters as encryption settings for connection from proxy to compute are controlled by us and user cannot affect them.
I'm going to tackle this.
Are there any paramenters that are critical to pass through for the nearest milestones? Sending to backlog because we don't seem to have those
I tested this on staging with this little test program (from https://community.neon.tech/t/error-connecting-edgedb-intervalstyle-parameter-ignored/107/6):
import asyncpg
import asyncio
async def main():
conn = await asyncpg.connect("postgres://hlinnaka:[email protected]:5432/main?sslmode=require", server_settings={"IntervalStyle": "iso_8601"})
#conn = await asyncpg.connect("postgres://localhost/postgres", server_settings={"IntervalStyle": "iso_8601"})
print(await conn.fetchval("select to_json('0 seconds'::interval)"))
await conn.close()
asyncio.run(main())
It prints:
"00:00:00"
But against a local postgres installation, it prints:
"PT0S"
The latter is expected. It seems to me that the IntervalStyle option is still not passed through.
Huh... I guess it's time to bite the bullet and lift the limitations imposed by tokio-postgres.
TODO: tokio-postgres Config needs to accept an arbitrary "options" parameter that we can feed in our options into. The Config::params
function is a good candidate. It currently errors on unknown parameter but we can instead save them to a vec.