{"record":{"id":"63b678f74e623dad","repo":"getredash/redash","slug":"extra-parameters-may-not-contain","errorCode":null,"errorMessage":"Extra parameters may not contain {}","messagePattern":"Extra parameters may not contain (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"redash/query_runner/pg.py","lineNumber":146,"sourceCode":"            os.remove(v)\n\n\ndef _get_ssl_config(configuration):\n    ssl_config = {\"sslmode\": configuration.get(\"sslmode\", \"prefer\")}\n\n    _create_cert_file(configuration, \"sslrootcert\", ssl_config)\n    _create_cert_file(configuration, \"sslcert\", ssl_config)\n    _create_cert_file(configuration, \"sslkey\", ssl_config)\n\n    return ssl_config\n\n\ndef _parse_dsn(configuration):\n    standard_params = {\"user\", \"password\", \"host\", \"port\", \"dbname\"}\n    params = psycopg2.extensions.parse_dsn(configuration.get(\"dsn\", \"\"))\n    overlap = standard_params.intersection(params.keys())\n    if overlap:\n        raise ValueError(\"Extra parameters may not contain {}\".format(overlap))\n    return params\n\n\nclass PostgreSQL(BaseSQLQueryRunner):\n    noop_query = \"SELECT 1\"\n\n    @classmethod\n    def configuration_schema(cls):\n        return {\n            \"type\": \"object\",\n            \"properties\": {\n                \"user\": {\"type\": \"string\"},\n                \"password\": {\"type\": \"string\"},\n                \"host\": {\"type\": \"string\", \"default\": \"127.0.0.1\"},\n                \"port\": {\"type\": \"number\", \"default\": 5432},\n                \"dbname\": {\"type\": \"string\", \"title\": \"Database Name\"},\n                \"dsn\": {\"type\": \"string\", \"default\": \"application_name=redash\", \"title\": \"Parameters\"},\n                \"sslmode\": {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/getredash/redash/blob/ca79fe988d81cdac9675b412f3dfcab107bc1fbc/redash/query_runner/pg.py#L128-L164","documentation":"The PostgreSQL runner splits configuration between the DSN string and separate fields (user, password, host, port, dbname). _parse_dsn() runs psycopg2's parse_dsn on the DSN and refuses to proceed if any of those five standard keys also appear inside the DSN, raising ValueError to avoid ambiguous duplicate configuration.","triggerScenarios":"A DSN like \"postgresql://user:pass@host:5432/mydb\" or \"host=db user=u password=p dbname=mydb\" — any DSN containing user/password/host/port/dbname keys overlapping the runner's standard params.","commonSituations":"Pasting a full connection URI from another tool (psql, SQLAlchemy) into Redash's DSN field, since Redash expects the DSN to hold only extra options (sslmode, connect_timeout, etc.).","solutions":["Put only non-standard options in the DSN, e.g. \"sslmode=require connect_timeout=10\", and set user/password/host/port/dbname in their dedicated Redash fields","If a URI is needed for options, keep the standard parts in the fields, e.g. dsn=\"?sslmode=require\" style extras only","Re-test the connection after moving values out of the DSN"],"exampleFix":"# before\ndsn = \"postgresql://u:p@host:5432/mydb?sslmode=require\"\n# after\ndsn = \"sslmode=require\"  # plus host=host, port=5432, dbname=mydb, user=u, password=p in their own fields","handlingStrategy":"validation","validationCode":"std = {'user','password','host','port','dbname'}\nfrom psycopg2.extensions import parse_dsn\noverlap = std & set(parse_dsn(dsn))\nassert not overlap, f'move {overlap} out of the DSN into their own fields'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the DSN for extras only (sslmode, connect_timeout, options)","Never paste full postgresql:// URIs into the DSN field","Run test_parse_dsn-style checks in config validation pipelines"],"tags":["postgresql","psycopg2","redash","dsn","config-validation"],"backgroundTag":"connection-string-misconfigured","analyzedSha":"ca79fe988d81cdac9675b412f3dfcab107bc1fbc","analyzedAt":"2026-08-28T18:32:34.637Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}