|
9 | 9 |
|
10 | 10 | <para>
|
11 | 11 | The <filename>dump_stat</> module provides functions that allow you to
|
12 |
| - backup and recover the contents of the pg_statistic table. |
| 12 | + backup and recover the contents of the pg_statistic table. The |
| 13 | + <function>dump_statistic</> function generates <literal>INSERT</> statements which |
| 14 | + can later be applied to a compatible PostgreSQL server. The extension |
| 15 | + should be installed on the recipient server in order to successfuly restore |
| 16 | + statistical data since these statements rely on the provided functions. |
13 | 17 | </para>
|
14 | 18 |
|
15 | 19 | <sect2>
|
|
36 | 40 | </para>
|
37 | 41 | </listitem>
|
38 | 42 | </varlistentry>
|
| 43 | + |
| 44 | + <varlistentry> |
| 45 | + <term> |
| 46 | + <function>dump_statistic(schema_name text) returns setof text</function> |
| 47 | + <indexterm> |
| 48 | + <primary>dump_statistic</primary> |
| 49 | + </indexterm> |
| 50 | + </term> |
| 51 | + |
| 52 | + <listitem> |
| 53 | + <para> |
| 54 | + <function>dump_statistic</function> dumps the contents of the |
| 55 | + <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> |
| 56 | + system catalog. It produces an <literal>INSERT</> statement |
| 57 | + per each tuple of the <literal>pg_statistic</>, excluding |
| 58 | + the ones that contain statistical data for tables in |
| 59 | + <literal>information_schema</> and <literal>pg_catalog</> |
| 60 | + schemas. |
| 61 | + </para> |
| 62 | + </listitem> |
| 63 | + </varlistentry> |
| 64 | + |
| 65 | + <varlistentry> |
| 66 | + <term> |
| 67 | + <function>dump_statistic(schema_name text, table_name text) returns setof text</function> |
| 68 | + <indexterm> |
| 69 | + <primary>dump_statistic</primary> |
| 70 | + </indexterm> |
| 71 | + </term> |
| 72 | + |
| 73 | + <listitem> |
| 74 | + <para> |
| 75 | + <function>dump_statistic</function> dumps the contents of the |
| 76 | + <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> |
| 77 | + system catalog. It produces an <literal>INSERT</> statement |
| 78 | + per each tuple of the <literal>pg_statistic</>, excluding |
| 79 | + the ones that contain statistical data for tables in |
| 80 | + <literal>information_schema</> and <literal>pg_catalog</> |
| 81 | + schemas. |
| 82 | + </para> |
| 83 | + </listitem> |
| 84 | + </varlistentry> |
| 85 | + |
| 86 | + <varlistentry> |
| 87 | + <term> |
| 88 | + <function>to_schema_qualified_operator(opid oid) returns text</function> |
| 89 | + <indexterm> |
| 90 | + <primary>to_schema_qualified_operator</primary> |
| 91 | + </indexterm> |
| 92 | + </term> |
| 93 | + |
| 94 | + <listitem> |
| 95 | + <para> |
| 96 | + Fetches the schema-qualified operator name by operator id. |
| 97 | + </para> |
| 98 | + </listitem> |
| 99 | + </varlistentry> |
| 100 | + |
| 101 | + <varlistentry> |
| 102 | + <term> |
| 103 | + <function>to_schema_qualified_type(opid oid) returns text</function> |
| 104 | + <indexterm> |
| 105 | + <primary>to_schema_qualified_type</primary> |
| 106 | + </indexterm> |
| 107 | + </term> |
| 108 | + |
| 109 | + <listitem> |
| 110 | + <para> |
| 111 | + Fetches the schema-qualified type name by type id. |
| 112 | + </para> |
| 113 | + </listitem> |
| 114 | + </varlistentry> |
| 115 | + |
| 116 | + <varlistentry> |
| 117 | + <term> |
| 118 | + <function>to_schema_qualified_relation(opid oid) returns text</function> |
| 119 | + <indexterm> |
| 120 | + <primary>to_schema_qualified_relation</primary> |
| 121 | + </indexterm> |
| 122 | + </term> |
| 123 | + |
| 124 | + <listitem> |
| 125 | + <para> |
| 126 | + Fetches the schema-qualified relation name by relation id. |
| 127 | + </para> |
| 128 | + </listitem> |
| 129 | + </varlistentry> |
| 130 | + |
| 131 | + <varlistentry> |
| 132 | + <term> |
| 133 | + <function>anyarray_elemtype(arr anyarray) returns oid</function> |
| 134 | + <indexterm> |
| 135 | + <primary>anyarray_elemtype</primary> |
| 136 | + </indexterm> |
| 137 | + </term> |
| 138 | + |
| 139 | + <listitem> |
| 140 | + <para> |
| 141 | + Returns the element type of the given array as oid. |
| 142 | + </para> |
| 143 | + </listitem> |
| 144 | + </varlistentry> |
| 145 | + |
| 146 | + <varlistentry> |
| 147 | + <term> |
| 148 | + <function>to_attname(relation text, colnum int2) returns text</function> |
| 149 | + <indexterm> |
| 150 | + <primary>to_attname</primary> |
| 151 | + </indexterm> |
| 152 | + </term> |
| 153 | + |
| 154 | + <listitem> |
| 155 | + <para> |
| 156 | + Given a relation name and a column number, returns the column name as text. |
| 157 | + </para> |
| 158 | + </listitem> |
| 159 | + </varlistentry> |
| 160 | + |
| 161 | + <varlistentry> |
| 162 | + <term> |
| 163 | + <function>to_attnum(relation text, col text) returns int2</function> |
| 164 | + <indexterm> |
| 165 | + <primary>to_attnum</primary> |
| 166 | + </indexterm> |
| 167 | + </term> |
| 168 | + |
| 169 | + <listitem> |
| 170 | + <para> |
| 171 | + Given a relation name and a column name, returns the column number as int2. |
| 172 | + </para> |
| 173 | + </listitem> |
| 174 | + </varlistentry> |
| 175 | + |
| 176 | + <varlistentry> |
| 177 | + <term> |
| 178 | + <function>to_atttype(relation text, col text) returns text</function> |
| 179 | + <indexterm> |
| 180 | + <primary>to_atttype</primary> |
| 181 | + </indexterm> |
| 182 | + </term> |
| 183 | + |
| 184 | + <listitem> |
| 185 | + <para> |
| 186 | + Given a relation name and a column name, returns the column type as text. |
| 187 | + </para> |
| 188 | + </listitem> |
| 189 | + </varlistentry> |
| 190 | + |
| 191 | + <varlistentry> |
| 192 | + <term> |
| 193 | + <function>to_namespace(nsp text) returns oid</function> |
| 194 | + <indexterm> |
| 195 | + <primary>to_namespace</primary> |
| 196 | + </indexterm> |
| 197 | + </term> |
| 198 | + |
| 199 | + <listitem> |
| 200 | + <para> |
| 201 | + <function>to_namespace</function> duplicates the behavior of |
| 202 | + the cast to <literal>regnamespace</> type, which is not |
| 203 | + present in the 9.4 release (and prior releases). This |
| 204 | + function returns the oid of the given namespace. |
| 205 | + </para> |
| 206 | + </listitem> |
| 207 | + </varlistentry> |
| 208 | + |
| 209 | + <varlistentry> |
| 210 | + <term> |
| 211 | + <function>get_namespace(relation oid) returns oid</function> |
| 212 | + <indexterm> |
| 213 | + <primary>get_namespace</primary> |
| 214 | + </indexterm> |
| 215 | + </term> |
| 216 | + |
| 217 | + <listitem> |
| 218 | + <para> |
| 219 | + <function>get_namespace</function> returns the namespace |
| 220 | + of the given relation as oid. |
| 221 | + </para> |
| 222 | + </listitem> |
| 223 | + </varlistentry> |
39 | 224 | </variablelist>
|
40 | 225 | </sect1>
|