You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: special char in dbname is not correctly handled #77
@Cito Hi~ Do we have a plan to refactor the function of connect() in pgdb.py? Since the semantics and parameter settings of this function are weird and ambiguous.
For example, the DSN string can't support adding a port to it, cause the format must be 'host:base:user:passwd:opt', we can just add a port to the named parameter host using IP:PORT.
And if we use both DSN and named parameters, there will be mutual coverage. From the current code point of view, named parameters will override the value in DSN.
From my experience, it's better to make the function semantics clearer, just like pymysql.connect:
Fixed in #113, which will be part of version 6.3. When pgdb.connect() is called with additional keyword arguments, all values, including the database name, are now always quoted and escaped, so names containing quotes or backslashes work as expected.
The broader redesign of connect() discussed above would be a breaking change, so it is now tracked in #114 for version 7.0.
Activity
SKeyerror commentedon Aug 18, 2022
Maybe some refactoring should be done to the function
connect()🤔SKeyerror commentedon Aug 18, 2022
@Cito Hi~ Do we have a plan to refactor the function of
connect()in pgdb.py? Since the semantics and parameter settings of this function are weird and ambiguous.For example, the DSN string can't support adding a port to it, cause the format must be
'host:base:user:passwd:opt', we can just add a port to the named parameterhostusingIP:PORT.And if we use both DSN and named parameters, there will be mutual coverage. From the current code point of view, named parameters will override the value in DSN.
From my experience, it's better to make the function semantics clearer, just like
pymysql.connect:Cito commentedon Aug 18, 2022
Will look into this in the next major version which will also allow us to introduce some breaking changes.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Escape database name for dbconn.
Always quote connection parameters passed as kwargs
Cito commentedon Nov 22, 2026
Fixed in #113, which will be part of version 6.3. When
pgdb.connect()is called with additional keyword arguments, all values, including the database name, are now always quoted and escaped, so names containing quotes or backslashes work as expected.The broader redesign of
connect()discussed above would be a breaking change, so it is now tracked in #114 for version 7.0.