|
51 | 51 | The <literal>INSERT</> statement takes form of |
52 | 52 | <screen> |
53 | 53 | WITH upsert as ( |
54 | | - UPDATE pg_catalog.pg_statistic SET%s |
55 | | - WHERE to_schema_qualified_relation(starelid) =relname |
56 | | - AND to_attname(relname, staattnum) =attname |
57 | | - AND to_atttype(relname, staattnum) =atttype |
58 | | - AND stainherit =r.stainherit |
| 54 | + UPDATE pg_catalog.pg_statistic SET<replaceable class="PARAMETER">column_name</> = <replaceable class="PARAMETER">expression</> [, ...] |
| 55 | + WHERE to_schema_qualified_relation(starelid) =<replaceable class="PARAMETER">t_relname</> |
| 56 | + AND to_attname(<replaceable class="PARAMETER">t_relname</>, staattnum) =<replaceable class="PARAMETER">t_attname</> |
| 57 | + AND to_atttype(<replaceable class="PARAMETER">t_relname</>, staattnum) =<replaceable class="PARAMETER">t_atttype</> |
| 58 | + AND stainherit =<replaceable class="PARAMETER">t_stainherit</> |
59 | 59 | RETURNING *) |
60 | 60 | ins as ( |
61 | | - SELECT%s |
| 61 | + SELECT<replaceable class="PARAMETER">expression</> [, ...] |
62 | 62 | WHERE NOT EXISTS (SELECT * FROM upsert) |
63 | | - AND to_attnum(relname, attname) IS NOT NULL |
64 | | - AND to_atttype(relname, attname) =atttype) |
| 63 | + AND to_attnum(<replaceable class="PARAMETER">t_relname</>, <replaceable class="PARAMETER">t_attname</>) IS NOT NULL |
| 64 | + AND to_atttype(<replaceable class="PARAMETER">t_relname</>, <replaceable class="PARAMETER">t_attname</>) =<replaceable class="PARAMETER">t_atttype</>) |
65 | 65 | INSERT INTO pg_catalog.pg_statistic SELECT * FROM ins; |
| 66 | + |
| 67 | +where <replaceable class="PARAMETER">expression</> can be one of: |
| 68 | + |
| 69 | +array_in(<replaceable class="PARAMETER">array_text</>, <replaceable class="PARAMETER">type_name</>::regtype::oid, -1) |
| 70 | +<replaceable class="PARAMETER">value</>::<replaceable class="PARAMETER">type_name</> |
66 | 71 | </screen> |
67 | 72 | </para> |
68 | 73 |
|
69 | 74 | <para> |
70 | 75 | Produced statements could be saved to a file, e.g. |
71 | 76 | <screen> |
72 | | -\COPY (select dump_statistic()) TO 'dump_stat.sql' |
| 77 | +test=#\COPY (select dump_statistic()) TO 'dump_stat.sql' |
73 | 78 | </screen> |
74 | 79 | </para> |
75 | 80 | </listitem> |
|