1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Fix pgstattuple functions to use regclass-type as the argument.

This allows us to specify the target relation with several expressions,
'relname', 'schemaname.relname' and OID in all pgstattuple functions.
pgstatindex() and pg_relpages() could not accept OID as the argument
so far.

Per discussion on -hackers, we decided to keep two types of interfaces,
with regclass-type and TEXT-type argument, for each pgstattuple
function because of the backward-compatibility issue. The functions
which have TEXT-type argument will be deprecated in the future release.

Patch by Satoshi Nagayasu, reviewed by Rushabh Lathia and Fujii Masao.
This commit is contained in:
Fujii Masao
2013-07-19 03:50:20 +09:00
parent d26888bc4d
commit 1dc118660b
8 changed files with 280 additions and 29 deletions

View File

@ -22,7 +22,7 @@
</indexterm>
<term>
<function>pgstattuple(text) returns record</>
<function>pgstattuple(regclass) returns record</>
</term>
<listitem>
@ -30,7 +30,7 @@
<function>pgstattuple</function> returns a relation's physical length,
percentage of <quote>dead</> tuples, and other info. This may help users
to determine whether vacuum is necessary or not. The argument is the
target relation's name (optionally schema-qualified).
target relation's name (optionally schema-qualified) or OID.
For example:
<programlisting>
test=> SELECT * FROM pgstattuple('pg_catalog.pg_proc');
@ -125,13 +125,15 @@ free_percent | 1.95
<varlistentry>
<term>
<function>pgstattuple(oid) returns record</>
<function>pgstattuple(text) returns record</>
</term>
<listitem>
<para>
This is the same as <function>pgstattuple(text)</function>, except
that the target relation is specified by OID.
This is the same as <function>pgstattuple(regclass)</function>, except
that the target relation is specified by TEXT. This function is kept
because of backward-compatibility so far, and will be deprecated in
the future release.
</para>
</listitem>
</varlistentry>
@ -141,7 +143,7 @@ free_percent | 1.95
<indexterm>
<primary>pgstatindex</primary>
</indexterm>
<function>pgstatindex(text) returns record</>
<function>pgstatindex(regclass) returns record</>
</term>
<listitem>
@ -251,6 +253,21 @@ leaf_fragmentation | 0
</listitem>
</varlistentry>
<varlistentry>
<term>
<function>pgstatindex(text) returns record</>
</term>
<listitem>
<para>
This is the same as <function>pgstatindex(regclass)</function>, except
that the target index is specified by TEXT. This function is kept
because of backward-compatibility so far, and will be deprecated in
the future release.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<indexterm>
@ -316,7 +333,7 @@ pending_tuples | 0
<indexterm>
<primary>pg_relpages</primary>
</indexterm>
<function>pg_relpages(text) returns bigint</>
<function>pg_relpages(regclass) returns bigint</>
</term>
<listitem>
@ -326,6 +343,22 @@ pending_tuples | 0
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<function>pg_relpages(text) returns bigint</>
</term>
<listitem>
<para>
This is the same as <function>pg_relpages(regclass)</function>, except
that the target relation is specified by TEXT. This function is kept
because of backward-compatibility so far, and will be deprecated in
the future release.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>