[IMP] provide pg connection information as keywords
When the database_or_uri is not a URI, rather than generate a dsn string just collect the various psycopg2.connect keyword arguments in a dictionary, and return that. This way psycopg2/libpq is the one doing any necessary processing on the various parameters. Fixes #3865 and fixes #6958 in a more resilient manner than manually escaping dsn-injected values so database names or passwords containing spaces or non-ascii characters work correctly. In case a URI is provided to the dsn() function, return it as the `dsn` keyword to get the same behaviour as previously. Since we're checking dsns by equality, a dict should work just as well as a string.
Please register or sign in to comment