id = "postgresql" name = "PostgreSQL" homepage = "https://www.postgresql.org" description = "The world's most advanced open source relational database." icon = "theSVG:postgresql" # One entry for the libpq client programs rather than one per binary: they all # read the same ~/.pgpass and ~/.pg_service.conf, and psql adds its own startup # file on top of them. executables = [ "psql", "pg_dump", "pg_dumpall", "pg_restore", "pg_isready", "pgbench", "createdb", "dropdb", ] [dotfiles] # https://www.postgresql.org/docs/current/app-psql.html, "Files": "The user's # personal startup file is named .psqlrc and is sought in the invoking user's # home directory. On Windows, which lacks such a concept, the personal startup # file is named %APPDATA%\postgresql\psqlrc.conf." The same section: the # startup file "can be made psql-version-specific by appending a dash and the # PostgreSQL major or minor release number to the file name, for example # ~/.psqlrc-9.2" — hence the glob. The docs spell that variant out only for the # Unix name, so only that one is globbed here. # # https://www.postgresql.org/docs/current/libpq-pgservice.html: "By default, # the per-user service file is named ~/.pg_service.conf", and "On Microsoft # Windows, it is named %APPDATA%\postgresql\.pg_service.conf". It holds # connection parameters (host, port, user, dbname) in INI format; passwords # live in .pgpass, below. paths = [ "~/.psqlrc", "~/.psqlrc-*", "%APPDATA%/postgresql/psqlrc.conf", "~/.pg_service.conf", "%APPDATA%/postgresql/.pg_service.conf", ] # Same psql "Files" section: "The command-line history is stored in the file # ~/.psql_history, or %APPDATA%\postgresql\psql_history on Windows." History, # not configuration. exclude = [ "~/.psql_history", "%APPDATA%/postgresql/psql_history", ] # https://www.postgresql.org/docs/current/libpq-pgpass.html: "The file .pgpass # in a user's home directory can contain passwords to be used if the connection # requires a password", one # `hostname:port:database:username:password` per line, and "On Microsoft # Windows the file is named %APPDATA%\postgresql\pgpass.conf". Every line of it # is a password. secret = [ "~/.pgpass", "%APPDATA%/postgresql/pgpass.conf", ] # Read once when a client starts up, by a process that then exits. side_effect = false # No machine_lines. A .psqlrc is \set and \pset preferences — the thing a user # wants on every machine — and a service definition names a database reachable # from anywhere, not a property of this laptop. [commands] format = 1 label = "psql session" description = "Connect with psql and optionally run a command or script file. The other PostgreSQL tools (pg_dump, pg_restore, createdb and so on) are not covered, and passwords are left to the prompt." quality = "ai-draft" base = "fig:psql" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/psql.ts" license = "MIT" [[commands.field]] id = "host" label = "Host" type = "string" option = ["--host", "-h"] sources = ["fig"] [[commands.field]] id = "port" label = "Port" type = "integer" option = ["--port", "-p"] sources = ["fig"] [[commands.field]] id = "username" label = "Username" type = "string" option = ["--username", "-U"] sources = ["fig"] [[commands.field]] id = "dbname" label = "Database" type = "string" option = ["--dbname", "-d"] sources = ["fig"] [[commands.field]] id = "command" label = "SQL command" type = "string" option = ["--command", "-c"] multiple = true sources = ["fig"] [[commands.field]] id = "file" label = "Script file" type = "path" option = ["--file", "-f"] path = { kind = "file", role = "input" } sources = ["fig"] [[commands.field]] id = "list" label = "List databases" type = "boolean" option = ["--list", "-l"] sources = ["fig"] [[commands.field]] id = "tuples_only" label = "Tuples only" type = "boolean" option = ["--tuples-only", "-t"] sources = ["fig"] [[commands.field]] id = "no_align" label = "Unaligned output" type = "boolean" option = ["--no-align", "-A"] sources = ["fig"] [[commands.field]] id = "csv" label = "CSV output" type = "boolean" option = ["--csv"] sources = ["fig"] [[commands.field]] id = "expanded" label = "Expanded output" type = "boolean" option = ["--expanded", "-x"] sources = ["fig"] [[commands.field]] id = "quiet" label = "Quiet" type = "boolean" option = ["--quiet", "-q"] sources = ["fig"] [[commands.field]] id = "no_psqlrc" label = "Ignore psqlrc" type = "boolean" option = ["--no-psqlrc", "-X"] sources = ["fig"] [[commands.field]] id = "single_transaction" label = "Single transaction" type = "boolean" option = ["--single-transaction", "-1"] sources = ["fig"] [[commands.field]] id = "no_password" label = "Never prompt for password" type = "boolean" option = ["--no-password", "-w"] sources = ["fig"] [[commands.task]] id = "connect" label = "Connect" fields = ["host", "port", "username", "dbname"] required = ["dbname"] [[commands.task]] id = "query" label = "Run a query" fields = ["host", "port", "username", "dbname", "command", "csv", "tuples_only"] required = ["dbname", "command"] [[commands.task]] id = "script" label = "Run a script" fields = ["host", "port", "username", "dbname", "file", "single_transaction"] required = ["dbname", "file"] [[commands.group]] id = "basic" label = "Basic" fields = ["host", "port", "username", "dbname", "command"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["file", "list", "tuples_only", "no_align", "csv", "expanded", "quiet", "no_psqlrc", "single_transaction", "no_password"]