Skip to content

Commit 40f4591

Browse files
committed
Add current documentation for PGPRO modules and some release notes
1 parent 0aca59d commit 40f4591

11 files changed

+2655
-0
lines changed

doc/src/sgml/contrib.sgml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,30 +114,37 @@ CREATE EXTENSION <replaceable>module_name</> FROM unpackaged;
114114
&dblink;
115115
&dict-int;
116116
&dict-xsyn;
117+
&dump_stat;
117118
&earthdistance;
118119
&file-fdw;
119120
&fuzzystrmatch;
120121
&hstore;
122+
&hunspell-dict;
121123
&intagg;
122124
&intarray;
123125
&isn;
126+
&jsquery;
124127
&lo;
125128
&ltree;
126129
&pageinspect;
127130
&passwordcheck;
128131
&pgbuffercache;
129132
&pgcrypto;
130133
&pgfreespacemap;
134+
&pgpathman;
131135
&pgprewarm;
132136
&pgrowlocks;
133137
&pgstatstatements;
134138
&pgstattuple;
135139
&pgtrgm;
140+
&pgvariables;
136141
&pgvisibility;
137142
&postgres-fdw;
138143
&seg;
139144
&sepgsql;
145+
&shared-ispell;
140146
&contrib-spi;
147+
&sr-plan;
141148
&sslinfo;
142149
&tablefunc;
143150
&tcn;

doc/src/sgml/dump-stat.sgml

Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
<!-- doc/src/sgml/dump_stat.sgml -->
2+
3+
<sect1 id="dump-stat" xreflabel="dump-stat">
4+
<title>dump_stat</title>
5+
6+
<indexterm zone="dump-stat">
7+
<primary>dump_stat</primary>
8+
</indexterm>
9+
10+
<para>
11+
The <filename>dump_stat</> module provides functions that allow you to
12+
backup and recover the contents of the
13+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
14+
table. The <function>dump_statistic</> function generates <literal>INSERT</>
15+
statements which can later be applied to a compatible database. The extension
16+
should be installed on the recipient server in order to successfuly restore
17+
statistical data since these statements heavily rely on the provided functions.
18+
</para>
19+
20+
<para>
21+
Note that the definition of the
22+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
23+
table might change occasionally, which means that generated dump might be incompatible
24+
with future releases of <productname>PostgreSQL</productname>.
25+
</para>
26+
27+
<sect2>
28+
<title>Functions</title>
29+
30+
<variablelist>
31+
<varlistentry>
32+
<term>
33+
<function>dump_statistic() returns setof text</function>
34+
<indexterm>
35+
<primary>dump_statistic</primary>
36+
</indexterm>
37+
</term>
38+
39+
<listitem>
40+
<para>
41+
<function>dump_statistic</function> dumps the contents of the
42+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
43+
system catalog. It produces an <literal>INSERT</> statement
44+
per each tuple of the
45+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>,
46+
excluding the ones that contain statistical data for tables in the
47+
<literal>information_schema</> and <literal>pg_catalog</> schemas.
48+
</para>
49+
50+
<para>
51+
The <literal>INSERT</> statement takes form of
52+
<screen>
53+
WITH upsert as (
54+
UPDATE pg_catalog.pg_statistic SET <replaceable class="PARAMETER">column_name</> = <replaceable class="PARAMETER">expression</> [, ...]
55+
WHERE to_schema_qualified_relation(starelid) = <replaceable class="PARAMETER">t_relname</>
56+
AND to_attname(<replaceable class="PARAMETER">t_relname</>, staattnum) = <replaceable class="PARAMETER">t_attname</>
57+
AND to_atttype(<replaceable class="PARAMETER">t_relname</>, staattnum) = <replaceable class="PARAMETER">t_atttype</>
58+
AND stainherit = <replaceable class="PARAMETER">t_stainherit</>
59+
RETURNING *)
60+
ins as (
61+
SELECT <replaceable class="PARAMETER">expression</> [, ...]
62+
WHERE NOT EXISTS (SELECT * FROM upsert)
63+
AND to_attnum(<replaceable class="PARAMETER">t_relname</>, <replaceable class="PARAMETER">t_attname</>) IS NOT NULL
64+
AND to_atttype(<replaceable class="PARAMETER">t_relname</>, <replaceable class="PARAMETER">t_attname</>) = <replaceable class="PARAMETER">t_atttype</>)
65+
INSERT INTO pg_catalog.pg_statistic SELECT * FROM ins;
66+
67+
where <replaceable class="PARAMETER">expression</> can be one of:
68+
69+
array_in(<replaceable class="PARAMETER">array_text</>, <replaceable class="PARAMETER">type_name</>::regtype::oid, -1)
70+
<replaceable class="PARAMETER">value</>::<replaceable class="PARAMETER">type_name</>
71+
</screen>
72+
</para>
73+
74+
<para>
75+
Produced statements could be saved to a file, e.g.
76+
<screen>
77+
&dollar; psql test -A
78+
test=# \t
79+
test=# \o dump_stat.sql
80+
test=# select dump_statistic();
81+
</screen>
82+
</para>
83+
</listitem>
84+
</varlistentry>
85+
86+
<varlistentry>
87+
<term>
88+
<function>dump_statistic(schema_name text) returns setof text</function>
89+
</term>
90+
91+
<listitem>
92+
<para>
93+
<function>dump_statistic</function> dumps the contents of the
94+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
95+
system catalog. It produces an <literal>INSERT</> statement
96+
per each tuple of the
97+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
98+
that relates to some table in the <literal>schema_name</> schema.
99+
</para>
100+
</listitem>
101+
</varlistentry>
102+
103+
<varlistentry>
104+
<term>
105+
<function>dump_statistic(schema_name text, table_name text) returns setof text</function>
106+
</term>
107+
108+
<listitem>
109+
<para>
110+
<function>dump_statistic</function> dumps the contents of the
111+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
112+
system catalog. It produces an <literal>INSERT</> statement
113+
per each tuple of the
114+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
115+
that relates to the specified <literal>schema_name.table_name</> table.
116+
</para>
117+
</listitem>
118+
</varlistentry>
119+
120+
<varlistentry>
121+
<term>
122+
<function>dump_statistic(relid oid) returns setof text</function>
123+
</term>
124+
125+
<listitem>
126+
<para>
127+
<function>dump_statistic</function> dumps the contents of the
128+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
129+
system catalog. It produces an <literal>INSERT</> statement
130+
per each tuple of the
131+
<link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
132+
that contains statistical data for the relation referenced by <literal>relid</>.
133+
</para>
134+
</listitem>
135+
</varlistentry>
136+
137+
<varlistentry>
138+
<term>
139+
<function>to_schema_qualified_operator(opid oid) returns text</function>
140+
<indexterm>
141+
<primary>to_schema_qualified_operator</primary>
142+
</indexterm>
143+
</term>
144+
145+
<listitem>
146+
<para>
147+
Fetches the schema-qualified operator name by operator id <literal>opid</>. For example:
148+
</para>
149+
<screen>
150+
test=# SELECT to_schema_qualified_operator('+(int,int)'::regoperator);
151+
to_schema_qualified_operator
152+
------------------------------------------------
153+
pg_catalog.+(pg_catalog.int4, pg_catalog.int4)
154+
(1 row)
155+
</screen>
156+
</listitem>
157+
</varlistentry>
158+
159+
<varlistentry>
160+
<term>
161+
<function>to_schema_qualified_type(typid oid) returns text</function>
162+
<indexterm>
163+
<primary>to_schema_qualified_type</primary>
164+
</indexterm>
165+
</term>
166+
167+
<listitem>
168+
<para>
169+
Fetches the schema-qualified type name by type id <literal>typid</>.
170+
</para>
171+
</listitem>
172+
</varlistentry>
173+
174+
<varlistentry>
175+
<term>
176+
<function>to_schema_qualified_relation(relid oid) returns text</function>
177+
<indexterm>
178+
<primary>to_schema_qualified_relation</primary>
179+
</indexterm>
180+
</term>
181+
182+
<listitem>
183+
<para>
184+
Fetches the schema-qualified relation name by relation id <literal>relid</>.
185+
</para>
186+
</listitem>
187+
</varlistentry>
188+
189+
<varlistentry>
190+
<term>
191+
<function>anyarray_elemtype(arr anyarray) returns oid</function>
192+
<indexterm>
193+
<primary>anyarray_elemtype</primary>
194+
</indexterm>
195+
</term>
196+
197+
<listitem>
198+
<para>
199+
Returns the element type of the given array as <literal>oid</>. For example:
200+
</para>
201+
<screen>
202+
test=# SELECT anyarray_elemtype(array_in('{1,2,3}', 'int'::regtype, -1));
203+
anyarray_elemtype
204+
-------------------
205+
23
206+
(1 row)
207+
</screen>
208+
</listitem>
209+
</varlistentry>
210+
211+
<varlistentry>
212+
<term>
213+
<function>to_attname(relation text, colnum int2) returns text</function>
214+
<indexterm>
215+
<primary>to_attname</primary>
216+
</indexterm>
217+
</term>
218+
219+
<listitem>
220+
<para>
221+
Given a relation name <literal>relation</> and a column number
222+
<literal>colnum</>, returns the column name as <literal>text</>.
223+
</para>
224+
</listitem>
225+
</varlistentry>
226+
227+
<varlistentry>
228+
<term>
229+
<function>to_attnum(relation text, col text) returns int2</function>
230+
<indexterm>
231+
<primary>to_attnum</primary>
232+
</indexterm>
233+
</term>
234+
235+
<listitem>
236+
<para>
237+
Given a relation name <literal>relation</> and a column name
238+
<literal>col</>, returns the column number as <literal>int2</>.
239+
</para>
240+
</listitem>
241+
</varlistentry>
242+
243+
<varlistentry>
244+
<term>
245+
<function>to_atttype(relation text, col text) returns text</function>
246+
<indexterm>
247+
<primary>to_atttype</primary>
248+
</indexterm>
249+
</term>
250+
251+
<listitem>
252+
<para>
253+
Given a relation name <literal>relation</> and a column name
254+
<literal>col</>, returns the schema-qualified column type as <literal>text</>.
255+
</para>
256+
</listitem>
257+
</varlistentry>
258+
259+
<varlistentry>
260+
<term>
261+
<function>to_atttype(relation text, colnum int2) returns text</function>
262+
</term>
263+
264+
<listitem>
265+
<para>
266+
Given a relation name <literal>relation</> and a column number
267+
<literal>colnum</>, returns the schema-qualified column type as <literal>text</>.
268+
</para>
269+
</listitem>
270+
</varlistentry>
271+
272+
<varlistentry>
273+
<term>
274+
<function>to_namespace(nsp text) returns oid</function>
275+
<indexterm>
276+
<primary>to_namespace</primary>
277+
</indexterm>
278+
</term>
279+
280+
<listitem>
281+
<para>
282+
<function>to_namespace</function> duplicates the behavior of
283+
the cast to the
284+
<link linkend="datatype-oid"><structname>regnamespace</structname></link>
285+
type, which is not present in the
286+
<productname>PostgreSQL</productname> 9.4 release (and prior releases).
287+
This function returns the <literal>oid</> of the given schema.
288+
</para>
289+
</listitem>
290+
</varlistentry>
291+
292+
<varlistentry>
293+
<term>
294+
<function>get_namespace(relation oid) returns oid</function>
295+
<indexterm>
296+
<primary>get_namespace</primary>
297+
</indexterm>
298+
</term>
299+
300+
<listitem>
301+
<para>
302+
<function>get_namespace</function> returns the schema
303+
of the given relation as <literal>oid</>.
304+
</para>
305+
</listitem>
306+
</varlistentry>
307+
</variablelist>
308+
</sect2>
309+
</sect1>

doc/src/sgml/filelist.sgml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,17 @@
117117
<!ENTITY dblink SYSTEM "dblink.sgml">
118118
<!ENTITY dict-int SYSTEM "dict-int.sgml">
119119
<!ENTITY dict-xsyn SYSTEM "dict-xsyn.sgml">
120+
<!ENTITY dump-stat SYSTEM "dump-stat.sgml">
120121
<!ENTITY dummy-seclabel SYSTEM "dummy-seclabel.sgml">
121122
<!ENTITY earthdistance SYSTEM "earthdistance.sgml">
122123
<!ENTITY file-fdw SYSTEM "file-fdw.sgml">
123124
<!ENTITY fuzzystrmatch SYSTEM "fuzzystrmatch.sgml">
124125
<!ENTITY hstore SYSTEM "hstore.sgml">
126+
<!ENTITY hunspell-dict SYSTEM "hunspell-dict.sgml">
125127
<!ENTITY intagg SYSTEM "intagg.sgml">
126128
<!ENTITY intarray SYSTEM "intarray.sgml">
127129
<!ENTITY isn SYSTEM "isn.sgml">
130+
<!ENTITY jsquery SYSTEM "jsquery.sgml">
128131
<!ENTITY lo SYSTEM "lo.sgml">
129132
<!ENTITY ltree SYSTEM "ltree.sgml">
130133
<!ENTITY oid2name SYSTEM "oid2name.sgml">
@@ -133,18 +136,22 @@
133136
<!ENTITY pgbuffercache SYSTEM "pgbuffercache.sgml">
134137
<!ENTITY pgcrypto SYSTEM "pgcrypto.sgml">
135138
<!ENTITY pgfreespacemap SYSTEM "pgfreespacemap.sgml">
139+
<!ENTITY pgpathman SYSTEM "pgpathman.sgml">
136140
<!ENTITY pgprewarm SYSTEM "pgprewarm.sgml">
137141
<!ENTITY pgrowlocks SYSTEM "pgrowlocks.sgml">
138142
<!ENTITY pgstandby SYSTEM "pgstandby.sgml">
139143
<!ENTITY pgstatstatements SYSTEM "pgstatstatements.sgml">
140144
<!ENTITY pgstattuple SYSTEM "pgstattuple.sgml">
141145
<!ENTITY pgtrgm SYSTEM "pgtrgm.sgml">
146+
<!ENTITY pgvariables SYSTEM "pg_variables.sgml">
142147
<!ENTITY pgvisibility SYSTEM "pgvisibility.sgml">
143148
<!ENTITY postgres-fdw SYSTEM "postgres-fdw.sgml">
144149
<!ENTITY seg SYSTEM "seg.sgml">
145150
<!ENTITY contrib-spi SYSTEM "contrib-spi.sgml">
146151
<!ENTITY sepgsql SYSTEM "sepgsql.sgml">
152+
<!ENTITY shared-ispell SYSTEM "shared-ispell.sgml">
147153
<!ENTITY sslinfo SYSTEM "sslinfo.sgml">
154+
<!ENTITY sr-plan SYSTEM "sr_plan.sgml">
148155
<!ENTITY tablefunc SYSTEM "tablefunc.sgml">
149156
<!ENTITY tcn SYSTEM "tcn.sgml">
150157
<!ENTITY test-decoding SYSTEM "test-decoding.sgml">
@@ -168,6 +175,7 @@
168175
<!ENTITY sourcerepo SYSTEM "sourcerepo.sgml">
169176

170177
<!ENTITY release SYSTEM "release.sgml">
178+
<!ENTITY release-pro-9.6 SYSTEM "release-pro-9.6.sgml">
171179
<!ENTITY release-9.6 SYSTEM "release-9.6.sgml">
172180
<!ENTITY release-9.5 SYSTEM "release-9.5.sgml">
173181
<!ENTITY release-9.4 SYSTEM "release-9.4.sgml">

0 commit comments

Comments
 (0)