OSDN Git Service

Make environment for 1.3.5
[pgdbmsstats/pg_dbms_stats.git] / output / ut_imp_exp-9.4.source
1 \pset null '(null)'
2 CREATE TABLE s0.st3();
3 /*
4  * No.16-1 export_plain_stats-9.3.sql.sample
5  */
6 -- No.16-1-1
7 ANALYZE;
8 DELETE FROM dbms_stats._column_stats_locked;
9 DELETE FROM dbms_stats._relation_stats_locked;
10 SELECT dbms_stats.lock_database_stats();
11  lock_database_stats 
12 ---------------------
13  pt0
14  pt0_idx
15  st0
16  st0_idx
17  st1
18  s0.st0
19  s0.st0_idx
20  s0.st1
21  s0.st1_idx
22  s0.st2
23  s0.st2_idx
24  st1_idx
25  st1_exp
26  s0.sft0
27  s0.smv0
28  s1.st0
29  s0.st3
30 (17 rows)
31
32 UPDATE dbms_stats._relation_stats_locked
33    SET (relpages, reltuples, relallvisible, curpages) = (0,0,0,0);
34 UPDATE dbms_stats._column_stats_locked SET
35     stanullfrac = -staattnum,
36     stawidth = -staattnum,
37     stadistinct = -staattnum,
38     stakind1 = 2,
39     stakind2 = 3,
40     stakind3 = 4,
41     stakind4 = 1,
42     stakind5 = 5,
43     staop1 = 22,
44     staop2 = 23,
45     staop3 = 24,
46     staop4 = 21,
47     staop5 = 25,
48     stanumbers1 = ARRAY[-staattnum,22],
49     stanumbers2 = ARRAY[-staattnum,23],
50     stanumbers3 = ARRAY[-staattnum,24],
51     stanumbers4 = ARRAY[-staattnum,21],
52     stanumbers5 = ARRAY[-staattnum,25],
53     stavalues1 = stavalues3,
54     stavalues2 = stavalues2,
55     stavalues3 = stavalues1,
56     stavalues4 = stavalues4,
57     stavalues5 = stavalues5;
58 \i doc/export_plain_stats-9.3.sql.sample
59 /*
60  * If you want the statistics of per-relation or per-column, please modify
61  * nspname, relname, and attname in 'WHERE' clause.
62  */
63 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
64 /*
65  * If you want to chage the output file name, please modify the following name.
66  */
67 \o export_stats.dmp
68 COPY (SELECT n2.nspname,
69              c.relname,
70              c.relpages,
71              c.reltuples,
72              c.relallvisible,
73              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
74                  AS curpages,
75              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
76                  AS last_analyze,
77              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
78                  AS last_autoanalyze,
79              COALESCE(a.attname, ''),
80              n1.nspname AS schemaname_of_atttype,
81              t.typname,
82              a.atttypmod,
83              s.stainherit,
84              s.stanullfrac,
85              s.stawidth,
86              s.stadistinct,
87              s.stakind1,
88              s.stakind2,
89              s.stakind3,
90              s.stakind4,
91              s.stakind5,
92              s.staop1,
93              s.staop2,
94              s.staop3,
95              s.staop4,
96              s.staop5,
97              s.stanumbers1,
98              s.stanumbers2,
99              s.stanumbers3,
100              s.stanumbers4,
101              s.stanumbers5,
102              s.stavalues1,
103              s.stavalues2,
104              s.stavalues3,
105              s.stavalues4,
106              s.stavalues5
107         FROM pg_statistic s
108         JOIN pg_attribute a
109           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
110         JOIN pg_type t
111           ON a.atttypid = t.oid
112         JOIN pg_namespace n1
113           ON t.typnamespace = n1.oid
114        RIGHT JOIN pg_catalog.pg_class c
115           ON s.starelid = c.oid
116         JOIN pg_catalog.pg_namespace n2
117           ON c.relnamespace = n2.oid
118        WHERE c.relkind IN ('r', 'i', 'f', 'm')
119          AND NOT n2.nspname IN ('pg_catalog',
120                                 'pg_toast',
121                                 'information_schema',
122                                 'dbms_stats')
123         -- AND n2.nspname = 'public'
124         -- AND c.relname = 'test'
125         -- AND a.attname = 'id'
126        ORDER BY starelid, staattnum)
127 TO STDOUT
128 (FORMAT 'binary');
129 \o
130 COMMIT;
131 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
132 SELECT * FROM work_v;
133  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 |      stanumbers1       | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |       stavalues1       | stavalues2 | stavalues3 | stavalues4 | stavalues5 
134 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+------------------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------
135  public  | pt0     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
136  public  | pt0_idx |        2 |         0 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
137  public  | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
138  public  | st0     |        1 |         2 |             1 |        1 | name    | pg_catalog          | bpchar  |         9 | f          |           0 |        6 |        -0.5 |        1 |        3 |        0 |        0 |        0 |   1054 |   1058 |      0 |      0 |      0 | {1}                    | {1}         | (null)      | (null)      | (null)      | {"test "}              | (null)     | (null)     | (null)     | (null)
139  public  | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
140  public  | st1     |       45 |     10000 |            45 |       45 | str     | pg_catalog          | text    |        -1 | f          |           0 |        2 |           3 |        1 |        3 |        0 |        0 |        0 |     98 |    664 |      0 |      0 |      0 | {0.3334,0.3333,0.3333} | {0.3332}    | (null)      | (null)      | (null)      | {1,0,2}                | (null)     | (null)     | (null)     | (null)
141  public  | st1     |       45 |     10000 |            45 |       45 | val     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |           3 |        1 |        3 |        0 |        0 |        0 |     96 |     97 |      0 |      0 |      0 | {0.3334,0.3333,0.3333} | {0.3332}    | (null)      | (null)      | (null)      | {1,0,2}                | (null)     | (null)     | (null)     | (null)
142  public  | st1_exp |       30 |     10000 |             0 |       30 | lower   | pg_catalog          | text    |        -1 | f          |           0 |        5 |           3 |        1 |        3 |        0 |        0 |        0 |     98 |    664 |      0 |      0 |      0 | {0.3334,0.3333,0.3333} | {0.3332}    | (null)      | (null)      | (null)      | {1,0,2}                | (null)     | (null)     | (null)     | (null)
143  public  | st1_idx |       30 |     10000 |             0 |       30 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
144  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)     | (null)     | (null)
145  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
146  s0      | smv0    |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {10,20}                | (null)     | (null)     | (null)     | (null)
147  s0      | smv0    |        1 |         2 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |           0 |        3 |          -1 |        2 |        3 |        0 |        0 |        0 |    664 |    664 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,test}               | (null)     | (null)     | (null)     | (null)
148  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
149  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}            | (null)     | (null)     | (null)     | (null)
150  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {10,20}                | (null)     | (null)     | (null)     | (null)
151  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {10,20,40,50,60}       | (null)     | (null)     | (null)     | (null)
152  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
153  s0      | st1     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {4,5,6}                | (null)     | (null)     | (null)     | (null)
154  s0      | st1     |        1 |         3 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {40,50,60}             | (null)     | (null)     | (null)     | (null)
155  s0      | st1_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
156  s0      | st2     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2,3}                | (null)     | (null)     | (null)     | (null)
157  s0      | st2     |        1 |         3 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |           0 |        5 |          -1 |        2 |        3 |        0 |        0 |        0 |    664 |    664 |      0 |      0 |      0 | (null)                 | {0.5}       | (null)      | (null)      | (null)      | {1,comment,test}       | (null)     | (null)     | (null)     | (null)
158  s0      | st2_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
159  s0      | st3     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)                 | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
160  s1      | st0     |        1 |         4 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {1,2,3,4}              | (null)     | (null)     | (null)     | (null)
161  s1      | st0     |        1 |         4 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)                 | {1}         | (null)      | (null)      | (null)      | {15,25,35,45}          | (null)     | (null)     | (null)     | (null)
162 (27 rows)
163
164 TRUNCATE dbms_stats.work;
165 -- No.16-1-2
166 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
167 \i doc/export_plain_stats-9.3.sql.sample_test
168 /*
169  * If you want the statistics of per-relation or per-column, please modify
170  * nspname, relname, and attname in 'WHERE' clause.
171  */
172 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
173 /*
174  * If you want to chage the output file name, please modify the following name.
175  */
176 \o export_stats.dmp
177 COPY (SELECT n2.nspname,
178              c.relname,
179              c.relpages,
180              c.reltuples,
181              c.relallvisible,
182              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
183                  AS curpages,
184              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
185                  AS last_analyze,
186              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
187                  AS last_autoanalyze,
188              COALESCE(a.attname, ''),
189              n1.nspname AS schemaname_of_atttype,
190              t.typname,
191              a.atttypmod,
192              s.stainherit,
193              s.stanullfrac,
194              s.stawidth,
195              s.stadistinct,
196              s.stakind1,
197              s.stakind2,
198              s.stakind3,
199              s.stakind4,
200              s.stakind5,
201              s.staop1,
202              s.staop2,
203              s.staop3,
204              s.staop4,
205              s.staop5,
206              s.stanumbers1,
207              s.stanumbers2,
208              s.stanumbers3,
209              s.stanumbers4,
210              s.stanumbers5,
211              s.stavalues1,
212              s.stavalues2,
213              s.stavalues3,
214              s.stavalues4,
215              s.stavalues5
216         FROM pg_statistic s
217         JOIN pg_attribute a
218           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
219         JOIN pg_type t
220           ON a.atttypid = t.oid
221         JOIN pg_namespace n1
222           ON t.typnamespace = n1.oid
223        RIGHT JOIN pg_catalog.pg_class c
224           ON s.starelid = c.oid
225         JOIN pg_catalog.pg_namespace n2
226           ON c.relnamespace = n2.oid
227        WHERE c.relkind IN ('r', 'i', 'f', 'm')
228          AND NOT n2.nspname IN ('pg_catalog',
229                                 'pg_toast',
230                                 'information_schema',
231                                 'dbms_stats')
232         -- AND n2.nspname = 'public'
233         -- AND c.relname = 'test'
234         -- AND a.attname = 'id'
235  AND n2.nspname = 's0'
236        ORDER BY starelid, staattnum)
237 TO STDOUT
238 (FORMAT 'binary');
239 \o
240 COMMIT;
241 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
242 SELECT * FROM work_v;
243  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |       stavalues1       | stavalues2 | stavalues3 | stavalues4 | stavalues5 
244 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------
245  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)     | (null)     | (null)
246  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
247  s0      | smv0    |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}                | (null)     | (null)     | (null)     | (null)
248  s0      | smv0    |        1 |         2 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |           0 |        3 |          -1 |        2 |        3 |        0 |        0 |        0 |    664 |    664 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,test}               | (null)     | (null)     | (null)     | (null)
249  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
250  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}            | (null)     | (null)     | (null)     | (null)
251  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}                | (null)     | (null)     | (null)     | (null)
252  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20,40,50,60}       | (null)     | (null)     | (null)     | (null)
253  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
254  s0      | st1     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {4,5,6}                | (null)     | (null)     | (null)     | (null)
255  s0      | st1     |        1 |         3 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {40,50,60}             | (null)     | (null)     | (null)     | (null)
256  s0      | st1_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
257  s0      | st2     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,3}                | (null)     | (null)     | (null)     | (null)
258  s0      | st2     |        1 |         3 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |           0 |        5 |          -1 |        2 |        3 |        0 |        0 |        0 |    664 |    664 |      0 |      0 |      0 | (null)      | {0.5}       | (null)      | (null)      | (null)      | {1,comment,test}       | (null)     | (null)     | (null)     | (null)
259  s0      | st2_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
260  s0      | st3     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)                 | (null)     | (null)     | (null)     | (null)
261 (16 rows)
262
263 TRUNCATE dbms_stats.work;
264 \! rm doc/export_plain_stats-9.3.sql.sample_test
265 -- No.16-1-3
266 \! sed '/ORDER/i\\ AND c.relname = '"\'st0\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
267 \i doc/export_plain_stats-9.3.sql.sample_test
268 /*
269  * If you want the statistics of per-relation or per-column, please modify
270  * nspname, relname, and attname in 'WHERE' clause.
271  */
272 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
273 /*
274  * If you want to chage the output file name, please modify the following name.
275  */
276 \o export_stats.dmp
277 COPY (SELECT n2.nspname,
278              c.relname,
279              c.relpages,
280              c.reltuples,
281              c.relallvisible,
282              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
283                  AS curpages,
284              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
285                  AS last_analyze,
286              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
287                  AS last_autoanalyze,
288              COALESCE(a.attname, ''),
289              n1.nspname AS schemaname_of_atttype,
290              t.typname,
291              a.atttypmod,
292              s.stainherit,
293              s.stanullfrac,
294              s.stawidth,
295              s.stadistinct,
296              s.stakind1,
297              s.stakind2,
298              s.stakind3,
299              s.stakind4,
300              s.stakind5,
301              s.staop1,
302              s.staop2,
303              s.staop3,
304              s.staop4,
305              s.staop5,
306              s.stanumbers1,
307              s.stanumbers2,
308              s.stanumbers3,
309              s.stanumbers4,
310              s.stanumbers5,
311              s.stavalues1,
312              s.stavalues2,
313              s.stavalues3,
314              s.stavalues4,
315              s.stavalues5
316         FROM pg_statistic s
317         JOIN pg_attribute a
318           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
319         JOIN pg_type t
320           ON a.atttypid = t.oid
321         JOIN pg_namespace n1
322           ON t.typnamespace = n1.oid
323        RIGHT JOIN pg_catalog.pg_class c
324           ON s.starelid = c.oid
325         JOIN pg_catalog.pg_namespace n2
326           ON c.relnamespace = n2.oid
327        WHERE c.relkind IN ('r', 'i', 'f', 'm')
328          AND NOT n2.nspname IN ('pg_catalog',
329                                 'pg_toast',
330                                 'information_schema',
331                                 'dbms_stats')
332         -- AND n2.nspname = 'public'
333         -- AND c.relname = 'test'
334         -- AND a.attname = 'id'
335  AND c.relname = 'st0'
336        ORDER BY starelid, staattnum)
337 TO STDOUT
338 (FORMAT 'binary');
339 \o
340 COMMIT;
341 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
342 SELECT * FROM work_v;
343  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |    stavalues1    | stavalues2 | stavalues3 | stavalues4 | stavalues5 
344 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------+------------+------------
345  public  | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}            | (null)     | (null)     | (null)     | (null)
346  public  | st0     |        1 |         2 |             1 |        1 | name    | pg_catalog          | bpchar  |         9 | f          |           0 |        6 |        -0.5 |        1 |        3 |        0 |        0 |        0 |   1054 |   1058 |      0 |      0 |      0 | {1}         | {1}         | (null)      | (null)      | (null)      | {"test "}        | (null)     | (null)     | (null)     | (null)
347  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}            | (null)     | (null)     | (null)     | (null)
348  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}      | (null)     | (null)     | (null)     | (null)
349  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}          | (null)     | (null)     | (null)     | (null)
350  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20,40,50,60} | (null)     | (null)     | (null)     | (null)
351  s1      | st0     |        1 |         4 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,3,4}        | (null)     | (null)     | (null)     | (null)
352  s1      | st0     |        1 |         4 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {15,25,35,45}    | (null)     | (null)     | (null)     | (null)
353 (8 rows)
354
355 TRUNCATE dbms_stats.work;
356 \! rm doc/export_plain_stats-9.3.sql.sample_test
357 -- No.16-1-4
358 \! sed '/ORDER/i\\ AND c.relname = '"\'pg_toast_1262\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
359 \i doc/export_plain_stats-9.3.sql.sample_test
360 /*
361  * If you want the statistics of per-relation or per-column, please modify
362  * nspname, relname, and attname in 'WHERE' clause.
363  */
364 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
365 /*
366  * If you want to chage the output file name, please modify the following name.
367  */
368 \o export_stats.dmp
369 COPY (SELECT n2.nspname,
370              c.relname,
371              c.relpages,
372              c.reltuples,
373              c.relallvisible,
374              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
375                  AS curpages,
376              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
377                  AS last_analyze,
378              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
379                  AS last_autoanalyze,
380              COALESCE(a.attname, ''),
381              n1.nspname AS schemaname_of_atttype,
382              t.typname,
383              a.atttypmod,
384              s.stainherit,
385              s.stanullfrac,
386              s.stawidth,
387              s.stadistinct,
388              s.stakind1,
389              s.stakind2,
390              s.stakind3,
391              s.stakind4,
392              s.stakind5,
393              s.staop1,
394              s.staop2,
395              s.staop3,
396              s.staop4,
397              s.staop5,
398              s.stanumbers1,
399              s.stanumbers2,
400              s.stanumbers3,
401              s.stanumbers4,
402              s.stanumbers5,
403              s.stavalues1,
404              s.stavalues2,
405              s.stavalues3,
406              s.stavalues4,
407              s.stavalues5
408         FROM pg_statistic s
409         JOIN pg_attribute a
410           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
411         JOIN pg_type t
412           ON a.atttypid = t.oid
413         JOIN pg_namespace n1
414           ON t.typnamespace = n1.oid
415        RIGHT JOIN pg_catalog.pg_class c
416           ON s.starelid = c.oid
417         JOIN pg_catalog.pg_namespace n2
418           ON c.relnamespace = n2.oid
419        WHERE c.relkind IN ('r', 'i', 'f', 'm')
420          AND NOT n2.nspname IN ('pg_catalog',
421                                 'pg_toast',
422                                 'information_schema',
423                                 'dbms_stats')
424         -- AND n2.nspname = 'public'
425         -- AND c.relname = 'test'
426         -- AND a.attname = 'id'
427  AND c.relname = 'pg_toast_1262'
428        ORDER BY starelid, staattnum)
429 TO STDOUT
430 (FORMAT 'binary');
431 \o
432 COMMIT;
433 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
434 SELECT * FROM work_v;
435  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
436 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
437 (0 rows)
438
439 TRUNCATE dbms_stats.work;
440 \! rm doc/export_plain_stats-9.3.sql.sample_test
441 -- No.16-1-5
442 \! sed '/ORDER/i\\ AND c.relname = '"\'st0_idx\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
443 \i doc/export_plain_stats-9.3.sql.sample_test
444 /*
445  * If you want the statistics of per-relation or per-column, please modify
446  * nspname, relname, and attname in 'WHERE' clause.
447  */
448 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
449 /*
450  * If you want to chage the output file name, please modify the following name.
451  */
452 \o export_stats.dmp
453 COPY (SELECT n2.nspname,
454              c.relname,
455              c.relpages,
456              c.reltuples,
457              c.relallvisible,
458              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
459                  AS curpages,
460              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
461                  AS last_analyze,
462              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
463                  AS last_autoanalyze,
464              COALESCE(a.attname, ''),
465              n1.nspname AS schemaname_of_atttype,
466              t.typname,
467              a.atttypmod,
468              s.stainherit,
469              s.stanullfrac,
470              s.stawidth,
471              s.stadistinct,
472              s.stakind1,
473              s.stakind2,
474              s.stakind3,
475              s.stakind4,
476              s.stakind5,
477              s.staop1,
478              s.staop2,
479              s.staop3,
480              s.staop4,
481              s.staop5,
482              s.stanumbers1,
483              s.stanumbers2,
484              s.stanumbers3,
485              s.stanumbers4,
486              s.stanumbers5,
487              s.stavalues1,
488              s.stavalues2,
489              s.stavalues3,
490              s.stavalues4,
491              s.stavalues5
492         FROM pg_statistic s
493         JOIN pg_attribute a
494           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
495         JOIN pg_type t
496           ON a.atttypid = t.oid
497         JOIN pg_namespace n1
498           ON t.typnamespace = n1.oid
499        RIGHT JOIN pg_catalog.pg_class c
500           ON s.starelid = c.oid
501         JOIN pg_catalog.pg_namespace n2
502           ON c.relnamespace = n2.oid
503        WHERE c.relkind IN ('r', 'i', 'f', 'm')
504          AND NOT n2.nspname IN ('pg_catalog',
505                                 'pg_toast',
506                                 'information_schema',
507                                 'dbms_stats')
508         -- AND n2.nspname = 'public'
509         -- AND c.relname = 'test'
510         -- AND a.attname = 'id'
511  AND c.relname = 'st0_idx'
512        ORDER BY starelid, staattnum)
513 TO STDOUT
514 (FORMAT 'binary');
515 \o
516 COMMIT;
517 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
518 SELECT * FROM work_v;
519  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
520 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
521  public  | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
522  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
523 (2 rows)
524
525 TRUNCATE dbms_stats.work;
526 \! rm doc/export_plain_stats-9.3.sql.sample_test
527 -- No.16-1-6
528 \! sed '/ORDER/i\\ AND c.relname = '"\'ss0\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
529 \i doc/export_plain_stats-9.3.sql.sample_test
530 /*
531  * If you want the statistics of per-relation or per-column, please modify
532  * nspname, relname, and attname in 'WHERE' clause.
533  */
534 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
535 /*
536  * If you want to chage the output file name, please modify the following name.
537  */
538 \o export_stats.dmp
539 COPY (SELECT n2.nspname,
540              c.relname,
541              c.relpages,
542              c.reltuples,
543              c.relallvisible,
544              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
545                  AS curpages,
546              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
547                  AS last_analyze,
548              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
549                  AS last_autoanalyze,
550              COALESCE(a.attname, ''),
551              n1.nspname AS schemaname_of_atttype,
552              t.typname,
553              a.atttypmod,
554              s.stainherit,
555              s.stanullfrac,
556              s.stawidth,
557              s.stadistinct,
558              s.stakind1,
559              s.stakind2,
560              s.stakind3,
561              s.stakind4,
562              s.stakind5,
563              s.staop1,
564              s.staop2,
565              s.staop3,
566              s.staop4,
567              s.staop5,
568              s.stanumbers1,
569              s.stanumbers2,
570              s.stanumbers3,
571              s.stanumbers4,
572              s.stanumbers5,
573              s.stavalues1,
574              s.stavalues2,
575              s.stavalues3,
576              s.stavalues4,
577              s.stavalues5
578         FROM pg_statistic s
579         JOIN pg_attribute a
580           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
581         JOIN pg_type t
582           ON a.atttypid = t.oid
583         JOIN pg_namespace n1
584           ON t.typnamespace = n1.oid
585        RIGHT JOIN pg_catalog.pg_class c
586           ON s.starelid = c.oid
587         JOIN pg_catalog.pg_namespace n2
588           ON c.relnamespace = n2.oid
589        WHERE c.relkind IN ('r', 'i', 'f', 'm')
590          AND NOT n2.nspname IN ('pg_catalog',
591                                 'pg_toast',
592                                 'information_schema',
593                                 'dbms_stats')
594         -- AND n2.nspname = 'public'
595         -- AND c.relname = 'test'
596         -- AND a.attname = 'id'
597  AND c.relname = 'ss0'
598        ORDER BY starelid, staattnum)
599 TO STDOUT
600 (FORMAT 'binary');
601 \o
602 COMMIT;
603 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
604 SELECT * FROM work_v;
605  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
606 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
607 (0 rows)
608
609 TRUNCATE dbms_stats.work;
610 \! rm doc/export_plain_stats-9.3.sql.sample_test
611 -- No.16-1-7
612 \! sed '/ORDER/i\\ AND c.relname = '"\'sc0\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
613 \i doc/export_plain_stats-9.3.sql.sample_test
614 /*
615  * If you want the statistics of per-relation or per-column, please modify
616  * nspname, relname, and attname in 'WHERE' clause.
617  */
618 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
619 /*
620  * If you want to chage the output file name, please modify the following name.
621  */
622 \o export_stats.dmp
623 COPY (SELECT n2.nspname,
624              c.relname,
625              c.relpages,
626              c.reltuples,
627              c.relallvisible,
628              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
629                  AS curpages,
630              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
631                  AS last_analyze,
632              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
633                  AS last_autoanalyze,
634              COALESCE(a.attname, ''),
635              n1.nspname AS schemaname_of_atttype,
636              t.typname,
637              a.atttypmod,
638              s.stainherit,
639              s.stanullfrac,
640              s.stawidth,
641              s.stadistinct,
642              s.stakind1,
643              s.stakind2,
644              s.stakind3,
645              s.stakind4,
646              s.stakind5,
647              s.staop1,
648              s.staop2,
649              s.staop3,
650              s.staop4,
651              s.staop5,
652              s.stanumbers1,
653              s.stanumbers2,
654              s.stanumbers3,
655              s.stanumbers4,
656              s.stanumbers5,
657              s.stavalues1,
658              s.stavalues2,
659              s.stavalues3,
660              s.stavalues4,
661              s.stavalues5
662         FROM pg_statistic s
663         JOIN pg_attribute a
664           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
665         JOIN pg_type t
666           ON a.atttypid = t.oid
667         JOIN pg_namespace n1
668           ON t.typnamespace = n1.oid
669        RIGHT JOIN pg_catalog.pg_class c
670           ON s.starelid = c.oid
671         JOIN pg_catalog.pg_namespace n2
672           ON c.relnamespace = n2.oid
673        WHERE c.relkind IN ('r', 'i', 'f', 'm')
674          AND NOT n2.nspname IN ('pg_catalog',
675                                 'pg_toast',
676                                 'information_schema',
677                                 'dbms_stats')
678         -- AND n2.nspname = 'public'
679         -- AND c.relname = 'test'
680         -- AND a.attname = 'id'
681  AND c.relname = 'sc0'
682        ORDER BY starelid, staattnum)
683 TO STDOUT
684 (FORMAT 'binary');
685 \o
686 COMMIT;
687 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
688 SELECT * FROM work_v;
689  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
690 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
691 (0 rows)
692
693 TRUNCATE dbms_stats.work;
694 \! rm doc/export_plain_stats-9.3.sql.sample_test
695 -- No.16-1-8
696 \! sed '/ORDER/i\\ AND c.relname = '"\'sft0\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
697 \i doc/export_plain_stats-9.3.sql.sample_test
698 /*
699  * If you want the statistics of per-relation or per-column, please modify
700  * nspname, relname, and attname in 'WHERE' clause.
701  */
702 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
703 /*
704  * If you want to chage the output file name, please modify the following name.
705  */
706 \o export_stats.dmp
707 COPY (SELECT n2.nspname,
708              c.relname,
709              c.relpages,
710              c.reltuples,
711              c.relallvisible,
712              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
713                  AS curpages,
714              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
715                  AS last_analyze,
716              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
717                  AS last_autoanalyze,
718              COALESCE(a.attname, ''),
719              n1.nspname AS schemaname_of_atttype,
720              t.typname,
721              a.atttypmod,
722              s.stainherit,
723              s.stanullfrac,
724              s.stawidth,
725              s.stadistinct,
726              s.stakind1,
727              s.stakind2,
728              s.stakind3,
729              s.stakind4,
730              s.stakind5,
731              s.staop1,
732              s.staop2,
733              s.staop3,
734              s.staop4,
735              s.staop5,
736              s.stanumbers1,
737              s.stanumbers2,
738              s.stanumbers3,
739              s.stanumbers4,
740              s.stanumbers5,
741              s.stavalues1,
742              s.stavalues2,
743              s.stavalues3,
744              s.stavalues4,
745              s.stavalues5
746         FROM pg_statistic s
747         JOIN pg_attribute a
748           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
749         JOIN pg_type t
750           ON a.atttypid = t.oid
751         JOIN pg_namespace n1
752           ON t.typnamespace = n1.oid
753        RIGHT JOIN pg_catalog.pg_class c
754           ON s.starelid = c.oid
755         JOIN pg_catalog.pg_namespace n2
756           ON c.relnamespace = n2.oid
757        WHERE c.relkind IN ('r', 'i', 'f', 'm')
758          AND NOT n2.nspname IN ('pg_catalog',
759                                 'pg_toast',
760                                 'information_schema',
761                                 'dbms_stats')
762         -- AND n2.nspname = 'public'
763         -- AND c.relname = 'test'
764         -- AND a.attname = 'id'
765  AND c.relname = 'sft0'
766        ORDER BY starelid, staattnum)
767 TO STDOUT
768 (FORMAT 'binary');
769 \o
770 COMMIT;
771 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
772 SELECT * FROM work_v;
773  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |       stavalues1       | stavalues2 | stavalues3 | stavalues4 | stavalues5 
774 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------
775  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)     | (null)     | (null)
776 (1 row)
777
778 TRUNCATE dbms_stats.work;
779 \! rm doc/export_plain_stats-9.3.sql.sample_test
780 -- No.16-1-9
781 \! sed '/ORDER/i\\ AND c.relname = '"\'smv0\'" doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
782 \i doc/export_plain_stats-9.3.sql.sample_test
783 /*
784  * If you want the statistics of per-relation or per-column, please modify
785  * nspname, relname, and attname in 'WHERE' clause.
786  */
787 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
788 /*
789  * If you want to chage the output file name, please modify the following name.
790  */
791 \o export_stats.dmp
792 COPY (SELECT n2.nspname,
793              c.relname,
794              c.relpages,
795              c.reltuples,
796              c.relallvisible,
797              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
798                  AS curpages,
799              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
800                  AS last_analyze,
801              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
802                  AS last_autoanalyze,
803              COALESCE(a.attname, ''),
804              n1.nspname AS schemaname_of_atttype,
805              t.typname,
806              a.atttypmod,
807              s.stainherit,
808              s.stanullfrac,
809              s.stawidth,
810              s.stadistinct,
811              s.stakind1,
812              s.stakind2,
813              s.stakind3,
814              s.stakind4,
815              s.stakind5,
816              s.staop1,
817              s.staop2,
818              s.staop3,
819              s.staop4,
820              s.staop5,
821              s.stanumbers1,
822              s.stanumbers2,
823              s.stanumbers3,
824              s.stanumbers4,
825              s.stanumbers5,
826              s.stavalues1,
827              s.stavalues2,
828              s.stavalues3,
829              s.stavalues4,
830              s.stavalues5
831         FROM pg_statistic s
832         JOIN pg_attribute a
833           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
834         JOIN pg_type t
835           ON a.atttypid = t.oid
836         JOIN pg_namespace n1
837           ON t.typnamespace = n1.oid
838        RIGHT JOIN pg_catalog.pg_class c
839           ON s.starelid = c.oid
840         JOIN pg_catalog.pg_namespace n2
841           ON c.relnamespace = n2.oid
842        WHERE c.relkind IN ('r', 'i', 'f', 'm')
843          AND NOT n2.nspname IN ('pg_catalog',
844                                 'pg_toast',
845                                 'information_schema',
846                                 'dbms_stats')
847         -- AND n2.nspname = 'public'
848         -- AND c.relname = 'test'
849         -- AND a.attname = 'id'
850  AND c.relname = 'smv0'
851        ORDER BY starelid, staattnum)
852 TO STDOUT
853 (FORMAT 'binary');
854 \o
855 COMMIT;
856 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
857 SELECT * FROM work_v;
858  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
859 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
860  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}      | (null)     | (null)     | (null)     | (null)
861  s0      | smv0    |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}    | (null)     | (null)     | (null)     | (null)
862  s0      | smv0    |        1 |         2 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |           0 |        3 |          -1 |        2 |        3 |        0 |        0 |        0 |    664 |    664 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,test}   | (null)     | (null)     | (null)     | (null)
863 (3 rows)
864
865 TRUNCATE dbms_stats.work;
866 \! rm doc/export_plain_stats-9.3.sql.sample_test
867 -- No.16-1-10
868 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname = '\'id\' doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
869 \i doc/export_plain_stats-9.3.sql.sample_test
870 /*
871  * If you want the statistics of per-relation or per-column, please modify
872  * nspname, relname, and attname in 'WHERE' clause.
873  */
874 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
875 /*
876  * If you want to chage the output file name, please modify the following name.
877  */
878 \o export_stats.dmp
879 COPY (SELECT n2.nspname,
880              c.relname,
881              c.relpages,
882              c.reltuples,
883              c.relallvisible,
884              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
885                  AS curpages,
886              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
887                  AS last_analyze,
888              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
889                  AS last_autoanalyze,
890              COALESCE(a.attname, ''),
891              n1.nspname AS schemaname_of_atttype,
892              t.typname,
893              a.atttypmod,
894              s.stainherit,
895              s.stanullfrac,
896              s.stawidth,
897              s.stadistinct,
898              s.stakind1,
899              s.stakind2,
900              s.stakind3,
901              s.stakind4,
902              s.stakind5,
903              s.staop1,
904              s.staop2,
905              s.staop3,
906              s.staop4,
907              s.staop5,
908              s.stanumbers1,
909              s.stanumbers2,
910              s.stanumbers3,
911              s.stanumbers4,
912              s.stanumbers5,
913              s.stavalues1,
914              s.stavalues2,
915              s.stavalues3,
916              s.stavalues4,
917              s.stavalues5
918         FROM pg_statistic s
919         JOIN pg_attribute a
920           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
921         JOIN pg_type t
922           ON a.atttypid = t.oid
923         JOIN pg_namespace n1
924           ON t.typnamespace = n1.oid
925        RIGHT JOIN pg_catalog.pg_class c
926           ON s.starelid = c.oid
927         JOIN pg_catalog.pg_namespace n2
928           ON c.relnamespace = n2.oid
929        WHERE c.relkind IN ('r', 'i', 'f', 'm')
930          AND NOT n2.nspname IN ('pg_catalog',
931                                 'pg_toast',
932                                 'information_schema',
933                                 'dbms_stats')
934         -- AND n2.nspname = 'public'
935         -- AND c.relname = 'test'
936         -- AND a.attname = 'id'
937  AND n2.nspname = 's0' AND a.attname = 'id'
938        ORDER BY starelid, staattnum)
939 TO STDOUT
940 (FORMAT 'binary');
941 \o
942 COMMIT;
943 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
944 SELECT * FROM work_v;
945  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |       stavalues1       | stavalues2 | stavalues3 | stavalues4 | stavalues5 
946 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------------+------------+------------+------------+------------
947  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)     | (null)     | (null)
948  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
949  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}                  | (null)     | (null)     | (null)     | (null)
950  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}            | (null)     | (null)     | (null)     | (null)
951  s0      | st1     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {4,5,6}                | (null)     | (null)     | (null)     | (null)
952  s0      | st2     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,3}                | (null)     | (null)     | (null)     | (null)
953 (6 rows)
954
955 TRUNCATE dbms_stats.work;
956 \! rm doc/export_plain_stats-9.3.sql.sample_test
957 -- No.16-1-11
958 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
959 \i doc/export_plain_stats-9.3.sql.sample_test
960 /*
961  * If you want the statistics of per-relation or per-column, please modify
962  * nspname, relname, and attname in 'WHERE' clause.
963  */
964 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
965 /*
966  * If you want to chage the output file name, please modify the following name.
967  */
968 \o export_stats.dmp
969 COPY (SELECT n2.nspname,
970              c.relname,
971              c.relpages,
972              c.reltuples,
973              c.relallvisible,
974              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
975                  AS curpages,
976              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
977                  AS last_analyze,
978              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
979                  AS last_autoanalyze,
980              COALESCE(a.attname, ''),
981              n1.nspname AS schemaname_of_atttype,
982              t.typname,
983              a.atttypmod,
984              s.stainherit,
985              s.stanullfrac,
986              s.stawidth,
987              s.stadistinct,
988              s.stakind1,
989              s.stakind2,
990              s.stakind3,
991              s.stakind4,
992              s.stakind5,
993              s.staop1,
994              s.staop2,
995              s.staop3,
996              s.staop4,
997              s.staop5,
998              s.stanumbers1,
999              s.stanumbers2,
1000              s.stanumbers3,
1001              s.stanumbers4,
1002              s.stanumbers5,
1003              s.stavalues1,
1004              s.stavalues2,
1005              s.stavalues3,
1006              s.stavalues4,
1007              s.stavalues5
1008         FROM pg_statistic s
1009         JOIN pg_attribute a
1010           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
1011         JOIN pg_type t
1012           ON a.atttypid = t.oid
1013         JOIN pg_namespace n1
1014           ON t.typnamespace = n1.oid
1015        RIGHT JOIN pg_catalog.pg_class c
1016           ON s.starelid = c.oid
1017         JOIN pg_catalog.pg_namespace n2
1018           ON c.relnamespace = n2.oid
1019        WHERE c.relkind IN ('r', 'i', 'f', 'm')
1020          AND NOT n2.nspname IN ('pg_catalog',
1021                                 'pg_toast',
1022                                 'information_schema',
1023                                 'dbms_stats')
1024         -- AND n2.nspname = 'public'
1025         -- AND c.relname = 'test'
1026         -- AND a.attname = 'id'
1027  AND n2.nspname = 's0' AND a.attname IS NULL
1028        ORDER BY starelid, staattnum)
1029 TO STDOUT
1030 (FORMAT 'binary');
1031 \o
1032 COMMIT;
1033 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1034 SELECT * FROM work_v;
1035  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1036 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1037  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
1038  s0      | st1_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
1039  s0      | st2_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
1040  s0      | st3     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
1041 (4 rows)
1042
1043 TRUNCATE dbms_stats.work;
1044 \! rm doc/export_plain_stats-9.3.sql.sample_test
1045 -- No.16-1-12
1046 \! sed '/ORDER/i\\ AND n2.nspname = '"\'s1\'"' AND c.relname IS NULL' doc/export_plain_stats-9.3.sql.sample > doc/export_plain_stats-9.3.sql.sample_test
1047 \i doc/export_plain_stats-9.3.sql.sample_test
1048 /*
1049  * If you want the statistics of per-relation or per-column, please modify
1050  * nspname, relname, and attname in 'WHERE' clause.
1051  */
1052 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1053 /*
1054  * If you want to chage the output file name, please modify the following name.
1055  */
1056 \o export_stats.dmp
1057 COPY (SELECT n2.nspname,
1058              c.relname,
1059              c.relpages,
1060              c.reltuples,
1061              c.relallvisible,
1062              (pg_relation_size(c.oid) / current_setting('block_size')::int4)::int4
1063                  AS curpages,
1064              pg_catalog.pg_stat_get_last_analyze_time(c.oid)
1065                  AS last_analyze,
1066              pg_catalog.pg_stat_get_last_autoanalyze_time(c.oid)
1067                  AS last_autoanalyze,
1068              COALESCE(a.attname, ''),
1069              n1.nspname AS schemaname_of_atttype,
1070              t.typname,
1071              a.atttypmod,
1072              s.stainherit,
1073              s.stanullfrac,
1074              s.stawidth,
1075              s.stadistinct,
1076              s.stakind1,
1077              s.stakind2,
1078              s.stakind3,
1079              s.stakind4,
1080              s.stakind5,
1081              s.staop1,
1082              s.staop2,
1083              s.staop3,
1084              s.staop4,
1085              s.staop5,
1086              s.stanumbers1,
1087              s.stanumbers2,
1088              s.stanumbers3,
1089              s.stanumbers4,
1090              s.stanumbers5,
1091              s.stavalues1,
1092              s.stavalues2,
1093              s.stavalues3,
1094              s.stavalues4,
1095              s.stavalues5
1096         FROM pg_statistic s
1097         JOIN pg_attribute a
1098           ON (s.starelid = a.attrelid AND s.staattnum = a.attnum)
1099         JOIN pg_type t
1100           ON a.atttypid = t.oid
1101         JOIN pg_namespace n1
1102           ON t.typnamespace = n1.oid
1103        RIGHT JOIN pg_catalog.pg_class c
1104           ON s.starelid = c.oid
1105         JOIN pg_catalog.pg_namespace n2
1106           ON c.relnamespace = n2.oid
1107        WHERE c.relkind IN ('r', 'i', 'f', 'm')
1108          AND NOT n2.nspname IN ('pg_catalog',
1109                                 'pg_toast',
1110                                 'information_schema',
1111                                 'dbms_stats')
1112         -- AND n2.nspname = 'public'
1113         -- AND c.relname = 'test'
1114         -- AND a.attname = 'id'
1115  AND n2.nspname = 's1' AND c.relname IS NULL
1116        ORDER BY starelid, staattnum)
1117 TO STDOUT
1118 (FORMAT 'binary');
1119 \o
1120 COMMIT;
1121 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1122 SELECT * FROM work_v;
1123  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1124 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1125 (0 rows)
1126
1127 TRUNCATE dbms_stats.work;
1128 \! rm doc/export_plain_stats-9.3.sql.sample_test
1129 /*
1130  * No.16-2 export_effective_stats-9.3.sql.sample
1131  */
1132 -- No.16-2-1
1133 VACUUM ANALYZE;
1134 SELECT dbms_stats.lock_database_stats();
1135  lock_database_stats 
1136 ---------------------
1137  pt0
1138  pt0_idx
1139  st0
1140  st0_idx
1141  st1
1142  s0.st0
1143  s0.st0_idx
1144  s0.st1
1145  s0.st1_idx
1146  s0.st2
1147  s0.st2_idx
1148  st1_idx
1149  st1_exp
1150  s0.sft0
1151  s0.smv0
1152  s1.st0
1153  s0.st3
1154 (17 rows)
1155
1156 UPDATE dbms_stats._relation_stats_locked
1157    SET (relpages, reltuples, relallvisible, curpages) = (NULL, NULL, NULL, NULL);
1158 UPDATE dbms_stats._column_stats_locked
1159    SET (stanullfrac, stawidth, stadistinct,
1160         stakind1, stakind2, stakind3, stakind4, stakind5,
1161         staop1, staop2, staop3, staop4, staop5,
1162         stanumbers1, stanumbers2, stanumbers3, stanumbers4, stanumbers5,
1163         stavalues1, stavalues2, stavalues3, stavalues4, stavalues5)
1164      = (NULL, NULL, NULL,
1165         NULL, NULL, NULL, NULL, NULL,
1166         NULL, NULL, NULL, NULL, NULL,
1167         NULL, NULL, NULL, NULL, NULL,
1168         NULL, NULL, NULL, NULL, NULL)
1169  WHERE starelid = 's0.st0'::regclass;
1170 \i doc/export_effective_stats-9.3.sql.sample
1171 /*
1172  * If you want the statistics of per-relation or per-column, please modify
1173  * nspname, relname, and attname in 'WHERE' clause.
1174  */
1175 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1176 /*
1177  * If you want to chage the output file name, please modify the following name.
1178  */
1179 \o export_stats.dmp
1180 COPY (SELECT n2.nspname,
1181              cl.relname,
1182              r.relpages,
1183              r.reltuples,
1184              r.relallvisible,
1185              r.curpages,
1186              r.last_analyze,
1187              r.last_autoanalyze,
1188              COALESCE(a.attname, ''),
1189              n1.nspname AS schemaname_of_atttype,
1190              t.typname,
1191              a.atttypmod,
1192              co.stainherit,
1193              co.stanullfrac,
1194              co.stawidth,
1195              co.stadistinct,
1196              co.stakind1,
1197              co.stakind2,
1198              co.stakind3,
1199              co.stakind4,
1200              co.stakind5,
1201              co.staop1,
1202              co.staop2,
1203              co.staop3,
1204              co.staop4,
1205              co.staop5,
1206              co.stanumbers1,
1207              co.stanumbers2,
1208              co.stanumbers3,
1209              co.stanumbers4,
1210              co.stanumbers5,
1211              co.stavalues1,
1212              co.stavalues2,
1213              co.stavalues3,
1214              co.stavalues4,
1215              co.stavalues5
1216         FROM dbms_stats.column_stats_effective co
1217         JOIN pg_attribute a
1218           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1219         JOIN pg_type t
1220           ON a.atttypid = t.oid
1221         JOIN pg_namespace n1
1222           ON t.typnamespace = n1.oid
1223        RIGHT JOIN dbms_stats.relation_stats_effective r
1224           ON co.starelid = r.relid
1225         JOIN pg_catalog.pg_class cl
1226           ON r.relid = cl.oid
1227         JOIN pg_catalog.pg_namespace n2
1228           ON cl.relnamespace = n2.oid
1229        -- WHERE n2.nspname = 'public'
1230        -- AND cl.relname = 'test'
1231        -- AND a.attname = 'id'
1232        ORDER BY starelid, staattnum)
1233 TO STDOUT
1234 (FORMAT 'binary');
1235 \o
1236 COMMIT;
1237 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1238 SELECT * FROM work_v;
1239  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |    stavalues1    | stavalues2 |       stavalues3       | stavalues4 | stavalues5 
1240 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------------+------------+------------
1241  public  | pt0     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1242  public  | pt0_idx |        2 |         0 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1243  public  | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2}                  | (null)     | (null)
1244  public  | st0     |        1 |         2 |             1 |        1 | name    | pg_catalog          | bpchar  |         9 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {"test "}              | (null)     | (null)
1245  public  | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1246  public  | st1     |       45 |     10000 |            45 |       45 | str     | pg_catalog          | text    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {1,0,2}                | (null)     | (null)
1247  public  | st1     |       45 |     10000 |            45 |       45 | val     | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,0,2}                | (null)     | (null)
1248  public  | st1_exp |       30 |     10000 |             0 |       30 | lower   | pg_catalog          | text    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,0,2}                | (null)     | (null)
1249  public  | st1_idx |       30 |     10000 |             0 |       30 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1250  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)
1251  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2}                  | (null)     | (null)
1252  s0      | smv0    |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {10,20}                | (null)     | (null)
1253  s0      | smv0    |        1 |         2 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |          -3 |       -3 |          -3 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-3,22}     | {-3,23}     | {-3,24}     | {-3,21}     | {-3,25}     | (null)           | (null)     | {1,test}               | (null)     | (null)
1254  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}            | (null)     | (null)                 | (null)     | (null)
1255  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}      | (null)     | (null)                 | (null)     | (null)
1256  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}          | (null)     | (null)                 | (null)     | (null)
1257  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20,40,50,60} | (null)     | (null)                 | (null)     | (null)
1258  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1259  s0      | st1     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {4,5,6}                | (null)     | (null)
1260  s0      | st1     |        1 |         3 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {40,50,60}             | (null)     | (null)
1261  s0      | st1_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1262  s0      | st2     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2,3}                | (null)     | (null)
1263  s0      | st2     |        1 |         3 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {1,comment,test}       | (null)     | (null)
1264  s0      | st2_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1265  s0      | st3     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1266  s1      | st0     |        1 |         4 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2,3,4}              | (null)     | (null)
1267  s1      | st0     |        1 |         4 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {15,25,35,45}          | (null)     | (null)
1268 (27 rows)
1269
1270 TRUNCATE dbms_stats.work;
1271 -- No.16-2-2
1272 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1273 \i doc/export_effective_stats-9.3.sql.sample_test
1274 /*
1275  * If you want the statistics of per-relation or per-column, please modify
1276  * nspname, relname, and attname in 'WHERE' clause.
1277  */
1278 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1279 /*
1280  * If you want to chage the output file name, please modify the following name.
1281  */
1282 \o export_stats.dmp
1283 COPY (SELECT n2.nspname,
1284              cl.relname,
1285              r.relpages,
1286              r.reltuples,
1287              r.relallvisible,
1288              r.curpages,
1289              r.last_analyze,
1290              r.last_autoanalyze,
1291              COALESCE(a.attname, ''),
1292              n1.nspname AS schemaname_of_atttype,
1293              t.typname,
1294              a.atttypmod,
1295              co.stainherit,
1296              co.stanullfrac,
1297              co.stawidth,
1298              co.stadistinct,
1299              co.stakind1,
1300              co.stakind2,
1301              co.stakind3,
1302              co.stakind4,
1303              co.stakind5,
1304              co.staop1,
1305              co.staop2,
1306              co.staop3,
1307              co.staop4,
1308              co.staop5,
1309              co.stanumbers1,
1310              co.stanumbers2,
1311              co.stanumbers3,
1312              co.stanumbers4,
1313              co.stanumbers5,
1314              co.stavalues1,
1315              co.stavalues2,
1316              co.stavalues3,
1317              co.stavalues4,
1318              co.stavalues5
1319         FROM dbms_stats.column_stats_effective co
1320         JOIN pg_attribute a
1321           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1322         JOIN pg_type t
1323           ON a.atttypid = t.oid
1324         JOIN pg_namespace n1
1325           ON t.typnamespace = n1.oid
1326        RIGHT JOIN dbms_stats.relation_stats_effective r
1327           ON co.starelid = r.relid
1328         JOIN pg_catalog.pg_class cl
1329           ON r.relid = cl.oid
1330         JOIN pg_catalog.pg_namespace n2
1331           ON cl.relnamespace = n2.oid
1332        -- WHERE n2.nspname = 'public'
1333        -- AND cl.relname = 'test'
1334        -- AND a.attname = 'id'
1335  WHERE n2.nspname = 's0'
1336        ORDER BY starelid, staattnum)
1337 TO STDOUT
1338 (FORMAT 'binary');
1339 \o
1340 COMMIT;
1341 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1342 SELECT * FROM work_v;
1343  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |    stavalues1    | stavalues2 |       stavalues3       | stavalues4 | stavalues5 
1344 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+------------------------+------------+------------
1345  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)
1346  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2}                  | (null)     | (null)
1347  s0      | smv0    |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {10,20}                | (null)     | (null)
1348  s0      | smv0    |        1 |         2 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |          -3 |       -3 |          -3 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-3,22}     | {-3,23}     | {-3,24}     | {-3,21}     | {-3,25}     | (null)           | (null)     | {1,test}               | (null)     | (null)
1349  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}            | (null)     | (null)                 | (null)     | (null)
1350  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}      | (null)     | (null)                 | (null)     | (null)
1351  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}          | (null)     | (null)                 | (null)     | (null)
1352  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20,40,50,60} | (null)     | (null)                 | (null)     | (null)
1353  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1354  s0      | st1     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {4,5,6}                | (null)     | (null)
1355  s0      | st1     |        1 |         3 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {40,50,60}             | (null)     | (null)
1356  s0      | st1_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1357  s0      | st2     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2,3}                | (null)     | (null)
1358  s0      | st2     |        1 |         3 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {1,comment,test}       | (null)     | (null)
1359  s0      | st2_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1360  s0      | st3     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)           | (null)     | (null)                 | (null)     | (null)
1361 (16 rows)
1362
1363 \! rm doc/export_effective_stats-9.3.sql.sample_test
1364 TRUNCATE dbms_stats.work;
1365 -- No.16-2-3
1366 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1367 \i doc/export_effective_stats-9.3.sql.sample_test
1368 /*
1369  * If you want the statistics of per-relation or per-column, please modify
1370  * nspname, relname, and attname in 'WHERE' clause.
1371  */
1372 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1373 /*
1374  * If you want to chage the output file name, please modify the following name.
1375  */
1376 \o export_stats.dmp
1377 COPY (SELECT n2.nspname,
1378              cl.relname,
1379              r.relpages,
1380              r.reltuples,
1381              r.relallvisible,
1382              r.curpages,
1383              r.last_analyze,
1384              r.last_autoanalyze,
1385              COALESCE(a.attname, ''),
1386              n1.nspname AS schemaname_of_atttype,
1387              t.typname,
1388              a.atttypmod,
1389              co.stainherit,
1390              co.stanullfrac,
1391              co.stawidth,
1392              co.stadistinct,
1393              co.stakind1,
1394              co.stakind2,
1395              co.stakind3,
1396              co.stakind4,
1397              co.stakind5,
1398              co.staop1,
1399              co.staop2,
1400              co.staop3,
1401              co.staop4,
1402              co.staop5,
1403              co.stanumbers1,
1404              co.stanumbers2,
1405              co.stanumbers3,
1406              co.stanumbers4,
1407              co.stanumbers5,
1408              co.stavalues1,
1409              co.stavalues2,
1410              co.stavalues3,
1411              co.stavalues4,
1412              co.stavalues5
1413         FROM dbms_stats.column_stats_effective co
1414         JOIN pg_attribute a
1415           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1416         JOIN pg_type t
1417           ON a.atttypid = t.oid
1418         JOIN pg_namespace n1
1419           ON t.typnamespace = n1.oid
1420        RIGHT JOIN dbms_stats.relation_stats_effective r
1421           ON co.starelid = r.relid
1422         JOIN pg_catalog.pg_class cl
1423           ON r.relid = cl.oid
1424         JOIN pg_catalog.pg_namespace n2
1425           ON cl.relnamespace = n2.oid
1426        -- WHERE n2.nspname = 'public'
1427        -- AND cl.relname = 'test'
1428        -- AND a.attname = 'id'
1429  WHERE cl.relname = 'st0'
1430        ORDER BY starelid, staattnum)
1431 TO STDOUT
1432 (FORMAT 'binary');
1433 \o
1434 COMMIT;
1435 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1436 SELECT * FROM work_v;
1437  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 |    stavalues1    | stavalues2 |  stavalues3   | stavalues4 | stavalues5 
1438 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------------+------------+---------------+------------+------------
1439  public  | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2}         | (null)     | (null)
1440  public  | st0     |        1 |         2 |             1 |        1 | name    | pg_catalog          | bpchar  |         9 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {"test "}     | (null)     | (null)
1441  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}            | (null)     | (null)        | (null)     | (null)
1442  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6}      | (null)     | (null)        | (null)     | (null)
1443  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20}          | (null)     | (null)        | (null)     | (null)
1444  s0      | st0     |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {10,20,40,50,60} | (null)     | (null)        | (null)     | (null)
1445  s1      | st0     |        1 |         4 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)           | (null)     | {1,2,3,4}     | (null)     | (null)
1446  s1      | st0     |        1 |         4 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)           | (null)     | {15,25,35,45} | (null)     | (null)
1447 (8 rows)
1448
1449 \! rm doc/export_effective_stats-9.3.sql.sample_test
1450 TRUNCATE dbms_stats.work;
1451 -- No.16-2-4
1452 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'pg_toast_1262\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1453 \i doc/export_effective_stats-9.3.sql.sample_test
1454 /*
1455  * If you want the statistics of per-relation or per-column, please modify
1456  * nspname, relname, and attname in 'WHERE' clause.
1457  */
1458 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1459 /*
1460  * If you want to chage the output file name, please modify the following name.
1461  */
1462 \o export_stats.dmp
1463 COPY (SELECT n2.nspname,
1464              cl.relname,
1465              r.relpages,
1466              r.reltuples,
1467              r.relallvisible,
1468              r.curpages,
1469              r.last_analyze,
1470              r.last_autoanalyze,
1471              COALESCE(a.attname, ''),
1472              n1.nspname AS schemaname_of_atttype,
1473              t.typname,
1474              a.atttypmod,
1475              co.stainherit,
1476              co.stanullfrac,
1477              co.stawidth,
1478              co.stadistinct,
1479              co.stakind1,
1480              co.stakind2,
1481              co.stakind3,
1482              co.stakind4,
1483              co.stakind5,
1484              co.staop1,
1485              co.staop2,
1486              co.staop3,
1487              co.staop4,
1488              co.staop5,
1489              co.stanumbers1,
1490              co.stanumbers2,
1491              co.stanumbers3,
1492              co.stanumbers4,
1493              co.stanumbers5,
1494              co.stavalues1,
1495              co.stavalues2,
1496              co.stavalues3,
1497              co.stavalues4,
1498              co.stavalues5
1499         FROM dbms_stats.column_stats_effective co
1500         JOIN pg_attribute a
1501           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1502         JOIN pg_type t
1503           ON a.atttypid = t.oid
1504         JOIN pg_namespace n1
1505           ON t.typnamespace = n1.oid
1506        RIGHT JOIN dbms_stats.relation_stats_effective r
1507           ON co.starelid = r.relid
1508         JOIN pg_catalog.pg_class cl
1509           ON r.relid = cl.oid
1510         JOIN pg_catalog.pg_namespace n2
1511           ON cl.relnamespace = n2.oid
1512        -- WHERE n2.nspname = 'public'
1513        -- AND cl.relname = 'test'
1514        -- AND a.attname = 'id'
1515  WHERE cl.relname = 'pg_toast_1262'
1516        ORDER BY starelid, staattnum)
1517 TO STDOUT
1518 (FORMAT 'binary');
1519 \o
1520 COMMIT;
1521 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1522 SELECT * FROM work_v;
1523  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1524 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1525 (0 rows)
1526
1527 \! rm doc/export_effective_stats-9.3.sql.sample_test
1528 TRUNCATE dbms_stats.work;
1529 -- No.16-2-5
1530 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'st0_idx\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1531 \i doc/export_effective_stats-9.3.sql.sample_test
1532 /*
1533  * If you want the statistics of per-relation or per-column, please modify
1534  * nspname, relname, and attname in 'WHERE' clause.
1535  */
1536 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1537 /*
1538  * If you want to chage the output file name, please modify the following name.
1539  */
1540 \o export_stats.dmp
1541 COPY (SELECT n2.nspname,
1542              cl.relname,
1543              r.relpages,
1544              r.reltuples,
1545              r.relallvisible,
1546              r.curpages,
1547              r.last_analyze,
1548              r.last_autoanalyze,
1549              COALESCE(a.attname, ''),
1550              n1.nspname AS schemaname_of_atttype,
1551              t.typname,
1552              a.atttypmod,
1553              co.stainherit,
1554              co.stanullfrac,
1555              co.stawidth,
1556              co.stadistinct,
1557              co.stakind1,
1558              co.stakind2,
1559              co.stakind3,
1560              co.stakind4,
1561              co.stakind5,
1562              co.staop1,
1563              co.staop2,
1564              co.staop3,
1565              co.staop4,
1566              co.staop5,
1567              co.stanumbers1,
1568              co.stanumbers2,
1569              co.stanumbers3,
1570              co.stanumbers4,
1571              co.stanumbers5,
1572              co.stavalues1,
1573              co.stavalues2,
1574              co.stavalues3,
1575              co.stavalues4,
1576              co.stavalues5
1577         FROM dbms_stats.column_stats_effective co
1578         JOIN pg_attribute a
1579           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1580         JOIN pg_type t
1581           ON a.atttypid = t.oid
1582         JOIN pg_namespace n1
1583           ON t.typnamespace = n1.oid
1584        RIGHT JOIN dbms_stats.relation_stats_effective r
1585           ON co.starelid = r.relid
1586         JOIN pg_catalog.pg_class cl
1587           ON r.relid = cl.oid
1588         JOIN pg_catalog.pg_namespace n2
1589           ON cl.relnamespace = n2.oid
1590        -- WHERE n2.nspname = 'public'
1591        -- AND cl.relname = 'test'
1592        -- AND a.attname = 'id'
1593  WHERE cl.relname = 'st0_idx'
1594        ORDER BY starelid, staattnum)
1595 TO STDOUT
1596 (FORMAT 'binary');
1597 \o
1598 COMMIT;
1599 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1600 SELECT * FROM work_v;
1601  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1602 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1603  public  | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
1604  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
1605 (2 rows)
1606
1607 \! rm doc/export_effective_stats-9.3.sql.sample_test
1608 TRUNCATE dbms_stats.work;
1609 -- No.16-2-6
1610 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'ss0\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1611 \i doc/export_effective_stats-9.3.sql.sample_test
1612 /*
1613  * If you want the statistics of per-relation or per-column, please modify
1614  * nspname, relname, and attname in 'WHERE' clause.
1615  */
1616 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1617 /*
1618  * If you want to chage the output file name, please modify the following name.
1619  */
1620 \o export_stats.dmp
1621 COPY (SELECT n2.nspname,
1622              cl.relname,
1623              r.relpages,
1624              r.reltuples,
1625              r.relallvisible,
1626              r.curpages,
1627              r.last_analyze,
1628              r.last_autoanalyze,
1629              COALESCE(a.attname, ''),
1630              n1.nspname AS schemaname_of_atttype,
1631              t.typname,
1632              a.atttypmod,
1633              co.stainherit,
1634              co.stanullfrac,
1635              co.stawidth,
1636              co.stadistinct,
1637              co.stakind1,
1638              co.stakind2,
1639              co.stakind3,
1640              co.stakind4,
1641              co.stakind5,
1642              co.staop1,
1643              co.staop2,
1644              co.staop3,
1645              co.staop4,
1646              co.staop5,
1647              co.stanumbers1,
1648              co.stanumbers2,
1649              co.stanumbers3,
1650              co.stanumbers4,
1651              co.stanumbers5,
1652              co.stavalues1,
1653              co.stavalues2,
1654              co.stavalues3,
1655              co.stavalues4,
1656              co.stavalues5
1657         FROM dbms_stats.column_stats_effective co
1658         JOIN pg_attribute a
1659           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1660         JOIN pg_type t
1661           ON a.atttypid = t.oid
1662         JOIN pg_namespace n1
1663           ON t.typnamespace = n1.oid
1664        RIGHT JOIN dbms_stats.relation_stats_effective r
1665           ON co.starelid = r.relid
1666         JOIN pg_catalog.pg_class cl
1667           ON r.relid = cl.oid
1668         JOIN pg_catalog.pg_namespace n2
1669           ON cl.relnamespace = n2.oid
1670        -- WHERE n2.nspname = 'public'
1671        -- AND cl.relname = 'test'
1672        -- AND a.attname = 'id'
1673  WHERE cl.relname = 'ss0'
1674        ORDER BY starelid, staattnum)
1675 TO STDOUT
1676 (FORMAT 'binary');
1677 \o
1678 COMMIT;
1679 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1680 SELECT * FROM work_v;
1681  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1682 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1683 (0 rows)
1684
1685 \! rm doc/export_effective_stats-9.3.sql.sample_test
1686 TRUNCATE dbms_stats.work;
1687 -- No.16-2-7
1688 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'sc0\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1689 \i doc/export_effective_stats-9.3.sql.sample_test
1690 /*
1691  * If you want the statistics of per-relation or per-column, please modify
1692  * nspname, relname, and attname in 'WHERE' clause.
1693  */
1694 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1695 /*
1696  * If you want to chage the output file name, please modify the following name.
1697  */
1698 \o export_stats.dmp
1699 COPY (SELECT n2.nspname,
1700              cl.relname,
1701              r.relpages,
1702              r.reltuples,
1703              r.relallvisible,
1704              r.curpages,
1705              r.last_analyze,
1706              r.last_autoanalyze,
1707              COALESCE(a.attname, ''),
1708              n1.nspname AS schemaname_of_atttype,
1709              t.typname,
1710              a.atttypmod,
1711              co.stainherit,
1712              co.stanullfrac,
1713              co.stawidth,
1714              co.stadistinct,
1715              co.stakind1,
1716              co.stakind2,
1717              co.stakind3,
1718              co.stakind4,
1719              co.stakind5,
1720              co.staop1,
1721              co.staop2,
1722              co.staop3,
1723              co.staop4,
1724              co.staop5,
1725              co.stanumbers1,
1726              co.stanumbers2,
1727              co.stanumbers3,
1728              co.stanumbers4,
1729              co.stanumbers5,
1730              co.stavalues1,
1731              co.stavalues2,
1732              co.stavalues3,
1733              co.stavalues4,
1734              co.stavalues5
1735         FROM dbms_stats.column_stats_effective co
1736         JOIN pg_attribute a
1737           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1738         JOIN pg_type t
1739           ON a.atttypid = t.oid
1740         JOIN pg_namespace n1
1741           ON t.typnamespace = n1.oid
1742        RIGHT JOIN dbms_stats.relation_stats_effective r
1743           ON co.starelid = r.relid
1744         JOIN pg_catalog.pg_class cl
1745           ON r.relid = cl.oid
1746         JOIN pg_catalog.pg_namespace n2
1747           ON cl.relnamespace = n2.oid
1748        -- WHERE n2.nspname = 'public'
1749        -- AND cl.relname = 'test'
1750        -- AND a.attname = 'id'
1751  WHERE cl.relname = 'sc0'
1752        ORDER BY starelid, staattnum)
1753 TO STDOUT
1754 (FORMAT 'binary');
1755 \o
1756 COMMIT;
1757 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1758 SELECT * FROM work_v;
1759  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1760 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1761 (0 rows)
1762
1763 \! rm doc/export_effective_stats-9.3.sql.sample_test
1764 TRUNCATE dbms_stats.work;
1765 -- No.16-2-8
1766 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'sft0\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1767 \i doc/export_effective_stats-9.3.sql.sample_test
1768 /*
1769  * If you want the statistics of per-relation or per-column, please modify
1770  * nspname, relname, and attname in 'WHERE' clause.
1771  */
1772 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1773 /*
1774  * If you want to chage the output file name, please modify the following name.
1775  */
1776 \o export_stats.dmp
1777 COPY (SELECT n2.nspname,
1778              cl.relname,
1779              r.relpages,
1780              r.reltuples,
1781              r.relallvisible,
1782              r.curpages,
1783              r.last_analyze,
1784              r.last_autoanalyze,
1785              COALESCE(a.attname, ''),
1786              n1.nspname AS schemaname_of_atttype,
1787              t.typname,
1788              a.atttypmod,
1789              co.stainherit,
1790              co.stanullfrac,
1791              co.stawidth,
1792              co.stadistinct,
1793              co.stakind1,
1794              co.stakind2,
1795              co.stakind3,
1796              co.stakind4,
1797              co.stakind5,
1798              co.staop1,
1799              co.staop2,
1800              co.staop3,
1801              co.staop4,
1802              co.staop5,
1803              co.stanumbers1,
1804              co.stanumbers2,
1805              co.stanumbers3,
1806              co.stanumbers4,
1807              co.stanumbers5,
1808              co.stavalues1,
1809              co.stavalues2,
1810              co.stavalues3,
1811              co.stavalues4,
1812              co.stavalues5
1813         FROM dbms_stats.column_stats_effective co
1814         JOIN pg_attribute a
1815           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1816         JOIN pg_type t
1817           ON a.atttypid = t.oid
1818         JOIN pg_namespace n1
1819           ON t.typnamespace = n1.oid
1820        RIGHT JOIN dbms_stats.relation_stats_effective r
1821           ON co.starelid = r.relid
1822         JOIN pg_catalog.pg_class cl
1823           ON r.relid = cl.oid
1824         JOIN pg_catalog.pg_namespace n2
1825           ON cl.relnamespace = n2.oid
1826        -- WHERE n2.nspname = 'public'
1827        -- AND cl.relname = 'test'
1828        -- AND a.attname = 'id'
1829  WHERE cl.relname = 'sft0'
1830        ORDER BY starelid, staattnum)
1831 TO STDOUT
1832 (FORMAT 'binary');
1833 \o
1834 COMMIT;
1835 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1836 SELECT * FROM work_v;
1837  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 |       stavalues3       | stavalues4 | stavalues5 
1838 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------------------+------------+------------
1839  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)     | (null)     | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)
1840 (1 row)
1841
1842 \! rm doc/export_effective_stats-9.3.sql.sample_test
1843 TRUNCATE dbms_stats.work;
1844 -- No.16-2-9
1845 \! sed '/ORDER/i\\ WHERE cl.relname = '"\'smv0\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1846 \i doc/export_effective_stats-9.3.sql.sample_test
1847 /*
1848  * If you want the statistics of per-relation or per-column, please modify
1849  * nspname, relname, and attname in 'WHERE' clause.
1850  */
1851 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1852 /*
1853  * If you want to chage the output file name, please modify the following name.
1854  */
1855 \o export_stats.dmp
1856 COPY (SELECT n2.nspname,
1857              cl.relname,
1858              r.relpages,
1859              r.reltuples,
1860              r.relallvisible,
1861              r.curpages,
1862              r.last_analyze,
1863              r.last_autoanalyze,
1864              COALESCE(a.attname, ''),
1865              n1.nspname AS schemaname_of_atttype,
1866              t.typname,
1867              a.atttypmod,
1868              co.stainherit,
1869              co.stanullfrac,
1870              co.stawidth,
1871              co.stadistinct,
1872              co.stakind1,
1873              co.stakind2,
1874              co.stakind3,
1875              co.stakind4,
1876              co.stakind5,
1877              co.staop1,
1878              co.staop2,
1879              co.staop3,
1880              co.staop4,
1881              co.staop5,
1882              co.stanumbers1,
1883              co.stanumbers2,
1884              co.stanumbers3,
1885              co.stanumbers4,
1886              co.stanumbers5,
1887              co.stavalues1,
1888              co.stavalues2,
1889              co.stavalues3,
1890              co.stavalues4,
1891              co.stavalues5
1892         FROM dbms_stats.column_stats_effective co
1893         JOIN pg_attribute a
1894           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1895         JOIN pg_type t
1896           ON a.atttypid = t.oid
1897         JOIN pg_namespace n1
1898           ON t.typnamespace = n1.oid
1899        RIGHT JOIN dbms_stats.relation_stats_effective r
1900           ON co.starelid = r.relid
1901         JOIN pg_catalog.pg_class cl
1902           ON r.relid = cl.oid
1903         JOIN pg_catalog.pg_namespace n2
1904           ON cl.relnamespace = n2.oid
1905        -- WHERE n2.nspname = 'public'
1906        -- AND cl.relname = 'test'
1907        -- AND a.attname = 'id'
1908  WHERE cl.relname = 'smv0'
1909        ORDER BY starelid, staattnum)
1910 TO STDOUT
1911 (FORMAT 'binary');
1912 \o
1913 COMMIT;
1914 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1915 SELECT * FROM work_v;
1916  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
1917 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
1918  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)     | (null)     | {1,2}      | (null)     | (null)
1919  s0      | smv0    |        1 |         2 |             1 |        1 | num     | pg_catalog          | int4    |        -1 | f          |          -2 |       -2 |          -2 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-2,22}     | {-2,23}     | {-2,24}     | {-2,21}     | {-2,25}     | (null)     | (null)     | {10,20}    | (null)     | (null)
1920  s0      | smv0    |        1 |         2 |             1 |        1 | txt     | pg_catalog          | text    |        -1 | f          |          -3 |       -3 |          -3 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-3,22}     | {-3,23}     | {-3,24}     | {-3,21}     | {-3,25}     | (null)     | (null)     | {1,test}   | (null)     | (null)
1921 (3 rows)
1922
1923 \! rm doc/export_effective_stats-9.3.sql.sample_test
1924 TRUNCATE dbms_stats.work;
1925 -- No.16-2-10
1926 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname = '"\'id\'" doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
1927 \i doc/export_effective_stats-9.3.sql.sample_test
1928 /*
1929  * If you want the statistics of per-relation or per-column, please modify
1930  * nspname, relname, and attname in 'WHERE' clause.
1931  */
1932 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1933 /*
1934  * If you want to chage the output file name, please modify the following name.
1935  */
1936 \o export_stats.dmp
1937 COPY (SELECT n2.nspname,
1938              cl.relname,
1939              r.relpages,
1940              r.reltuples,
1941              r.relallvisible,
1942              r.curpages,
1943              r.last_analyze,
1944              r.last_autoanalyze,
1945              COALESCE(a.attname, ''),
1946              n1.nspname AS schemaname_of_atttype,
1947              t.typname,
1948              a.atttypmod,
1949              co.stainherit,
1950              co.stanullfrac,
1951              co.stawidth,
1952              co.stadistinct,
1953              co.stakind1,
1954              co.stakind2,
1955              co.stakind3,
1956              co.stakind4,
1957              co.stakind5,
1958              co.staop1,
1959              co.staop2,
1960              co.staop3,
1961              co.staop4,
1962              co.staop5,
1963              co.stanumbers1,
1964              co.stanumbers2,
1965              co.stanumbers3,
1966              co.stanumbers4,
1967              co.stanumbers5,
1968              co.stavalues1,
1969              co.stavalues2,
1970              co.stavalues3,
1971              co.stavalues4,
1972              co.stavalues5
1973         FROM dbms_stats.column_stats_effective co
1974         JOIN pg_attribute a
1975           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
1976         JOIN pg_type t
1977           ON a.atttypid = t.oid
1978         JOIN pg_namespace n1
1979           ON t.typnamespace = n1.oid
1980        RIGHT JOIN dbms_stats.relation_stats_effective r
1981           ON co.starelid = r.relid
1982         JOIN pg_catalog.pg_class cl
1983           ON r.relid = cl.oid
1984         JOIN pg_catalog.pg_namespace n2
1985           ON cl.relnamespace = n2.oid
1986        -- WHERE n2.nspname = 'public'
1987        -- AND cl.relname = 'test'
1988        -- AND a.attname = 'id'
1989  WHERE n2.nspname = 's0' AND a.attname = 'id'
1990        ORDER BY starelid, staattnum)
1991 TO STDOUT
1992 (FORMAT 'binary');
1993 \o
1994 COMMIT;
1995 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
1996 SELECT * FROM work_v;
1997  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1  | stavalues2 |       stavalues3       | stavalues4 | stavalues5 
1998 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+-------------+------------+------------------------+------------+------------
1999  s0      | sft0    |        1 |        10 |             0 |        0 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)      | (null)     | {1,2,3,4,5,6,7,8,9,10} | (null)     | (null)
2000  s0      | smv0    |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)      | (null)     | {1,2}                  | (null)     | (null)
2001  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2}       | (null)     | (null)                 | (null)     | (null)
2002  s0      | st0     |        1 |         2 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | t          |           0 |        4 |          -1 |        2 |        3 |        0 |        0 |        0 |     97 |     97 |      0 |      0 |      0 | (null)      | {1}         | (null)      | (null)      | (null)      | {1,2,4,5,6} | (null)     | (null)                 | (null)     | (null)
2003  s0      | st1     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)      | (null)     | {4,5,6}                | (null)     | (null)
2004  s0      | st2     |        1 |         3 |             1 |        1 | id      | pg_catalog          | int4    |        -1 | f          |          -1 |       -1 |          -1 |        2 |        3 |        4 |        1 |        5 |     22 |     23 |     24 |     21 |     25 | {-1,22}     | {-1,23}     | {-1,24}     | {-1,21}     | {-1,25}     | (null)      | (null)     | {1,2,3}                | (null)     | (null)
2005 (6 rows)
2006
2007 \! rm doc/export_effective_stats-9.3.sql.sample_test
2008 TRUNCATE dbms_stats.work;
2009 -- No.16-2-11
2010 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND a.attname IS NULL' doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
2011 \i doc/export_effective_stats-9.3.sql.sample_test
2012 /*
2013  * If you want the statistics of per-relation or per-column, please modify
2014  * nspname, relname, and attname in 'WHERE' clause.
2015  */
2016 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2017 /*
2018  * If you want to chage the output file name, please modify the following name.
2019  */
2020 \o export_stats.dmp
2021 COPY (SELECT n2.nspname,
2022              cl.relname,
2023              r.relpages,
2024              r.reltuples,
2025              r.relallvisible,
2026              r.curpages,
2027              r.last_analyze,
2028              r.last_autoanalyze,
2029              COALESCE(a.attname, ''),
2030              n1.nspname AS schemaname_of_atttype,
2031              t.typname,
2032              a.atttypmod,
2033              co.stainherit,
2034              co.stanullfrac,
2035              co.stawidth,
2036              co.stadistinct,
2037              co.stakind1,
2038              co.stakind2,
2039              co.stakind3,
2040              co.stakind4,
2041              co.stakind5,
2042              co.staop1,
2043              co.staop2,
2044              co.staop3,
2045              co.staop4,
2046              co.staop5,
2047              co.stanumbers1,
2048              co.stanumbers2,
2049              co.stanumbers3,
2050              co.stanumbers4,
2051              co.stanumbers5,
2052              co.stavalues1,
2053              co.stavalues2,
2054              co.stavalues3,
2055              co.stavalues4,
2056              co.stavalues5
2057         FROM dbms_stats.column_stats_effective co
2058         JOIN pg_attribute a
2059           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
2060         JOIN pg_type t
2061           ON a.atttypid = t.oid
2062         JOIN pg_namespace n1
2063           ON t.typnamespace = n1.oid
2064        RIGHT JOIN dbms_stats.relation_stats_effective r
2065           ON co.starelid = r.relid
2066         JOIN pg_catalog.pg_class cl
2067           ON r.relid = cl.oid
2068         JOIN pg_catalog.pg_namespace n2
2069           ON cl.relnamespace = n2.oid
2070        -- WHERE n2.nspname = 'public'
2071        -- AND cl.relname = 'test'
2072        -- AND a.attname = 'id'
2073  WHERE n2.nspname = 's0' AND a.attname IS NULL
2074        ORDER BY starelid, staattnum)
2075 TO STDOUT
2076 (FORMAT 'binary');
2077 \o
2078 COMMIT;
2079 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
2080 SELECT * FROM work_v;
2081  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
2082 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
2083  s0      | st0_idx |        2 |         2 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
2084  s0      | st1_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
2085  s0      | st2_idx |        2 |         3 |             0 |        2 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
2086  s0      | st3     |        0 |         0 |             0 |        0 |         | (null)              | (null)  |    (null) | (null)     |      (null) |   (null) |      (null) |   (null) |   (null) |   (null) |   (null) |   (null) | (null) | (null) | (null) | (null) | (null) | (null)      | (null)      | (null)      | (null)      | (null)      | (null)     | (null)     | (null)     | (null)     | (null)
2087 (4 rows)
2088
2089 \! rm doc/export_effective_stats-9.3.sql.sample_test
2090 TRUNCATE dbms_stats.work;
2091 -- No.16-2-12
2092 \! sed '/ORDER/i\\ WHERE n2.nspname = '"\'s0\'"' AND cl.relname IS NULL' doc/export_effective_stats-9.3.sql.sample > doc/export_effective_stats-9.3.sql.sample_test
2093 \i doc/export_effective_stats-9.3.sql.sample_test
2094 /*
2095  * If you want the statistics of per-relation or per-column, please modify
2096  * nspname, relname, and attname in 'WHERE' clause.
2097  */
2098 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
2099 /*
2100  * If you want to chage the output file name, please modify the following name.
2101  */
2102 \o export_stats.dmp
2103 COPY (SELECT n2.nspname,
2104              cl.relname,
2105              r.relpages,
2106              r.reltuples,
2107              r.relallvisible,
2108              r.curpages,
2109              r.last_analyze,
2110              r.last_autoanalyze,
2111              COALESCE(a.attname, ''),
2112              n1.nspname AS schemaname_of_atttype,
2113              t.typname,
2114              a.atttypmod,
2115              co.stainherit,
2116              co.stanullfrac,
2117              co.stawidth,
2118              co.stadistinct,
2119              co.stakind1,
2120              co.stakind2,
2121              co.stakind3,
2122              co.stakind4,
2123              co.stakind5,
2124              co.staop1,
2125              co.staop2,
2126              co.staop3,
2127              co.staop4,
2128              co.staop5,
2129              co.stanumbers1,
2130              co.stanumbers2,
2131              co.stanumbers3,
2132              co.stanumbers4,
2133              co.stanumbers5,
2134              co.stavalues1,
2135              co.stavalues2,
2136              co.stavalues3,
2137              co.stavalues4,
2138              co.stavalues5
2139         FROM dbms_stats.column_stats_effective co
2140         JOIN pg_attribute a
2141           ON (co.starelid = a.attrelid AND co.staattnum = a.attnum)
2142         JOIN pg_type t
2143           ON a.atttypid = t.oid
2144         JOIN pg_namespace n1
2145           ON t.typnamespace = n1.oid
2146        RIGHT JOIN dbms_stats.relation_stats_effective r
2147           ON co.starelid = r.relid
2148         JOIN pg_catalog.pg_class cl
2149           ON r.relid = cl.oid
2150         JOIN pg_catalog.pg_namespace n2
2151           ON cl.relnamespace = n2.oid
2152        -- WHERE n2.nspname = 'public'
2153        -- AND cl.relname = 'test'
2154        -- AND a.attname = 'id'
2155  WHERE n2.nspname = 's0' AND cl.relname IS NULL
2156        ORDER BY starelid, staattnum)
2157 TO STDOUT
2158 (FORMAT 'binary');
2159 \o
2160 COMMIT;
2161 COPY dbms_stats.work FROM '@abs_srcdir@/export_stats.dmp' (FORMAT 'binary');
2162 SELECT * FROM work_v;
2163  nspname | relname | relpages | reltuples | relallvisible | curpages | attname | nspname_of_typename | typname | atttypmod | stainherit | stanullfrac | stawidth | stadistinct | stakind1 | stakind2 | stakind3 | stakind4 | stakind5 | staop1 | staop2 | staop3 | staop4 | staop5 | stanumbers1 | stanumbers2 | stanumbers3 | stanumbers4 | stanumbers5 | stavalues1 | stavalues2 | stavalues3 | stavalues4 | stavalues5 
2164 ---------+---------+----------+-----------+---------------+----------+---------+---------------------+---------+-----------+------------+-------------+----------+-------------+----------+----------+----------+----------+----------+--------+--------+--------+--------+--------+-------------+-------------+-------------+-------------+-------------+------------+------------+------------+------------+------------
2165 (0 rows)
2166
2167 \! rm doc/export_effective_stats-9.3.sql.sample_test
2168 TRUNCATE dbms_stats.work;
2169 /*
2170  * Stab function dbms_stats.import
2171  */
2172 ALTER FUNCTION dbms_stats.import(
2173     nspname text,
2174     relid regclass,
2175     attname text,
2176     src text
2177 ) RENAME TO truth_import;
2178 CREATE FUNCTION dbms_stats.import(
2179     nspname text,
2180     relid regclass,
2181     attname text,
2182     src text
2183 ) RETURNS void AS
2184 $$
2185 BEGIN
2186     RAISE NOTICE 'arguments are "%", "%", "%", "%"', $1, $2, $3, $4;
2187     RETURN;
2188 END
2189 $$
2190 LANGUAGE plpgsql;
2191 /*
2192  * No.17-1 dbms_stats.import_database_stats(src)
2193  */
2194 -- No.17-1-1
2195 SELECT dbms_stats.import_database_stats('@abs_srcdir@/export_stats.dmp');
2196 NOTICE:  arguments are "<NULL>", "<NULL>", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2197  import_database_stats 
2198 -----------------------
2199  
2200 (1 row)
2201
2202 /*
2203  * No.17-2 dbms_stats.import_schema_stats(schemaname, src)
2204  */
2205 -- No.17-2-1
2206 SELECT dbms_stats.import_schema_stats('s0', '@abs_srcdir@/export_stats.dmp');
2207 NOTICE:  arguments are "s0", "<NULL>", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2208  import_schema_stats 
2209 ---------------------
2210  
2211 (1 row)
2212
2213 /*
2214  * No.17-3 dbms_stats.import_table_stats(relid, src)
2215  */
2216 -- No.17-3-1
2217 SELECT dbms_stats.import_table_stats('s0.st0', '@abs_srcdir@/export_stats.dmp');
2218 NOTICE:  arguments are "<NULL>", "s0.st0", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2219  import_table_stats 
2220 --------------------
2221  
2222 (1 row)
2223
2224 /*
2225  * No.17-4 dbms_stats.import_table_stats(schemaname, tablename, src)
2226  */
2227 -- No.17-4-1
2228 SELECT dbms_stats.import_table_stats('s0', 'st0', '@abs_srcdir@/export_stats.dmp');
2229 NOTICE:  arguments are "<NULL>", "s0.st0", "<NULL>", "@abs_srcdir@/export_stats.dmp"
2230  import_table_stats 
2231 --------------------
2232  
2233 (1 row)
2234
2235 /*
2236  * No.17-5 dbms_stats.import_column_stats (relid, attname, src)
2237  */
2238 -- No.17-5-1
2239 SELECT dbms_stats.import_column_stats('s0.st0', 'id', '@abs_srcdir@/export_stats.dmp');
2240 NOTICE:  arguments are "<NULL>", "s0.st0", "id", "@abs_srcdir@/export_stats.dmp"
2241  import_column_stats 
2242 ---------------------
2243  
2244 (1 row)
2245
2246 /*
2247  * No.17-6 dbms_stats.import_column_stats (schemaname, tablename, attname, src)
2248  */
2249 -- No.17-6-1
2250 SELECT dbms_stats.import_column_stats('s0', 'st0', 'id','@abs_srcdir@/export_stats.dmp');
2251 NOTICE:  arguments are "<NULL>", "s0.st0", "id", "@abs_srcdir@/export_stats.dmp"
2252  import_column_stats 
2253 ---------------------
2254  
2255 (1 row)
2256
2257 /*
2258  * Delete stab function dbms_stats.import
2259  */
2260 DROP FUNCTION dbms_stats.import(
2261     nspname text,
2262     relid regclass,
2263     attname text,
2264     src text
2265 );
2266 ALTER FUNCTION dbms_stats.truth_import(
2267     nspname text,
2268     relid regclass,
2269     attname text,
2270     src text
2271 ) RENAME TO import;