8000 Merge branch 'master' of github.com:postgres/postgres · ololobus/postgres@5fcc467 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fcc467

Browse files
committed
Merge branch 'master' of github.com:postgres/postgres
2 parents 2a9db71 + a387a3d commit 5fcc467

File tree

109 files changed

+1409
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1409
-530
lines changed

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,11 +3947,12 @@ apply_returning_filter(PgFdwDirectModifyState *dmstate,
39473947
ExecStoreVirtualTuple(resultSlot);
39483948

39493949
/*
3950-
* If we have any system columns to return, install them.
3950+
* If we have any system columns to return, materialize a heap tuple in the
3951+
* slot from column values set above and install system columns in that tuple.
39513952
*/
39523953
if (dmstate->hasSystemCols)
39533954
{
3954-
HeapTuple resultTup = ExecMaterializeSlot(resultSlot);
3955+
HeapTuple resultTup = ExecFetchSlotHeapTuple(resultSlot, true, NULL);
39553956

39563957
/* ctid */
39573958
if (dmstate->ctidAttno)

doc/src/sgml/func.sgml

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7179,16 +7179,25 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
71797179
<literal><function>date_trunc(<type>text</type>, <type>timestamp</type>)</function></literal>
71807180
</entry>
71817181
<entry><type>timestamp</type></entry>
7182-
<entry>Truncate to specified precision; see also <xref linkend="functions-datetime-trunc"/>
7182+
<entry>Truncate to specified precision; see <xref linkend="functions-datetime-trunc"/>
71837183
</entry>
71847184
<entry><literal>date_trunc('hour', timestamp '2001-02-16 20:38:40')</literal></entry>
71857185
<entry><literal>2001-02-16 20:00:00</literal></entry>
71867186
</row>
71877187

7188+
<row>
7189+
<entry><literal><function>date_trunc(<type>text</type>, <type>timestamp with time zone</type>, <type>text</type>)</function></literal></entry>
7190+
<entry><type>timestamp with time zone</type></entry>
7191+
<entry>Truncate to specified precision in the specified time zone; see <xref linkend="functions-datetime-trunc"/>
7192+
</entry>
7193+
<entry><literal>date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')</literal></entry>
7194+
<entry><literal>2001-02-16 13:00:00+00</literal></entry>
7195+
</row>
7196+
71887197
<row>
71897198
<entry><literal><function>date_trunc(<type>text</type>, <type>interval</type>)</function></literal></entry>
71907199
<entry><type>interval</type></entry>
7191-
<entry>Truncate to specified precision; see also <xref linkend="functions-datetime-trunc"/>
7200+
<entry>Truncate to specified precision; see <xref linkend="functions-datetime-trunc"/>
71927201
</entry>
71937202
<entry><literal>date_trunc('hour', interval '2 days 3 hours 40 minutes')</literal></entry>
71947203
<entry><literal>2 days 03:00:00</literal></entry>
@@ -8078,17 +8087,19 @@ SELECT date_part('hour', INTERVAL '4 hours 3 minutes');
80788087

80798088
<para>
80808089
<synopsis>
8081-
date_trunc('<replaceable>field</replaceable>', <replaceable>source</replaceable>)
8090+
date_trunc(<replaceable>field</replaceable>, <replaceable>source</replaceable> [, <replaceable>time_zone</replaceable> ])
80828091
</synopsis>
80838092
<replaceable>source</replaceable> is a value expression of type
8084-
<type>timestamp</type> or <type>interval</type>.
8093+
<type>timestamp</type>, <type>timestamp with time zone</type>,
8094+
or <type>interval</type>.
80858095
(Values of type <type>date</type> and
80868096
<type>time</type> are cast automatically to <type>timestamp</type> or
80878097
<type>interval</type>, respectively.)
80888098
<replaceable>field</replaceable> selects to which precision to
8089-
truncate the input value. The return value is of type
8090-
<type>timestamp</type> or <type>interval</type>
8091-
with all fields that are less significant than the
8099+
truncate the input value. The return value is likewise of type
8100+
<type>timestamp</type>, <type>timestamp with time zone</type>,
8101+
or <type>interval</type>,
8102+
and it has all fields that are less significant than the
80928103
selected one set to zero (or one, for day and month).
80938104
</para>
80948105

@@ -8112,13 +8123,39 @@ date_trunc('<replaceable>field</replaceable>', <replaceable>source</replaceable>
81128123
</para>
81138124

81148125
<para>
8115-
Examples:
8126+
When the input value is of type <type>timestamp with time zone</type>,
8127+
the truncation is performed with respect to a particular time zone;
8128+
for example, truncation to <literal>day</literal> produces a value that
8129+
is midnight in that zone. By default, truncation is done with respect
8130+
to the current <xref linkend="guc-timezone"/> setting, but the
8131+
optional <replaceable>time_zone</replaceable> argument can be provided
8132+
to specify a different time zone. The time zone name can be specified
8133+
in any of the ways described in <xref linkend="datatype-timezones"/>.
8134+
</para>
8135+
8136+
<para>
8137+
A time zone cannot be specified when processing <type>timestamp without
8138+
time zone</type> or <type>interval</type> inputs. These are always
8139+
taken at face value.
8140+
</para>
8141+
8142+
<para>
8143+
Examples (assuming the local time zone is <literal>America/New_York</literal>):
81168144
<screen>
81178145
SELECT date_trunc('hour', TIMESTAMP '2001-02-16 20:38:40');
81188146
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 20:00:00</computeroutput>
81198147

81208148
SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
81218149
<lineannotation>Result: </lineannotation><computeroutput>2001-01-01 00:00:00</computeroutput>
8150+
8151+
SELECT date_trunc('day', TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40+00');
8152+
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 00:00:00-05</computeroutput>
8153+
8154+
SELECT date_trunc('day', TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40+00', 'Australia/Sydney');
8155+
<lineannotation>Result: </lineannotation><computeroutput>2001-02-16 08:00:00-05</computeroutput>
8156+
8157+
SELECT date_trunc('hour', INTERVAL '3 days 02:47:33');
8158+
<lineannotation>Result: </lineannotation><computeroutput>3 days 02:00:00</computeroutput>
81228159
</screen>
81238160
</para>
81248161
</sect2>

doc/src/sgml/monitoring.sgml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
804804
<entry><type>text</type></entry>
805805
<entry>Type of current backend. Possible types are
806806
<literal>autovacuum launcher</literal>, <literal>autovacuum worker</literal>,
807-
<literal>background worker</literal>, <literal>background writer</literal>,
807+
<literal>logical replication launcher</literal>,
808+
<literal>logical replication worker</literal>,
809+
<literal>parallel worker</literal>, <literal>background writer</literal>,
808810
<literal>client backend</literal>, <literal>checkpointer</literal>,
809811
<literal>startup</literal>, <literal>walreceiver</literal>,
810812
<literal>walsender</literal> and <literal>walwriter</literal>.
813+
In addition, background workers registered by extensions may have
814+
additional types.
811815
</entry>
812816
</row>
813817
</tbody>

doc/src/sgml/mvcc.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,10 @@ ERROR: could not serialize access due to read/write dependencies among transact
926926
<para>
927927
Acquired by <command>VACUUM</command> (without <option>FULL</option>),
928928
<command>ANALYZE</command>, <command>CREATE INDEX CONCURRENTLY</command>,
929-
<command>CREATE STATISTICS</command> and
930-
<command>ALTER TABLE VALIDATE</command> and other
931-
<command>ALTER TABLE</command> variants (for full details see
932-
<xref linkend="sql-altertable"/>).
929+
<command>CREATE STATISTICS</command>, and certain <command>ALTER
930+
INDEX</command> and <command>ALTER TABLE</command> variants (for full
931+
details see <xref linkend="sql-alterindex"/> and <xref
932+
linkend="sql-altertable"/>).
933933
</para>
934934
</listitem>
935935
</varlistentry>
@@ -970,7 +970,7 @@ ERROR: could not serialize access due to read/write dependencies among transact
970970
</para>
971971

972972
<para>
973-
Acquired by <command>CREATE TRIGGER</command> and many forms of
973+
Acquired by <command>CREATE TRIGGER</command> and some forms of
974974
<command>ALTER TABLE</command> (see <xref linkend="sql-altertable"/>).
975975
</para>
976976
</listitem>
@@ -1020,7 +1020,7 @@ ERROR: could not serialize access due to read/write dependencies among transact
10201020
<command>CLUSTER</command>, <command>VACUUM FULL</command>,
10211021
and <command>REFRESH MATERIALIZED VIEW</command> (without
10221022
<option>CONCURRENTLY</option>)
1023-
commands. Many forms of <command>ALTER TABLE</command> also acquire
1023+
commands. Many forms of <command>ALTER INDEX</command> and <command>ALTER TABLE</command> also acquire
10241024
a lock at this level. This is also the default lock mode for
10251025
<command>LOCK TABLE</command> statements that do not specify
10261026
a mode explicitly.

doc/src/sgml/ref/alter_index.sgml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ ALTER INDEX ALL IN TABLESPACE <replaceable class="parameter">name</replaceable>
3939

4040
<para>
4141
<command>ALTER INDEX</command> changes the definition of an existing index.
42-
There are several subforms:
42+
There are several subforms described below. Note that the lock level required
43+
may differ for each subform. An <literal>ACCESS EXCLUSIVE</literal> lock is held
44+
unless explicitly noted. When multiple subcommands are listed, the lock
45+
held will be the strictest one required from any subcommand.
4346

4447
<variablelist>
4548

@@ -53,6 +56,10 @@ ALTER INDEX ALL IN TABLESPACE <replaceable class="parameter">name</replaceable>
5356
or <literal>EXCLUDE</literal>), the constraint is renamed as well.
5457
There is no effect on the stored data.
5558
</para>
59+
<para>
60+
Renaming an index acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
61+
lock.
62+
</para>
5663
</listitem>
5764
</varlistentry>
5865

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,8 +2589,7 @@ lo_import 152801
25892589
<literal>latex</literal> (uses <literal>tabular</literal>),
25902590
<literal>latex-longtable</literal>, <literal>troff-ms</literal>,
25912591
<literal>unaligned</literal>, or <literal>wrapped</literal>.
2592-
Unique abbreviations are allowed. (That would mean one letter
2593-
is enough.)
2592+
Unique abbreviations are allowed.
25942593
</para>
25952594

25962595
<para><literal>unaligned</literal> format writes all columns of a row on one

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4503,7 +4503,8 @@ ProjIndexIsUnchanged(Relation relation, HeapTuple oldtup, HeapTuple newtup)
45034503
List *indexoidlist = RelationGetIndexList(relation);
45044504
EState *estate = CreateExecutorState();
45054505
ExprContext *econtext = GetPerTupleExprContext(estate);
4506-
TupleTableSlot *slot = MakeSingleTupleTableSlot(RelationGetDescr(relation));
4506+
TupleTableSlot *slot = MakeSingleTupleTableSlot(RelationGetDescr(relation),
4507+
&TTSOpsHeapTuple);
45074508
bool equals = true;
45084509
Datum old_values[INDEX_MAX_KEYS];
45094510
bool old_isnull[INDEX_MAX_KEYS];

src/backend/catalog/index.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,8 @@ IndexBuildHeapRangeScan(Relation heapRelation,
25102510
*/
25112511
estate = CreateExecutorState();
25122512
econtext = GetPerTupleExprContext(estate);
2513-
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
2513+
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
2514+
&TTSOpsHeapTuple);
25142515

25152516
/* Arrange for econtext's scan tuple to be the tuple under test */
25162517
econtext->ecxt_scantuple = slot;
@@ -2997,7 +2998,8 @@ IndexCheckExclusion(Relation heapRelation,
29972998
*/
29982999
estate = CreateExecutorState();
29993000
econtext = GetPerTupleExprContext(estate);
3000-
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
3001+
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
3002+
&TTSOpsHeapTuple);
30013003

30023004
/* Arrange for econtext's scan tuple to be the tuple under test */
30033005
econtext->ecxt_scantuple = slot;
@@ -3315,7 +3317,8 @@ validate_index_heapscan(Relation heapRelation,
33153317
*/
33163318
estate = CreateExecutorState();
33173319
econtext = GetPerTupleExprContext(estate);
3318-
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
3320+
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
3321+
&TTSOpsHeapTuple);
33193322

33203323
/* Arrange for econtext's scan tuple to be the tuple under test */
33213324
econtext->ecxt_scantuple = slot;

src/backend/catalog/indexing.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple)
9595
heapRelation = indstate->ri_RelationDesc;
9696

9797
/* Need a slot to hold the tuple being examined */
98-
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
98+
slot = MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
99+
&TTSOpsHeapTuple);
99100
ExecStoreHeapTuple(heapTuple, slot, false);
100101

101102
/*

src/backend/commands/analyze.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,8 @@ compute_index_stats(Relation onerel, double totalrows,
730730
estate = CreateExecutorState();
731731
econtext = GetPerTupleExprContext(estate);
732732
/* Need a slot to hold the current heap tuple, too */
733-
slot = MakeSingleTupleTableSlot(RelationGetDescr(onerel));
733+
slot = MakeSingleTupleTableSlot(RelationGetDescr(onerel),
734+
&TTSOpsHeapTuple);
734735

735736
/* Arrange for econtext's scan tuple to be the tuple under test */
736737
econtext->ecxt_scantuple = slot;

0 commit comments

Comments
 (0)
0