conninfo
conninfo · Parse, validate, and inspect default values for PostgreSQL libpq conninfo strings
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100528 | conninfo | conninfo | 1.0 | UTIL | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
conninfo exposes the server’s linked libpq parser and defaults as SQL functions. Use it to split a connection string, check that libpq can parse it, or inspect effective default connection parameters; it never attempts a database connection.
Core Workflow
conninfo_parse(text) returns one keyword/value row per supplied option and raises an error for a malformed or unknown option. conninfo_validate(text) returns false and emits a warning for the same parse failure. A true result means only that libpq accepted the syntax and option names; it does not validate reachability, credentials, TLS, or the semantic suitability of values.
Function Index
conninfo_parse(text)returnsSETOF recordwithkeyword textandvalue text.conninfo_validate(text)returnsboolean.conninfo_defaults()returnskeyword,envvar,compiled,value,label,dispchar, anddispsizefromPQconndefaults().
Security and Compatibility
Parsed values and defaults can contain passwords, including values inherited from PGPASSWORD or a libpq service/environment setting. Do not log query results, expose the functions through an untrusted API, or grant access without considering credential disclosure.
The functions use the libpq library and environment attached to the PostgreSQL server process, which may differ from a client application’s libpq build and environment. Validate with the same client runtime when client-specific behavior matters.