This is a list of URLs to PostgreSQL EXTENSION repos, listed in alphabetical order of parent repo, with active forks listed under each parent.
⭐️ >= 10 stars
⭐️⭐️ >= 100 stars
⭐️⭐️⭐️ >= 1000 stars
Numbers of stars might not be up-to-date.
| #!/usr/bin/python | |
| import os | |
| import hashlib | |
| import getpass | |
| import base64 | |
| password1 = None | |
| password2 = None |
| pg_cron | pgAGent | ||
|---|---|---|---|
| GUI | no | yes | |
| CLI | yes | no | |
| Complex scheduling | Standard crontab; one cron entry per execution (of command [sql or plpgsql] or.sql file | Multiple steps per entry; multiple schedules for the same step without duplicating it | |
| Requires extra software | extension in shared_preload_libraries; installed via yum or similar | pgAdmin is required to manage jobs; installed via yum or similar; runs as a separate daemon | |
| Runs inside the database | yes | Jobs are stored in the database but are managed externally via pgAdmin; scheduling is run via the external daemon | |
| Can be run without sSQL knowledge | no | yes | |
| Requires Postgres cluster restart | yes | no |
| -- v5 | |
| ----------------------------------------------------------- basic instance info | |
| -- show db version | |
| SELECT version(); | |
| -- uptime | |
| SELECT pg_postmaster_start_time(); | |
| -- show connections |
| #!/usr/bin/env bash | |
| ### Bash Environment Setup | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html | |
| # set -o xtrace | |
| set -o errexit | |
| set -o errtrace | |
| set -o nounset | |
| set -o pipefail |
In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.
One of the symptoms of such corruptions is the following message:
ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678
This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.
| -- This function terminates all Postgres sessions which state have been changed "age" minutes ago. | |
| -- Usage example: | |
| -- select * from flush_connections(60); | |
| -- | |
| -- Or just (but result will be less readable): | |
| -- select flush_connections(60); | |
| -- | |
| -- By default, terminates only sessions with "state = 'idle'". | |
| -- If needed, you can terminate ALL sessions, regardless of their states: | |
| -- select * from flush_connections(60, true); |
| package main | |
| import ( | |
| "crypto/sha512" | |
| "encoding/base64" | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| ) |
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |