Function get_markdown_doku_by_schema

The function returns a Markdown text documentation for the given schema name.

Parameters

  • in_schema_name: Name of the schema for which the documentation should be generated
  • time_zone: The time zone that is used add a timestamp, when the documentation has been created

Objects

The Markdown contains documentation for the following objects:

  • Database
  • Schema
  • Tables with columns
  • Views with columns
  • Materialized Views with columns
  • Foreign Tables with columns
  • Functions
  • Procedures

For each object the basic informations and comments are included in the documentation.

Example

This example is generating the documentation as Markdown for the current database:

WITH res AS
  (
    SELECT array_agg (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 (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
;