Skip to content
pgsql_tweaks

pgsql_tweaks

pgsql_tweaks : Some functions and views for daily usage

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4200
pgsql_tweaks
pgsql_tweaks
1.0.5
UTIL
PostgreSQL
SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
pg_extra_time
extra_window_functions
gzip
bzip
zstd
http
pg_net
pg_curl

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
1.0.5
18
17
16
15
14
pgsql_tweaks-
RPM
PIGSTY
1.0.5
18
17
16
15
14
pgsql_tweaks_$v-
DEB
PIGSTY
1.0.5
18
17
16
15
14
postgresql-$v-pgsql-tweaks-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
el8.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
el9.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
el9.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
el10.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
el10.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
d12.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
d12.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
d13.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
d13.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
u22.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
u22.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
u24.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
u24.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
u26.x86_64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
u26.aarch64
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PIGSTY 1.0.5
PackageVersionOSORGSIZEFile URL
pgsql_tweaks_181.0.5el8.x86_64pigsty29.5 KiBpgsql_tweaks_18-1.0.5-1PIGSTY.el8.x86_64.rpm
pgsql_tweaks_181.0.3el8.x86_64pgdg29.2 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel8.10.noarch.rpm
pgsql_tweaks_181.0.2el8.x86_64pgdg29.1 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel8.noarch.rpm
pgsql_tweaks_181.0.5el8.aarch64pigsty29.5 KiBpgsql_tweaks_18-1.0.5-1PIGSTY.el8.aarch64.rpm
pgsql_tweaks_181.0.3el8.aarch64pgdg29.1 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel8.10.noarch.rpm
pgsql_tweaks_181.0.2el8.aarch64pgdg29.1 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel8.noarch.rpm
pgsql_tweaks_181.0.5el9.x86_64pigsty28.7 KiBpgsql_tweaks_18-1.0.5-1PIGSTY.el9.x86_64.rpm
pgsql_tweaks_181.0.3el9.x86_64pgdg27.7 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel9.8.noarch.rpm
pgsql_tweaks_181.0.3el9.x86_64pgdg27.7 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel9.7.noarch.rpm
pgsql_tweaks_181.0.3el9.x86_64pgdg27.7 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel9.6.noarch.rpm
pgsql_tweaks_181.0.2el9.x86_64pgdg27.8 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel9.8.noarch.rpm
pgsql_tweaks_181.0.2el9.x86_64pgdg27.8 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel9.noarch.rpm
pgsql_tweaks_181.0.5el9.aarch64pigsty28.6 KiBpgsql_tweaks_18-1.0.5-1PIGSTY.el9.aarch64.rpm
pgsql_tweaks_181.0.3el9.aarch64pgdg27.6 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel9.8.noarch.rpm
pgsql_tweaks_181.0.3el9.aarch64pgdg27.6 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel9.7.noarch.rpm
pgsql_tweaks_181.0.3el9.aarch64pgdg27.6 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel9.6.noarch.rpm
pgsql_tweaks_181.0.2el9.aarch64pgdg27.7 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel9.8.noarch.rpm
pgsql_tweaks_181.0.2el9.aarch64pgdg27.7 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel9.noarch.rpm
pgsql_tweaks_181.0.5el10.x86_64pigsty28.8 KiBpgsql_tweaks_18-1.0.5-1PIGSTY.el10.x86_64.rpm
pgsql_tweaks_181.0.3el10.x86_64pgdg27.8 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel10.2.noarch.rpm
pgsql_tweaks_181.0.3el10.x86_64pgdg27.8 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel10.1.noarch.rpm
pgsql_tweaks_181.0.3el10.x86_64pgdg28.2 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel10.0.noarch.rpm
pgsql_tweaks_181.0.2el10.x86_64pgdg27.9 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel10.2.noarch.rpm
pgsql_tweaks_181.0.2el10.x86_64pgdg28.3 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel10.noarch.rpm
pgsql_tweaks_181.0.5el10.aarch64pigsty28.7 KiBpgsql_tweaks_18-1.0.5-1PIGSTY.el10.aarch64.rpm
pgsql_tweaks_181.0.3el10.aarch64pgdg27.7 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel10.2.noarch.rpm
pgsql_tweaks_181.0.3el10.aarch64pgdg27.7 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel10.1.noarch.rpm
pgsql_tweaks_181.0.3el10.aarch64pgdg27.7 KiBpgsql_tweaks_18-1.0.3-1PGDG.rhel10.0.noarch.rpm
pgsql_tweaks_181.0.2el10.aarch64pgdg27.9 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel10.2.noarch.rpm
pgsql_tweaks_181.0.2el10.aarch64pgdg28.2 KiBpgsql_tweaks_18-1.0.2-1PGDG.rhel10.noarch.rpm
postgresql-18-pgsql-tweaks1.0.5d12.x86_64pigsty20.4 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~bookworm_amd64.deb
postgresql-18-pgsql-tweaks1.0.5d12.aarch64pigsty20.4 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~bookworm_arm64.deb
postgresql-18-pgsql-tweaks1.0.5d13.x86_64pigsty20.4 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~trixie_amd64.deb
postgresql-18-pgsql-tweaks1.0.5d13.aarch64pigsty20.4 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~trixie_arm64.deb
postgresql-18-pgsql-tweaks1.0.5u22.x86_64pigsty20.8 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~jammy_amd64.deb
postgresql-18-pgsql-tweaks1.0.5u22.aarch64pigsty20.8 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~jammy_arm64.deb
postgresql-18-pgsql-tweaks1.0.5u24.x86_64pigsty20.8 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~noble_amd64.deb
postgresql-18-pgsql-tweaks1.0.5u24.aarch64pigsty20.8 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~noble_arm64.deb
postgresql-18-pgsql-tweaks1.0.5u26.x86_64pigsty20.8 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~resolute_amd64.deb
postgresql-18-pgsql-tweaks1.0.5u26.aarch64pigsty20.8 KiBpostgresql-18-pgsql-tweaks_1.0.5-1PIGSTY~resolute_arm64.deb

Source

pig build pkg pgsql_tweaks;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pgsql_tweaks;		# install via package name, for the active PG version

pig install pgsql_tweaks -v 18;   # install for PG 18
pig install pgsql_tweaks -v 17;   # install for PG 17
pig install pgsql_tweaks -v 16;   # install for PG 16
pig install pgsql_tweaks -v 15;   # install for PG 15
pig install pgsql_tweaks -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION pgsql_tweaks;

Usage

Sources: Codeberg README, documentation site, Codeberg tags.

pgsql_tweaks provides DBA-oriented helper functions and views in the pgsql_tweaks schema. The upstream test matrix covers PostgreSQL 14 through PostgreSQL 19 beta 1; Pigsty packages it for PostgreSQL 14-18.

Data Type Check Functions

SELECT pgsql_tweaks.is_date('2024-01-15');
SELECT pgsql_tweaks.is_time('10:30:00');
SELECT pgsql_tweaks.is_timestamp('2024-01-15 10:30:00');
SELECT pgsql_tweaks.is_real('3.14');
SELECT pgsql_tweaks.is_double_precision('3.14');
SELECT pgsql_tweaks.is_numeric('3.14');
SELECT pgsql_tweaks.is_bigint('9223372036854775807');
SELECT pgsql_tweaks.is_integer('42');
SELECT pgsql_tweaks.is_smallint('42');
SELECT pgsql_tweaks.is_boolean('true');
SELECT pgsql_tweaks.is_json('{"a":1}');
SELECT pgsql_tweaks.is_jsonb('{"a":1}');
SELECT pgsql_tweaks.is_hex('FF');

System Information Functions

SELECT pgsql_tweaks.pg_schema_size('public');
SELECT * FROM pgsql_tweaks.role_inheritance();

Encoding Functions

SELECT pgsql_tweaks.is_encoding('UTF8');
SELECT pgsql_tweaks.is_latin1('abc');
SELECT pgsql_tweaks.return_not_part_of_latin1('abc');
SELECT pgsql_tweaks.replace_latin1('abc', '?');
SELECT pgsql_tweaks.return_not_part_of_encoding('abc', 'UTF8');
SELECT pgsql_tweaks.replace_encoding('abc', 'UTF8', '?');

Aggregate Functions

  • gap_fill, for filling gaps in time series.
  • array_min, array_max, array_avg, and array_sum.

Format And Conversion Functions

SELECT pgsql_tweaks.date_de(current_date);
SELECT pgsql_tweaks.datetime_de(now());
SELECT pgsql_tweaks.to_unix_timestamp(now());
SELECT pgsql_tweaks.hex2bigint('FF');

Utility Functions

SELECT pgsql_tweaks.is_empty('');
SELECT pgsql_tweaks.array_trim(ARRAY['a', '', 'b']);
SELECT pgsql_tweaks.get_markdown_doku_by_schema('pgsql_tweaks');

System Information Views

  • pg_db_views, pg_foreign_keys, pg_functions, pg_active_locks.
  • pg_table_matview_infos, pg_object_ownership, pg_partitioned_tables_infos.
  • pg_unused_indexes, pg_bloat_info, pg_table_bloat, pg_missing_indexes.
  • pg_role_permissions, pg_role_infos.

Statistic And Monitoring Views

  • statistics_top_ten_query_times, top_ten_query_average_time_in_seconds.
  • statistics_top_ten_time_consuming_queries, statistics_top_ten_memory_usage_queries.
  • statistics_top_ten_called_queries, statistics_top_ten_rows_returned_queries.
  • statistics_top_ten_shared_block_hits_queries, statistics_top_ten_wal_records_generated_queries.
  • statistics_query_activity.
  • monitoring_wal, wal_archiving, monitoring_active_locks, monitoring_replication.
  • monitoring_database_conflicts, monitoring_blocked_and_blocking_activity.
  • monitoring_follower_wal_status, monitoring_vacuum.

Caveats

  • Some views/functions depend on additional PostgreSQL supplied modules; upstream lists pg_stat_statements and pgstattuple.
  • The Codeberg tag for v1.0.3 says release files were added; no material user-facing function or view delta was identified from the README and tag metadata.
Last updated on