PGCHARTS(1)

πŸ“¦ version 1.0+2017-09-16, in ubuntu jammy

πŸ’… PGCHARTS β€” like, the PostgreSQL data loader, bestie πŸ’…

okay so you found the manual for pgcharts β€” that's the section 1 (general commands) page, the one you get from man 1 pgcharts. Grab a boba, we're doing this. πŸ§‹βœ¨


✨ NAME ✨

pgcharts β€” the PostgreSQL data loader. That's the whole job description. Iconic. 🫢


🌸 SYNOPSIS 🌸

pgcharts [options] [command-file]...

πŸ¦‹ DESCRIPTION πŸ¦‹

pgcharts is The PostgreSQL Extension Installer server. Periodt. That's literally the description and we're not gonna pretend it's more than that. πŸ’–


πŸŽ€ OPTIONS πŸŽ€

  • -h, --help β€” shows you the command usage summary and then dips out. ✌️
  • -V, --version β€” prints the pgcharts version string and exits. no cap.
  • -c, --config β€” use the configuration file you point at here (it defaults to "~/.pgcharts.ini"). πŸ“

πŸ‘‘ COMMANDS πŸ‘‘

The pgcharts binary is what lets you run and control the embedded pgcharts web server. Two moods, one binary. main character energy fr fr. ✨

βš™οΈ CONFIGURATION CONTROL βš™οΈ

So like, you can ship a configuration file, or hand-write one yourself β€” totally valid. But these commands let you control the whole setup straight from the command line instead, which is lowkey so much nicer. πŸ’…

  • config [ name ] [ value ] With no arguments at all, it prints the entire configuration file content. Give it just a variable name and it prints that variable's current value. Give it both a name and a value and it sets the configuration variable to the value you gave it. ✨
  • config get <name> Prints the current value of the configuration variable name.
  • config set <name> <value> Sets the variable name to the given value.

πŸ–₯️ SERVER CONTROL πŸ–₯️

Heads up bestie β€” The PostgreSQL Extension Installer comes with a PostgreSQL plugin that downloads static files, and that part doesn't need any server at all. πŸƒ So what's this server for then?? It's meant to be used by maintainers of a set of extension archives, when they want to make the maintenance and setup of the building easier. iykyk.

  • start Starts the embedded pgcharts HTTP server on the port it's been setup to listen to, which defaults to 8042. The
πŸ’€ okay so that sentence just… ends. "The" and then nothing. We're keeping it exactly as written because I do not make the rules. Iconic of it honestly.
  • stop Stops the server. Simple. Slay. βœ‹
  • status Prints the result of querying the HTTP status API against the (hopefully πŸ™) running server.
  • pid Prints the registered pid of the server process. ⚠️ careful though β€” this info might be stale if the server terminated unexpectedly. It's giving "trust but verify".
  • setup <dburi> Connects to the PostgreSQL database you specify with the dburi parameter, and installs the database model there. πŸ—οΈ

πŸ—‚οΈ REGISTERING DATABASES πŸ—‚οΈ

Once pgcharts is properly setup (see the setup command up there ⬆️), you still gotta add the databases you want to run queries against and draw charts from. That's this part. πŸ’–

  • register <dburi> Registers the given dburi. That's it, that's the whole thing. πŸŽ€

🌈 DATABASE URI 🌈

The dburi connection string is expected to be given as a Connection URI, exactly as documented in the PostgreSQL documentation over at http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNSTRING.

postgresql://[user[:password]@][netloc][:port][/dbname][?sslmode=...]

Where:

  • user Can contain any character, including a colon (:) which then must be doubled (::), and an at-sign (@) which then must be doubled (@@). 🫠

When it's omitted, the user name defaults to the value of the PGUSER environment variable, and if that is unset, it falls back to the value of the USER environment variable.

  • password Can contain any character, including that at-sign (@) which then must be doubled (@@). To leave the password empty, when the user name ends with an at-sign you then have to use the syntax user:@. ✍️

When omitted, the password defaults to the value of the PGPASSWORD environment variable if it's set β€” otherwise the password is just left unset.

  • netloc Can be either a hostname in dotted notation, or an ipv4, or a Unix domain socket path. Empty is the default network location, and on a system that provides unix domain socket, that method is preferred β€” otherwise the netloc defaults to localhost.

It's possible to force the unix domain socket path by using the syntax unix:/path/to/where/the/socket/file/is, so to force a non default socket path and a non default port, you'd have:

postgresql://unix:/tmp:54321/dbname

The netloc defaults to the value of the PGHOST environment variable, and if it's unset, it goes to either the default unix socket path when running on a Unix system, or localhost otherwise. 🌍

  • dbname Should be a proper identifier β€” a letter followed by a mix of letters, digits, and the punctuation signs comma (,), dash (-) and underscore (_). πŸ“

When omitted, the dbname defaults to the value of the environment variable PGDATABASE, and if that's unset, it defaults to the user value as determined above.

  • The only optional parameter supported is sslmode, and it accepts the values disable, allow, prefer and require. πŸ”’ (that's the whole list, don't try to sneak anything else in there)

πŸ’œ AUTHOR πŸ’œ

Dimitri Fontaine β€” dimitri@2ndQuadrant.fr πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

The pgcharts source code and all documentation may be downloaded from https://github.com/dimitri/pgcharts/. Go get it, bestie. 🌈⭐


and that's the whole page, mwah πŸ’‹ β€” this one was put together by ff, dated June 2015. ty for coming to my ted talk, now go draw some charts πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from