mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-29 14:57:25 +00:00
[proxy] Forward compute connection params to client
This fixes all kinds of problems related to missing params, like broken timestamps (due to `integer_datetimes`). This solution is not ideal, but it will help. Meanwhile, I'm going to dedicate some time to improving connection machinery. Note that this **does not** fix problems with passing certain parameters in a reverse direction, i.e. **from client to compute**. This is a separate matter and will be dealt with in an upcoming PR.
This commit is contained in:
@@ -122,3 +122,33 @@ def test_auth_errors(static_proxy: NeonProxy):
|
||||
# Finally, check that the user can connect
|
||||
with static_proxy.connect(user="pinocchio", password="magic", options="project=irrelevant"):
|
||||
pass
|
||||
|
||||
|
||||
def test_forward_params_to_client(static_proxy: NeonProxy):
|
||||
# A subset of parameters (GUCs) which postgres
|
||||
# sends to the client during connection setup.
|
||||
# Unfortunately, `GUC_REPORT` can't be queried.
|
||||
# Proxy *should* forward them, otherwise client library
|
||||
# might misbehave (e.g. parse timestamps incorrectly).
|
||||
reported_params_subset = [
|
||||
"client_encoding",
|
||||
"integer_datetimes",
|
||||
"is_superuser",
|
||||
"server_encoding",
|
||||
"server_version",
|
||||
"session_authorization",
|
||||
"standard_conforming_strings",
|
||||
]
|
||||
|
||||
query = """
|
||||
select name, setting
|
||||
from pg_catalog.pg_settings
|
||||
where name = any(%s)
|
||||
"""
|
||||
|
||||
with static_proxy.connect(options="project=irrelevant") as conn:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(query, (reported_params_subset,))
|
||||
for name, value in cur.fetchall():
|
||||
# Check that proxy has forwarded this parameter.
|
||||
assert conn.get_parameter_status(name) == value
|
||||
|
||||
Reference in New Issue
Block a user