Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
tlocke committed Sep 14, 2024
1 parent eb5eb7f commit e62f018
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ these additional parameters can be specified using the `startup_params` paramete
... 'postgres', password="cpsnow", startup_params={'IntervalStyle': 'sql_standard'})
>>>
>>> con.run("SHOW IntervalStyle")
[['...', 1, '.../...', 'postgres']]
[['sql_standard']]
>>>
>>> con.close()

Expand Down
6 changes: 4 additions & 2 deletions src/pg8000/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,15 @@ def __init__(
"application_name": application_name,
"replication": replication,
}
common_params = init_params.keys() & startup_params
start_params = {} if startup_params is None else startup_params
common_params = init_params.keys() & start_params.keys()

if len(common_params) > 0:
raise InterfaceError(
"The parameters '{common_params}' can't appear in startup_params, they "
"must be set using keyword arguments."
)
init_params.update(startup_params)
init_params.update(start_params)

for k, v in tuple(init_params.items()):
if isinstance(v, str):
Expand Down

0 comments on commit e62f018

Please sign in to comment.