neon icon indicating copy to clipboard operation
neon copied to clipboard

Forward parameters to compute in proxy

Open LizardWizzard opened this issue 3 years ago • 8 comments

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?

LizardWizzard avatar Feb 16 '22 13:02 LizardWizzard

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.

hlinnaka avatar Feb 16 '22 13:02 hlinnaka

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.

LizardWizzard avatar Feb 16 '22 14:02 LizardWizzard

I'm going to tackle this.

funbringer avatar Feb 22 '22 16:02 funbringer

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

stepashka avatar Mar 24 '22 14:03 stepashka

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.

hlinnaka avatar Sep 20 '22 06:09 hlinnaka

Huh... I guess it's time to bite the bullet and lift the limitations imposed by tokio-postgres.

funbringer avatar Sep 20 '22 11:09 funbringer

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.

conradludgate avatar Dec 08 '23 12:12 conradludgate