sastraxi/pgsh

Use database comments to filter what we should show in lists

Opened this issue · 0 comments

Currently, we accept a prefix option in the list command to make the output have a higher signal-to-noise when you have multiple projects' databases in your postgres instance.

Another approach is to use COMMENT ON [...] to automatically attach some psql-specific metadata in the database whenever we create databases, and filter to those databases that match the comment.

The proposal is to add something like this to .pgshrc:

{
  auto_comment: 'my_project_name',
}

This would enable both setting comments on creation / cloning and, by default, only showing those databases that match the comment (as well as the current database). We'd probably want to add an option to the list command to ignore all filters set in .pgshrc, as well as to filter to a different comment.

See https://stackoverflow.com/questions/11493978/how-to-retrieve-the-comment-of-a-postgresql-database