Autodoc - Templates

PostgreSQL Autodoc uses the Perl library HTML::Templates to accomplish the text based substitutions within a template file. A description of how to create a template can be found on their SourceForge site, specifically, the section on the tags.

Variables with sub-structures are arrays or lists of information that should be looped through via TMPL_LOOP. Otherwise, they are plain variables that hold a single piece of information which may be retrieved via TMPL_VAR.

Template Variable Structure

database, database_dbk

The database name in plain text and DocBook prepared formats, respectively.

database_sgmlid

The database identifier suitable for an ID attribute within DocBook or HTML.

database_comment, database_comment_dbk

The comment associated with the database in plain text and prepared for DocBook respectively.

dumped_on, dumped_on_dbk

The date that this documentation was created on in plain text and DocBook prepared formats, respectively.

fk_links

This variable holds an array of foreign key link objects intended for use in graphical outputs Dia and GraphViz in generating a list of all relevant cross connections based on connection points.

Structure of fk_links

fk_link_name, fk_link_name_dbk, fk_link_name_dot

The name of the foreign key constraint prepared in plain text, DocBook prepared formats, and GraphViz escaped, respectively.

GraphViz does not allow whitespace or quotes, so fk_link_name_dot has those characters escaped.

handle0_connection, handle0_connection_dbk, handle0_connection_dia

The integer connection point for the left hand, referenced, side of the foreign key connection with prepared offsets for DocBook and Dia.

handle0_name, handle0_name_dbk

The name of the table on the left hand, referenced, side of the foreign key connection in plain text and DocBook prepared form, respectively.

handle0_schema

The name of the schema on the left hand, referenced, side of the foreign key connection in plain text.

handle0_to, handle0_to_dbk

Numerical identifier of the table on the left hand, referenced, side of they foreign key connection in plain text and DocBook prepared form, respectively.

handle1_connection, handle1_connection_dbk, handle1_connection_dia

The integer connection point for the right hand, referencing, side of the foreign key connection as raw data, with prepared offsets for DocBook and Dia respectively.

handle1_name, handle1_name_dbk

The name of the table on the right hand, referencing, side of the foreign key connection in plain text and DocBook prepared form, respectively.

handle1_schema

The name of the schema on the right hand, referencing, side of the foreign key connection in plain text.

handle1_to, handle1_to_dbk

Numerical identifier of the table on the right hand, referencing, side of they foreign key connection in plain text and DocBook prepared form, respectively.

object_id, object_id_dbk

A unique identifier for this object which should be used whenever there is a need for a unique and meaningless identifier.

number_of_schemas

If there is more than one schema this value is defined with that number. If there is exactly one schema this variable will not be defined.

schemas

schemas holds an array of schema objects which carries the structure of the schema based objects.

Structure of schemas

schema, schema_dbk

The schema name in plain text and prepared DocBook respectively.

schema_sgmlid

An identifier for the schema appropriate for use as a ID within HTML or DocBook.

schema_comment, schema_comment_dbk

Schema comments in plain text and DocBook prepared formats, respectively.

number_of_schemas

If there is more than one schema this value is defined with that number. If there is exactly one schema this variable will not be defined.

functions

An array holding function definitions.

Structure of functions

function, function_dbk

The function name in plain text and DocBook prepared form, respectively.

function_sgmlid

An identifier for the function appropriate for an entity ID.

function_comment, function_comment_dbk

Function comments in plain text and DocBook prepared formats, respectively.

function_language

The language of the function in plain text.

function_returns

The return type of the function in plain text.

function_source

Function source code as originally written by the user.

schema, schema_dbk

The name of the schema that the function resides in, both in plain text and DocBook prepared formats, respectively.

schema_sgmlid

An identifier for the schema appropriate for use as a ID within HTML or DocBook.

tables

tables holds an array of table and view objects.

Structure of tables

number_of_schemas

If there is more than one schema this value is defined with that number. If there is exactly one schema this variable will not be defined.

object_id, object_id_dbk

A globally unique object identifier (integer).

schema, schema_dbk

Name of the schema in which the table resides, in plain text and DocBook prepared formats, respectively.

schema_sgmlid

An identifier for the schema appropriate for use as a ID within HTML or DocBook.

stats_enabled

A boolean parameter that shows whether the below stats parameters are available or not. Since gathering stats is a resource intensive process they are not enabled by default.

stats_dead_bytes, stats_dead_bytes_dbk

The number of bytes (with units) within the structure held by dead tuples in plain text and DocBook prepared form, respectively.

stats_free_bytes, stats_free_bytes_dbk

The number of bytes (with units) within the structure that is free space in plain text and DocBook prepared formats, respectively.

stats_table_bytes, stats_table_bytes_dbk

The total number of bytes (with units) taken on disk by the structure in plain text and DocBook prepared formats, respectively.

stats_tuple_count, stats_tuple_count_dbk

The number of active tuples within the structure in plain text and DocBook prepared formats, respectively.

stats_tuple_bytes, stats_tuple_bytes_dbk

The number of bytes (with units) within the structure that is taken by active data in plain text and DocBook prepared formats, respectively.

table, table_dbk

The name of the table in plain text and DocBook prepared formats, respectively.

table_sgmlid

An identifier appropriate for the ID attribute within HTML and DocBook prepared formats, respectively.

table_comment, table_comment_dbk

The comment associated with the table in plain text and DocBook prepared formats, respectively.

view_definition, view_definition_dbk

If this table is really a view, then it this variable will be set to the query which defines the view. Available in plain text and DocBook prepared formats, respectively.

columns

columns holds an array of column descriptive objects.

Structure of columns

column, column_dbk

The name of the column in plain text and DocBook prepared formats, respectively.

column_default, column_default_dbk, column_default_short, column_default_short_dbk

The column default in plain text, DocBook, truncated plain text, and truncated DocBook prepared formats, respectively.

column_comment, column_comment_dbk

The column comment in plain text and DocBook prepared formats, respectively.

column_number

The columns position within the table starting with 1.

column_type, column_type_dbk

The columns data type in plain text and DocBook prepared formats, respectively.

column_constraint_notnull

column_constraint_notnull will be defined if the column has a NOT NULL constraint applied to it.

column_constraints

column_constraints is an array holding data about constraints, aside from NOT NULL, that have been applied to this column.

Structure of column_constraints

column_unique

Defined if this is a UNIQUE constraint and is set to the value of UNIQUE.

column_unique_colnum

Set to the column number which this constraint applies to. In the case of a multi-key UNIQUE constraint, there will be several entries within this array grouped by column_unique_keygroup.

column_unique_keygroup

Set to the a grouping number if there are multiple columns involved in the UNIQUE constraint, otherwise undefined.

column_fk

Defined as FOREIGN KEY if this is a FOREIGN KEY constraint.

column_fk_column

The column position number starting count at position 1.

column_fk_keygroup

Set to the a grouping number if there are multiple columns involved in the FOREIGN KEY constraint, otherwise undefined.

column_fk_schema, column_fk_schema_dbk

The name of the referenced schema in plain text and DocBook prepared formats, respectively.

column_fk_sgmlid

An identifier which is intended to be used to reference the identifier loaded into the ID attribute via column_sgmlid. That is, column_fk_sgmlid points to the referenced table definition.

column_fk_table, column_fk_table_dbk

The referenced table name in plain text and DocBook prepared formats, respectively.

column_primary_key

Defined as PRIMARY KEY if the current column is a part of the PRIMARY KEY constraint.

number_of_schemas

If there is more than one schema this value is defined with that number. If there is exactly one schema this variable will not be defined.

constraints

constraints holds an array of constraints and the constraint definition for multi-column CHECK constraints.

Structure of constraints

constraint, constraint_dbk

The multi-column constraint definition in plain text and DocBook prepared formats, respectively.

constraint_name, constraint_name_dbk

The constraint name in plain text and DocBook prepared formats, respectively.

constraint_short, constraint_short_dbk

The multi-column constraint definition in a shorter, truncated syntax in plain text and DocBook prepared formats, respectively.

table, table_dbk

The table that the constraint is applied to in plain text and DocBook prepared formats, respectively.

fk_schemas

fk_schemas holds an array of foreign key descriptive elements appropriate for cross referencing single and multi-key foreign keys.

Structure of fk_schemas

fk_column_number

The position within fk_table that this column resides. Position count starts with 1.

fk_sgmlid

An identifier appropriate for this foreign key within an ID attribute in HTML or DocBook outputs.

fk_schema, fk_schema_dbk

Schema in which the foreign key resides in plain text and DocBook prepared formats, respectively.

fk_table, fk_table_dbk

The table on which the foreign key constraint has been applied in plain text and DocBook prepared formats, respectively.

number_of_schemas

If there is more than one schema this value is defined with that number. If there is exactly one schema this variable will not be defined.

indexes

indexes holds an array of index descriptive elements which are not otherwise described as a constraint. That is, non-unique indexes only.

Structure of indexes

index_definition, index_definition_dbk

A list of columns and non-default operator classes which form the index definition.

index_name, index_name_dbk

The index name in plain text and DocBook prepared formats, respectively.

table_name, table_name_dbk

Table in which the index resides in plain text and DocBook prepared formats, respectively.

schema_name, schema_name_dbk

Schema in which the index resides in plain text and DocBook prepared formats, respectively.

inherits

inherits holds an array of describing the inheritance tree of all structures.

Structure of inherits

parent_table_name, parent_table_name_dbk

Table name of the parent relation in plain text and DocBook prepared formats, respectively.

parent_schema_name, parent_schema_name_dbk

Schema name for the parent relation in plain text and DocBook prepared formats, respectively.

table_name, table_name_dbk

Table which inherits the structure of the parent in plain text and DocBook prepared formats, respectively.

schema_name, schema_name_dbk

Schema name of the table inheriting the structure of the parent in plain text and DocBook prepared formats, respectively.

permissions

permissions holds an array of permissions and how they apply to database users and groups.

Structure of permissions

number_of_schemas

If there is more than one schema this value is defined with that number. If there is exactly one schema this variable will not be defined.

schema, schema_dbk

The name of the schema in which the table resides in plain text and DocBook prepared formats, respectively.

table, table_dbk

The name of the table in plain text and DocBook prepared formats, respectively.

user, user_dbk

The user or group to whom the permissions apply in plain text and DocBook prepared formats, respectively.

delete, insert, references, rule, select, trigger, update

If any of these variables are defined, user has the corresponding PostgreSQL permission.