Skip to content

Commit fe84577

Browse files
committed
Merge branch 'master' into xtm
2 parents a27166e + 7f11724 commit fe84577

File tree

129 files changed

+5087
-4132
lines changed

Some content is hidden

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

129 files changed

+5087
-4132
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4994,6 +4994,23 @@
49944994
</entry>
49954995
</row>
49964996

4997+
<row>
4998+
<entry><structfield>proparallel</structfield></entry>
4999+
<entry><type>char</type></entry>
5000+
<entry></entry>
5001+
<entry>
5002+
<structfield>proparallel</structfield> tells whether the function
5003+
can be safely run in parallel mode.
5004+
It is <literal>s</literal> for functions which are safe to run in
5005+
parallel mode without restriction.
5006+
It is <literal>r</literal> for functions which can be run in parallel
5007+
mode, but their execution is restricted to the parallel group leader;
5008+
parallel worker processes cannot invoke these functions.
5009+
It is <literal>u</literal> for functions which are unsafe in parallel
5010+
mode; the presence of such a function forces a serial execution plan.
5011+
</entry>
5012+
</row>
5013+
49975014
<row>
49985015
<entry><structfield>pronargs</structfield></entry>
49995016
<entry><type>int2</type></entry>

doc/src/sgml/config.sgml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5549,10 +5549,8 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
55495549
to queries which are run against tables that have row security enabled.
55505550
The default is <literal>on</>. When set to <literal>on</>, all users,
55515551
except superusers and the owner of the table, will have the row
5552-
policies for the table applied to their queries. The table owner and
5553-
superuser can request that row policies be applied to their queries by
5554-
setting this to <literal>force</>. Lastly, this can also be set to
5555-
<literal>off</> which will bypass row policies for the table, if
5552+
policies for the table applied to their queries. When set to
5553+
<literal>off</>, queries will bypass row policies for the table, if
55565554
possible, and error if not.
55575555
</para>
55585556

@@ -5565,13 +5563,6 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
55655563
returned.
55665564
</para>
55675565

5568-
<para>
5569-
The allowed values of <varname>row_security</> are
5570-
<literal>on</> (apply normally - not to superuser or table owner),
5571-
<literal>off</> (fail if row security would be applied), and
5572-
<literal>force</> (apply always - even to superuser and table owner).
5573-
</para>
5574-
55755566
<para>
55765567
For more information on row security policies,
55775568
see <xref linkend="SQL-CREATEPOLICY">.

doc/src/sgml/cube.sgml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,7 @@ t
391391
My thanks are primarily to Prof. Joe Hellerstein
392392
(<ulink url="http://db.cs.berkeley.edu/jmh/"></ulink>) for elucidating the
393393
gist of the GiST (<ulink url="http://gist.cs.berkeley.edu/"></ulink>), and
394-
to his former student, Andy Dong (<ulink
395-
url="http://best.me.berkeley.edu/~adong/"></ulink>), for his example
396-
written for Illustra,
397-
<ulink url="http://best.berkeley.edu/~adong/rtree/index.html"></ulink>.
394+
to his former student Andy Dong for his example written for Illustra.
398395
I am also grateful to all Postgres developers, present and past, for
399396
enabling myself to create my own world and live undisturbed in it. And I
400397
would like to acknowledge my gratitude to Argonne Lab and to the

doc/src/sgml/ddl.sgml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,16 +1585,13 @@ REVOKE ALL ON accounts FROM PUBLIC;
15851585

15861586
<para>
15871587
The table owners and superusers bypass the row security system when
1588-
querying a table, by default. Row security can be enabled for
1589-
superusers and table owners by setting
1590-
<xref linkend="guc-row-security"> to <literal>force</literal>. Any
1591-
user can request that row security be bypassed by setting
1592-
<xref linkend="guc-row-security"> to <literal>off</literal>. If
1593-
the user does not have privileges to bypass row security when
1594-
querying a given table then an error will be returned instead. Other
1595-
users can be granted the ability to bypass the row security system
1596-
with the <literal>BYPASSRLS</literal> role attribute. This
1597-
attribute can only be set by a superuser.
1588+
querying a table. Any user can request that row security be bypassed by
1589+
setting <xref linkend="guc-row-security"> to <literal>off</literal>. If
1590+
the user does not have privileges to bypass row security when querying a
1591+
given table then an error will be returned instead. Other users can be
1592+
granted the ability to bypass the row security system with
1593+
the <literal>BYPASSRLS</literal> role attribute. This attribute can only
1594+
be set by a superuser.
15981595
</para>
15991596

16001597
<para>

doc/src/sgml/func.sgml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4669,7 +4669,7 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
46694669
<entry> <literal>\e</> </entry>
46704670
<entry> the character whose collating-sequence name
46714671
is <literal>ESC</>,
4672-
or failing that, the character with octal value 033 </entry>
4672+
or failing that, the character with octal value <literal>033</> </entry>
46734673
</row>
46744674

46754675
<row>
@@ -4695,15 +4695,17 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
46954695
<row>
46964696
<entry> <literal>\u</><replaceable>wxyz</> </entry>
46974697
<entry> (where <replaceable>wxyz</> is exactly four hexadecimal digits)
4698-
the UTF16 (Unicode, 16-bit) character <literal>U+</><replaceable>wxyz</>
4699-
in the local byte ordering </entry>
4698+
the character whose hexadecimal value is
4699+
<literal>0x</><replaceable>wxyz</>
4700+
</entry>
47004701
</row>
47014702

47024703
<row>
47034704
<entry> <literal>\U</><replaceable>stuvwxyz</> </entry>
47044705
<entry> (where <replaceable>stuvwxyz</> is exactly eight hexadecimal
47054706
digits)
4706-
reserved for a hypothetical Unicode extension to 32 bits
4707+
the character whose hexadecimal value is
4708+
<literal>0x</><replaceable>stuvwxyz</>
47074709
</entry>
47084710
</row>
47094711

@@ -4752,6 +4754,17 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
47524754
Octal digits are <literal>0</>-<literal>7</>.
47534755
</para>
47544756

4757+
<para>
4758+
Numeric character-entry escapes specifying values outside the ASCII range
4759+
(0-127) have meanings dependent on the database encoding. When the
4760+
encoding is UTF-8, escape values are equivalent to Unicode code points,
4761+
for example <literal>\u1234</> means the character <literal>U+1234</>.
4762+
For other multibyte encodings, character-entry escapes usually just
4763+
specify the concatenation of the byte values for the character. If the
4764+
escape value does not correspond to any legal character in the database
4765+
encoding, no error will be raised, but it will never match any data.
4766+
</para>
4767+
47554768
<para>
47564769
The character-entry escapes are always taken as ordinary characters.
47574770
For example, <literal>\135</> is <literal>]</> in ASCII, but

doc/src/sgml/ref/alter_database.sgml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <rep
2525

2626
<phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
2727

28-
IS_TEMPLATE <replaceable class="PARAMETER">istemplate</replaceable>
2928
ALLOW_CONNECTIONS <replaceable class="PARAMETER">allowconn</replaceable>
3029
CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
30+
IS_TEMPLATE <replaceable class="PARAMETER">istemplate</replaceable>
3131

3232
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
3333

@@ -110,17 +110,6 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET ALL
110110
</listitem>
111111
</varlistentry>
112112

113-
<varlistentry>
114-
<term><replaceable class="parameter">istemplate</replaceable></term>
115-
<listitem>
116-
<para>
117-
If true, then this database can be cloned by any user with <literal>CREATEDB</literal>
118-
privileges; if false, then only superusers or the owner of the
119-
database can clone it.
120-
</para>
121-
</listitem>
122-
</varlistentry>
123-
124113
<varlistentry>
125114
<term><replaceable class="parameter">allowconn</replaceable></term>
126115
<listitem>
@@ -140,6 +129,17 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET ALL
140129
</listitem>
141130
</varlistentry>
142131

132+
<varlistentry>
133+
<term><replaceable class="parameter">istemplate</replaceable></term>
134+
<listitem>
135+
<para>
136+
If true, then this database can be cloned by any user with <literal>CREATEDB</literal>
137+
privileges; if false, then only superusers or the owner of the
138+
database can clone it.
139+
</para>
140+
</listitem>
141+
</varlistentry>
142+
143143
<varlistentry>
144144
<term><replaceable>new_name</replaceable></term>
145145
<listitem>

doc/src/sgml/ref/alter_function.sgml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet
3535
CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
3636
IMMUTABLE | STABLE | VOLATILE | [ NOT ] LEAKPROOF
3737
[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
38+
PARALLEL { UNSAFE | RESTRICTED | SAFE }
3839
COST <replaceable class="parameter">execution_cost</replaceable>
3940
ROWS <replaceable class="parameter">result_rows</replaceable>
4041
SET <replaceable class="parameter">configuration_parameter</replaceable> { TO | = } { <replaceable class="parameter">value</replaceable> | DEFAULT }
@@ -191,6 +192,17 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet
191192
</listitem>
192193
</varlistentry>
193194

195+
<varlistentry>
196+
<term><literal>PARALLEL</literal></term>
197+
198+
<listitem>
199+
<para>
200+
Change whether the function is deemed safe for parallelism.
201+
See <xref linkend="sql-createfunction"> for details.
202+
</para>
203+
</listitem>
204+
</varlistentry>
205+
194206
<varlistentry>
195207
<term><literal>LEAKPROOF</literal></term>
196208
<listitem>

doc/src/sgml/ref/comment.sgml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ COMMENT ON
4343
OPERATOR <replaceable class="PARAMETER">operator_name</replaceable> (<replaceable class="PARAMETER">left_type</replaceable>, <replaceable class="PARAMETER">right_type</replaceable>) |
4444
OPERATOR CLASS <replaceable class="PARAMETER">object_name</replaceable> USING <replaceable class="parameter">index_method</replaceable> |
4545
OPERATOR FAMILY <replaceable class="PARAMETER">object_name</replaceable> USING <replaceable class="parameter">index_method</replaceable> |
46+
POLICY <replaceable class="PARAMETER">policy_name</replaceable> ON <replaceable class="PARAMETER">table_name</replaceable> |
4647
[ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">object_name</replaceable> |
4748
ROLE <replaceable class="PARAMETER">object_name</replaceable> |
4849
RULE <replaceable class="PARAMETER">rule_name</replaceable> ON <replaceable class="PARAMETER">table_name</replaceable> |
@@ -113,6 +114,7 @@ COMMENT ON
113114
<term><replaceable class="parameter">constraint_name</replaceable></term>
114115
<term><replaceable class="parameter">function_name</replaceable></term>
115116
<term><replaceable class="parameter">operator_name</replaceable></term>
117+
<term><replaceable class="parameter">policy_name</replaceable></term>
116118
<term><replaceable class="parameter">rule_name</replaceable></term>
117119
<term><replaceable class="parameter">trigger_name</replaceable></term>
118120
<listitem>
@@ -133,9 +135,9 @@ COMMENT ON
133135
<term><replaceable class="parameter">domain_name</replaceable></term>
134136
<listitem>
135137
<para>
136-
When creating a comment on a constraint on a table or a domain, these
137-
parameters specify the name of the table or domain on which the
138-
constraint is defined.
138+
When creating a comment on a constraint, a table, a domain or
139+
a policy these parameters specify the name of the table or domain on
140+
which the constraint is defined.
139141
</para>
140142
</listitem>
141143
</varlistentry>
@@ -315,6 +317,7 @@ COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two texts';
315317
COMMENT ON OPERATOR - (NONE, integer) IS 'Unary minus';
316318
COMMENT ON OPERATOR CLASS int4ops USING btree IS '4 byte integer operators for btrees';
317319
COMMENT ON OPERATOR FAMILY integer_ops USING btree IS 'all integer operators for btrees';
320+
COMMENT ON POLICY my_policy ON mytable IS 'Filter rows by users';
318321
COMMENT ON ROLE my_role IS 'Administration group for finance tables';
319322
COMMENT ON RULE my_rule ON my_table IS 'Logs updates of employee records';
320323
COMMENT ON SCHEMA my_schema IS 'Departmental data';

doc/src/sgml/ref/create_database.sgml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
2828
[ LC_COLLATE [=] <replaceable class="parameter">lc_collate</replaceable> ]
2929
[ LC_CTYPE [=] <replaceable class="parameter">lc_ctype</replaceable> ]
3030
[ TABLESPACE [=] <replaceable class="parameter">tablespace_name</replaceable> ]
31-
[ IS_TEMPLATE [=] <replaceable class="parameter">istemplate</replaceable> ]
3231
[ ALLOW_CONNECTIONS [=] <replaceable class="parameter">allowconn</replaceable> ]
3332
[ CONNECTION LIMIT [=] <replaceable class="parameter">connlimit</replaceable> ] ]
33+
[ IS_TEMPLATE [=] <replaceable class="parameter">istemplate</replaceable> ]
3434
</synopsis>
3535
</refsynopsisdiv>
3636

@@ -149,17 +149,6 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
149149
</listitem>
150150
</varlistentry>
151151

152-
<varlistentry>
153-
<term><replaceable class="parameter">istemplate</replaceable></term>
154-
<listitem>
155-
<para>
156-
If true, then this database can be cloned by any user with <literal>CREATEDB</literal>
157-
privileges; if false (the default), then only superusers or the owner
158-
of the database can clone it.
159-
</para>
160-
</listitem>
161-
</varlistentry>
162-
163152
<varlistentry>
164153
<term><replaceable class="parameter">allowconn</replaceable></term>
165154
<listitem>
@@ -180,6 +169,17 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
180169
</para>
181170
</listitem>
182171
</varlistentry>
172+
173+
<varlistentry>
174+
<term><replaceable class="parameter">istemplate</replaceable></term>
175+
<listitem>
176+
<para>
177+
If true, then this database can be cloned by any user with <literal>CREATEDB</literal>
178+
privileges; if false (the default), then only superusers or the owner
179+
of the database can clone it.
180+
</para>
181+
</listitem>
182+
</varlistentry>
183183
</variablelist>
184184

185185
<para>

doc/src/sgml/ref/create_function.sgml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ CREATE [ OR REPLACE ] FUNCTION
3030
| IMMUTABLE | STABLE | VOLATILE | [ NOT ] LEAKPROOF
3131
| CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
3232
| [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
33+
| PARALLEL { UNSAFE | RESTRICTED | SAFE }
3334
| COST <replaceable class="parameter">execution_cost</replaceable>
3435
| ROWS <replaceable class="parameter">result_rows</replaceable>
3536
| SET <replaceable class="parameter">configuration_parameter</replaceable> { TO <replaceable class="parameter">value</replaceable> | = <replaceable class="parameter">value</replaceable> | FROM CURRENT }
@@ -411,6 +412,43 @@ CREATE [ OR REPLACE ] FUNCTION
411412
</listitem>
412413
</varlistentry>
413414

415+
<varlistentry>
416+
<term><literal>PARALLEL</literal></term>
417+
418+
<listitem>
419+
<para><literal>PARALLEL UNSAFE</literal> indicates that the function
420+
can't be executed in parallel mode and the presence of such a
421+
function in an SQL statement forces a serial execution plan. This is
422+
the default. <literal>PARALLEL RESTRICTED</literal> indicates that
423+
the function can be executed in parallel mode, but the execution is
424+
restricted to parallel group leader. <literal>PARALLEL SAFE</literal>
425+
indicates that the function is safe to run in parallel mode without
426+
restriction.
427+
</para>
428+
429+
<para>
430+
Functions should be labeled parallel unsafe if they modify any database
431+
state, or if they make changes to the transaction such as using
432+
sub-transactions, or if they access sequences or attempt to make
433+
persistent changes to settings (e.g. <literal>setval</>). They should
434+
be labeled as parallel restricted if they access temporary tables,
435+
client connection state, cursors, prepared statements, or miscellaneous
436+
backend-local state which the system cannot synchronize in parallel mode
437+
(e.g. <literal>setseed</> cannot be executed other than by the group
438+
leader because a change made by another process would not be reflected
439+
in the leader). In general, if a function is labeled as being safe when
440+
it is restricted or unsafe, or if it is labeled as being restricted when
441+
it is in fact unsafe, it may throw errors or produce wrong answers
442+
when used in a parallel query. C-language functions could in theory
443+
exhibit totally undefined behavior if mislabeled, since there is no way
444+
for the system to protect itself against arbitrary C code, but in most
445+
likely cases the result will be no worse than for any other function.
446+
If in doubt, functions should be labeled as <literal>UNSAFE</>, which is
447+
the default.
448+
</para>
449+
</listitem>
450+
</varlistentry>
451+
414452
<varlistentry>
415453
<term><replaceable class="parameter">execution_cost</replaceable></term>
416454

doc/src/sgml/ref/create_policy.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
3434

3535
<para>
3636
The <command>CREATE POLICY</command> command defines a new policy for a
37-
table. Note that row level security must also be enabled on the table using
37+
table. Note that row-level security must also be enabled on the table using
3838
<command>ALTER TABLE</command> in order for created policies to be applied.
3939
</para>
4040

@@ -305,7 +305,7 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable
305305
<literal>UPDATE</literal> path is taken. Any existing row that
306306
necessitates that the <literal>UPDATE</literal> path be taken must pass
307307
the (UPDATE or ALL) <literal>USING</literal> qualifications (combined
308-
using <literal>OR</literal>), which are always enforced as WTIH CHECK
308+
using <literal>OR</literal>), which are always enforced as WITH CHECK
309309
options in this context (the <literal>UPDATE</literal> path will
310310
<emphasis>never</> be silently avoided; an error will be thrown
311311
instead). Finally, the final row appended to the relation must pass

doc/src/sgml/ref/pg_ctl-ref.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ PostgreSQL documentation
427427
Name of the event source for <application>pg_ctl</application> to use
428428
for logging to the event log when running as a Windows service. The
429429
default is <literal>PostgreSQL</literal>. Note that this only controls
430-
the logging from <application>pg_ctl</application> itself - once
430+
the logging from <application>pg_ctl</application> itself; once
431431
started, the server will use the event source specified
432432
by <xref linkend="guc-event-source">. Should the server fail during
433-
early startup, it may also log using the default event
433+
early startup, it might also log using the default event
434434
source <literal>PostgreSQL</literal>.
435435
</para>
436436
</listitem>

0 commit comments

Comments
 (0)