db-table-info.adp

Delivered as text/html

Related Files

[ hide source ] | [ make this the default ]

File Contents

<master>
<property name="title">Table information for "@nspname@.@relname@"</property>

<h1 style="background-color:#CECDB4;"><if @relkind@ eq "r">Table</if><else>View</else> "@nspname@.@relname@"</h1>
<p><b>OID:</b> @oid@</p>

<if @database_object_description@ ne "">
	<p>@database_object_description@</p>
</if>

<table class="list" cellpadding="3" cellspacing="1">
	<tr class="list-header">
		<th class="list">Column</th>
		<th class="list">Type</th>
		<th class="list">Modifier</th>
		<th class="list">Description</th>
	</tr>
<multiple name="columns">
	<tr <if @columns.rownum@ odd>class="list-odd"</if><else>class="list-even"</else>>
		<td class="list">@columns.attname@</td>
		<td class="list">@columns.format_type@</td>
		<td class="list"><if @columns.attnotnull@ eq "t">not null</if><if @columns.default@ ne ""> default @columns.default@</if></td>
		<td class="list">@columns.col_description@</td>
	</tr>
</multiple>
</table>

<if @relkind@ eq "v">
	<h3>View Definition</h3>
	<pre style="font-size: 14px;">@show_view_def;noquote@</pre>
</if>


<p><a href="db-table-data?t=@nspname@.@relname@">Show table data</a></p>



<if @indices:rowcount@ gt 0>
<h3 style="background-color:#CECDB4;">Indices</h3>

<table style="margin-left:10px;">
<multiple name="indices">
	<tr >
		<td ><b>@indices.relname@</b></td>
		<td >@indices.pg_get_indexdef@</td>
	</tr>
</multiple>
</table>
</if>

<if @table_constraints:rowcount@ gt 0>
<h3 style="background-color:#CECDB4;">Table constraints</h3>
<multiple name="table_constraints">
<h4 style="margin-left:10px;">
<switch @table_constraints.contype@>
	<case value="c">Check constraints</case>
	<case value="p">Primary-key constraints</case>
	<case value="u">Unique constraint</case>
	<case value="f">Foreign-key constraints</case>
</switch>
</h4>
<table style="margin-left:20px;">
	<group column="contype">
	<tr>
		<td><b>@table_constraints.conname@</b></td><td>@table_constraints.condef;noquote@</td>
	</tr>
	</group>
</table>
</multiple>
</if>


<if @triggers:rowcount@ gt 0>
<h3 style="background-color:#CECDB4;">Triggers</h3>
<table>
<multiple name="triggers">
	<tr>
		<td><b>@triggers.tgname@</b></td><td>@triggers.pg_get_triggerdef;noquote@</td>
	</tr>
</multiple>
</table>
</if>

<if @foreign_keys:rowcount@ gt 0>
<h3 style="background-color:#CECDB4;">Foreign-key references to this table</h3>
<table class="list" cellpadding="3" cellspacing="1">
	<tr class="list-header">
		<th class="list">Table</th>
		<th class="list">Name</th>
		<th class="list">Definition</th>
	</tr>
<multiple name="foreign_keys">
	<tr <if @foreign_keys.rownum@ odd>class="list-odd"</if><else>class="list-even"</else>>
		<td class="list"><a href="table-info?table=@foreign_keys.table_name@">@foreign_keys.table_name@</a></td>
		<td class="list">@foreign_keys.conname@</td>
		<td class="list">@foreign_keys.condef;noquote@</td>
	</tr>
</multiple>
</table>

</if>


<if @stats:rowcount@ gt 0>
<h3 style="background-color:#CECDB4;">Table Stats</h3>
<table border="1">
	<tr>
		<th>Column </th>
		<th>Fraction of column entries that are null</th>
		<th>Average width in bytes of column's entries</th>
		<th>Estimated number of distinct values in the column</th>
		<th>Most common values</th>
		<th>Frequencies of the most common values</th>
		<th>correlation</th>		
	</tr>
	
<multiple name="stats">
	<tr>
		<td><b>@stats.attname@</b></td>
		<td>@stats.null_frac@</td>
		<td>@stats.avg_width@</td>
		<td>@stats.n_distinct@</td>
		<td>@stats.most_common_vals@</td>
		<td>@stats.most_common_freqs@</td>
		<td>@stats.correlation@</td>
	</tr>
</multiple>
</table>
<h3 style="background-color:#CECDB4;">Statistics Collector Stats</h3>
<listtemplate name="collector_stats"></listtemplate>
<h3 style="margin-top:15px;background-color:#CECDB4;">Disk Usage</h3>
<p>Disk space used by this table (table and TOAST)</p>
<listtemplate name="disk_usage"></listtemplate>

</if>