var_table regclass := ( p_table_schema || '.' || p_table_name )::regclass;
var_common_col_names text[] :=
, 'diag_timestamp_created'
, 'diag_timestamp_modified'
, 'diag_wallclock_modified'
, 'diag_update_count']::text[];
$DOC$The record's primary key. The definitive identifier of the record in the
var_internal_name text :=
$DOC$A candidate key useful for programmatic references to individual records.$DOC$;
$DOC$A friendly name and candidate key for the record, suitable for use in user
var_external_name text :=
$DOC$A non-unique/non-key value used to display to users and external parties where
uniqueness is less of a concern than specific end user presentation.$DOC$;
$DOC$Values of `TRUE` in this column indicate that the record is considered a
"System Defined" record, a record which is created and primarily maintained by
the system using automated processes. A value of `FALSE` indicates that the
record is considered a "User Defined" record which is maintained by user actions
in the application.$DOC$;
var_user_maintainable text :=
$DOC$If a record is system defined (see the `syst_defined` column), there may be
some user data maintenance operations permitted in some cases. If the value of
this column for a record is `TRUE` and the record is also "System Defined", then
permitted user maintenance operations are available for the record. If the
record is system defined and the value of this column is `FALSE`, no user
maintenance is allowed. If the record is not system defined, the value in this
column will have no meaning or effect; user defined records may set this value
`TRUE` as a simple information point indicating that the record is user
var_syst_description text :=
$DOC$A system defined description indicating the purpose and use cases of a given
record. Text defined in this column is system maintained and should not be
changed under normal circumstances.$DOC$;
var_user_description text :=
$DOC$An optional user defined description of the record and its use cases. If this
value is not `NULL`, the value will override any `syst_description` defined text
in application user interfaces and other presentations.$DOC$;
var_diag_timestamp_created text :=
$DOC$The database server date/time when the transaction which created the record
var_diag_role_created text :=
$DOC$The database role which created the record.$DOC$;
var_diag_timestamp_modified text :=
$DOC$The database server date/time when the transaction which modified the record
started. This field will be the same as diag_timestamp_created for inserted
var_diag_wallclock_modified text :=
$DOC$The database server date/time at the moment the record was actually modified.
For long running transactions this time may be significantly later than the
value of diag_timestamp_modified.$DOC$;
var_diag_role_modified text :=
$DOC$The database role which modified the record.$DOC$;
var_diag_row_version text :=
$DOC$The current version of the row. The value here indicates how many actual
data changes have been made to the row. If an update of the row leaves all data
fields the same, disregarding the updates to the diag_* columns, the row version
is not updated, nor are any updates made to the other diag_* columns other than
var_diag_update_count text :=
$DOC$Records the number of times the record has been updated regardless as to if
the update actually changed any data. In this way needless or redundant record
updates can be found. This row starts at 0 and therefore may be the same as the
diag_row_version - 1.$DOC$;
ms_syst_priv.generate_comments_table_column(
p_table_schema => p_table_schema,
p_table_name => p_table_name,
WHEN pa.attname = 'id' THEN
WHEN pa.attname = 'internal_name' THEN
WHEN pa.attname = 'display_name' THEN
WHEN pa.attname = 'external_name' THEN
WHEN pa.attname = 'syst_defined' THEN
WHEN pa.attname = 'user_maintainable' THEN
WHEN pa.attname = 'syst_description' THEN
WHEN pa.attname = 'user_description' THEN
WHEN pa.attname = 'diag_timestamp_created' THEN
var_diag_timestamp_created
WHEN pa.attname = 'diag_role_created' THEN
WHEN pa.attname = 'diag_timestamp_modified' THEN
var_diag_timestamp_modified
WHEN pa.attname = 'diag_wallclock_modified' THEN
var_diag_wallclock_modified
WHEN pa.attname = 'diag_role_modified' THEN
WHEN pa.attname = 'diag_row_version' THEN
WHEN pa.attname = 'diag_update_count' THEN
WHEN pa.attname IN ('external_name', 'user_description') THEN
E'This column is system maintained and should be ' ||
E'considered read only in normal\noperations.'
WHEN pa.attname = 'diag_row_version' THEN
E'This column is frequently used by by application ' ||
E'logic to resolve the "dirty\nwrite" issues which ' ||
E'can arise from concurrent data changes. As such ' ||
E'any\nadministrative override of automatic system ' ||
E'maintenance of this value should\nconsider the ' ||
E'ramifications on application function.'
END)::ms_syst_priv.comments_config_table_column
AND pa.attname::text = ANY (var_common_col_names)