Skip to content

Commit d19a9cb

Browse files
author
Aleksandr Parfenov
committed
Merge branch 'master' into pgpro-1103-flexible-fts
2 parents 35c7df5 + d06aba2 commit d19a9cb

File tree

25 files changed

+770
-194
lines changed

25 files changed

+770
-194
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,23 @@ ANALYZE "S 1"."T 1";
8787
ANALYZE "S 1"."T 2";
8888
ANALYZE "S 1"."T 3";
8989
ANALYZE "S 1"."T 4";
90+
-- record relpages for T 1
91+
create temp table save_t_1_relpages as
92+
select relpages as old_relpages from pg_class where relname = 'T 1';
93+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
94+
reltuples from pg_class where relname = 'T 1';
95+
pg_delta | reltuples
96+
----------+-----------
97+
0 | 1000
98+
(1 row)
99+
100+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
101+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
102+
histogram_bounds
103+
------------------
104+
1000
105+
(1 row)
106+
90107
-- ===================================================================
91108
-- create foreign tables
92109
-- ===================================================================
@@ -5520,6 +5537,20 @@ UPDATE ft2 SET c3 = 'bar' WHERE postgres_fdw_abs(c1) > 2000 RETURNING *;
55205537
2010 | 0 | bar | | | | ft2 |
55215538
(10 rows)
55225539

5540+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
5541+
reltuples from pg_class where relname = 'T 1';
5542+
pg_delta | reltuples
5543+
----------+-----------
5544+
0 | 1000
5545+
(1 row)
5546+
5547+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
5548+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
5549+
histogram_bounds
5550+
------------------
5551+
1000
5552+
(1 row)
5553+
55235554
EXPLAIN (verbose, costs off)
55245555
UPDATE ft2 SET c3 = 'baz'
55255556
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ ANALYZE "S 1"."T 2";
9595
ANALYZE "S 1"."T 3";
9696
ANALYZE "S 1"."T 4";
9797

98+
-- record relpages for T 1
99+
create temp table save_t_1_relpages as
100+
select relpages as old_relpages from pg_class where relname = 'T 1';
101+
102+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
103+
reltuples from pg_class where relname = 'T 1';
104+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
105+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
106+
98107
-- ===================================================================
99108
-- create foreign tables
100109
-- ===================================================================
@@ -1139,6 +1148,10 @@ INSERT INTO ft2 (c1,c2,c3)
11391148
EXPLAIN (verbose, costs off)
11401149
UPDATE ft2 SET c3 = 'bar' WHERE postgres_fdw_abs(c1) > 2000 RETURNING *; -- can't be pushed down
11411150
UPDATE ft2 SET c3 = 'bar' WHERE postgres_fdw_abs(c1) > 2000 RETURNING *;
1151+
select relpages - (select old_relpages from save_t_1_relpages) as pg_delta,
1152+
reltuples from pg_class where relname = 'T 1';
1153+
select (histogram_bounds::text::int[])[array_length(histogram_bounds,1)]
1154+
from pg_stats where tablename = 'T 1' and attname = 'C 1';
11421155
EXPLAIN (verbose, costs off)
11431156
UPDATE ft2 SET c3 = 'baz'
11441157
FROM ft4 INNER JOIN ft5 ON (ft4.c1 = ft5.c1)

doc/src/sgml/ref/analyze.sgml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<synopsis>
24+
ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <replaceable class="parameter">table_and_columns</replaceable> [, ...] ]
2425
ANALYZE [ VERBOSE ] [ <replaceable class="parameter">table_and_columns</replaceable> [, ...] ]
2526

26-
<phrase>where <replaceable class="parameter">table_and_columns</replaceable> is:</phrase>
27+
<phrase>where <replaceable class="parameter">option</replaceable> can be one of:</phrase>
28+
29+
VERBOSE
30+
31+
<phrase>and <replaceable class="parameter">table_and_columns</replaceable> is:</phrase>
2732

2833
<replaceable class="parameter">table_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ]
2934
</synopsis>
@@ -49,6 +54,13 @@ ANALYZE [ VERBOSE ] [ <replaceable class="parameter">table_and_columns</replacea
4954
It is further possible to give a list of column names for a table,
5055
in which case only the statistics for those columns are collected.
5156
</para>
57+
58+
<para>
59+
When the option list is surrounded by parentheses, the options can be
60+
written in any order. The parenthesized syntax was added in
61+
<productname>PostgreSQL</productname> 11; the unparenthesized syntax
62+
is deprecated.
63+
</para>
5264
</refsect1>
5365

5466
<refsect1>

doc/src/sgml/ref/call.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<synopsis>
24-
CALL <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> ] [ , ...] )
24+
CALL <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> ] [, ...] )
2525
</synopsis>
2626
</refsynopsisdiv>
2727

doc/src/sgml/ref/create_table.sgml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
8282

8383
<phrase>and <replaceable class="parameter">like_option</replaceable> is:</phrase>
8484

85-
{ INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS | IDENTITY | INDEXES | STORAGE | COMMENTS | ALL }
85+
{ INCLUDING | EXCLUDING } { COMMENTS | CONSTRAINTS | DEFAULTS | IDENTITY | INDEXES | STATISTICS | STORAGE | ALL }
8686

8787
<phrase>and <replaceable class="parameter">partition_bound_spec</replaceable> is:</phrase>
8888

@@ -591,6 +591,10 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
591591
No distinction is made between column constraints and table
592592
constraints.
593593
</para>
594+
<para>
595+
Extended statistics are copied to the new table if
596+
<literal>INCLUDING STATISTICS</literal> is specified.
597+
</para>
594598
<para>
595599
Indexes, <literal>PRIMARY KEY</literal>, <literal>UNIQUE</literal>,
596600
and <literal>EXCLUDE</literal> constraints on the original table will be
@@ -616,7 +620,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
616620
</para>
617621
<para>
618622
<literal>INCLUDING ALL</literal> is an abbreviated form of
619-
<literal>INCLUDING DEFAULTS INCLUDING IDENTITY INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>.
623+
<literal>INCLUDING COMMENTS INCLUDING CONSTRAINTS INCLUDING DEFAULTS INCLUDING IDENTITY INCLUDING INDEXES INCLUDING STATISTICS INCLUDING STORAGE</literal>.
620624
</para>
621625
<para>
622626
Note that unlike <literal>INHERITS</literal>, columns and

src/backend/access/heap/heapam.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,7 +2411,7 @@ ReleaseBulkInsertStatePin(BulkInsertState bistate)
24112411
* This causes rows to be frozen, which is an MVCC violation and
24122412
* requires explicit options chosen by user.
24132413
*
2414-
* HEAP_INSERT_IS_SPECULATIVE is used on so-called "speculative insertions",
2414+
* HEAP_INSERT_SPECULATIVE is used on so-called "speculative insertions",
24152415
* which can be backed out afterwards without aborting the whole transaction.
24162416
* Other sessions can wait for the speculative insertion to be confirmed,
24172417
* turning it into a regular tuple, or aborted, as if it never existed.
@@ -2420,8 +2420,8 @@ ReleaseBulkInsertStatePin(BulkInsertState bistate)
24202420
*
24212421
* Note that most of these options will be applied when inserting into the
24222422
* heap's TOAST table, too, if the tuple requires any out-of-line data. Only
2423-
* HEAP_INSERT_IS_SPECULATIVE is explicitly ignored, as the toast data does
2424-
* not partake in speculative insertion.
2423+
* HEAP_INSERT_SPECULATIVE is explicitly ignored, as the toast data does not
2424+
* partake in speculative insertion.
24252425
*
24262426
* The BulkInsertState object (if any; bistate can be NULL for default
24272427
* behavior) is also just passed through to RelationGetBufferForTuple.

src/backend/commands/indexcmds.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,8 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
18051805
/*
18061806
* makeObjectName()
18071807
*
1808-
* Create a name for an implicitly created index, sequence, constraint, etc.
1808+
* Create a name for an implicitly created index, sequence, constraint,
1809+
* extended statistics, etc.
18091810
*
18101811
* The parameters are typically: the original table name, the original field
18111812
* name, and a "type" string (such as "seq" or "pkey"). The field name
@@ -1981,6 +1982,8 @@ ChooseIndexName(const char *tabname, Oid namespaceId,
19811982
*
19821983
* We know that less than NAMEDATALEN characters will actually be used,
19831984
* so we can truncate the result once we've generated that many.
1985+
*
1986+
* XXX See also ChooseExtendedStatisticNameAddition.
19841987
*/
19851988
static char *
19861989
ChooseIndexNameAddition(List *colnames)

0 commit comments

Comments
 (0)