pgsql_tweaks is a bundle of functions and views for PostgreSQL
Published on February 19, 2025 by Stefanie Janine Stölting
PostgreSQL Extension pgsql_tweaks
1 min READ
The source code is available on GitLab, a mirror is hosted on GitHub.
One could install the whole package, or just copy what is needed from the source code.
The extension is also available on PGXN.
As PostgreSQL 12 is not supported anymore, it went out of support on November 21, 2024, it has been removed from the supported versions of pgsql_tweaks.
The extension has now a new function to create a Markdown documentation for the giving schema name: get_markdown_doku_by_schema.
So far the following objects are supported:
For each object the basic informations and comments are included in the documentation.
This example is generating the documentation as Markdown for the current database:
WITH res AS
(
SELECT array_agg (stats.get_markdown_doku_by_schema(schema_name)) AS markdown
FROM information_schema.schemata
WHERE information_schema.schemata.catalog_name = (current_database())::information_schema.sql_identifier
-- Exclude some system schemas
AND schema_name NOT IN
(
'information_schema',
'pg_catalog',
'pg_toast'
)
-- Exclude empty results
AND COALESCE (stats.get_markdown_doku_by_schema(schema_name), '') <> ''
)
-- CHR(13) is a line break and is used here to have two
-- line breaks between every schema result
SELECT array_to_string(markdown, CHR(13) || CHR(13)) AS markdown_for_all_schemas
FROM res
;